/trunk/Scribus/scribus/desaxe/digester.cpp |
---|
92,28 → 92,28 |
}; |
Digester::Digester() : objects(), storage(), errors() |
Digester::Digester() : m_objects(), m_storage(), m_errors() |
{ |
state = new RuleState(); |
result_.ptr = NULL; |
result_.type = ""; |
m_state = new RuleState(); |
m_result_.ptr = NULL; |
m_result_.type = ""; |
} |
Digester::~Digester() { |
delete state; |
deletePatches(patches); |
delete m_state; |
deletePatches(m_patches); |
} |
Digester& Digester::operator=(const Digester& other) |
{ |
delete state; |
state = new RuleState(*other.state); |
objects = other.objects; |
storage = other.storage; |
result_ = other.result_; |
errors = other.errors; |
delete m_state; |
m_state = new RuleState(*other.m_state); |
m_objects = other.m_objects; |
m_storage = other.m_storage; |
m_result_ = other.m_result_; |
m_errors = other.m_errors; |
return *this; |
} |
120,12 → 120,12 |
int Digester::nrOfErrors() const |
{ |
return errors.size(); |
return m_errors.size(); |
} |
const Xml_string Digester::getError(int i) const |
{ |
return errors[i]; |
return m_errors[i]; |
} |
132,21 → 132,21 |
void Digester::addRule(const Xml_string& pattern, Action action) |
{ |
action.setDigester(this); |
state->addRule(pattern, action); |
m_state->addRule(pattern, action); |
} |
void Digester::reset() |
{ |
objects.clear(); |
storage.clear(); |
result_.ptr = NULL; |
result_.type = ""; |
errors.clear(); |
m_objects.clear(); |
m_storage.clear(); |
m_result_.ptr = NULL; |
m_result_.type = ""; |
m_errors.clear(); |
} |
void Digester::beginDoc() |
{ |
state->reset(); |
m_state->reset(); |
#ifdef DESAXE_DEBUG |
state->dump(); |
#endif |
158,8 → 158,8 |
void Digester::begin(const Xml_string& tag, Xml_attr attr) |
{ |
state->open(tag); |
const std::vector<rule_t>& rules (state->rulesForCurrentState()); |
m_state->open(tag); |
const std::vector<rule_t>& rules (m_state->rulesForCurrentState()); |
std::vector<rule_t>::const_iterator it; |
for(it=rules.begin(); it!=rules.end(); ++it) |
{ |
172,7 → 172,7 |
void Digester::end(const Xml_string& tag) |
{ |
const std::vector<rule_t>& rules (state->rulesForCurrentState()); |
const std::vector<rule_t>& rules (m_state->rulesForCurrentState()); |
std::vector<rule_t>::const_reverse_iterator it; |
for(it=rules.rbegin(); it!=rules.rend(); ++it) |
{ |
181,12 → 181,12 |
#endif |
const_cast<Action&>(it->second).end(tag); |
} |
state->close(); |
m_state->close(); |
} |
void Digester::chars(const Xml_string& text) |
{ |
const std::vector<rule_t>& rules (state->rulesForCurrentState()); |
const std::vector<rule_t>& rules (m_state->rulesForCurrentState()); |
std::vector<rule_t>::const_iterator it; |
for(it=rules.begin(); it!=rules.end(); ++it) |
{ |
/trunk/Scribus/scribus/desaxe/digester.h |
---|
156,22 → 156,22 |
private: |
RuleState* |
state; |
m_state; |
std::vector<PRIVATE::VarPtr> |
objects; |
m_objects; |
std::map<Xml_string, PRIVATE::VarPtr> |
storage; |
m_storage; |
std::map<Xml_string, PRIVATE::Patch*> |
patches; |
m_patches; |
PRIVATE::VarPtr |
result_; |
m_result_; |
std::vector<Xml_string> |
errors; |
m_errors; |
}; |
183,14 → 183,14 |
#ifdef DESAXE_DEBUG |
std::cerr << "top(" << offset << ") of " << objects.size() << "\n"; |
#endif |
unsigned int count = objects.size(); |
unsigned int count = m_objects.size(); |
assert (offset < count); |
PRIVATE::chkcell<ObjType>(objects[count - offset - 1], &objects); |
PRIVATE::chkcell<ObjType>(m_objects[count - offset - 1], &m_objects); |
#ifdef DESAXE_DEBUG |
std::cerr << "stack-> " << static_cast<ObjType*>(objects[count - offset - 1].ptr) << "\n"; |
#endif |
return static_cast<ObjType*>(objects[count - offset - 1].ptr); |
return static_cast<ObjType*>(m_objects[count - offset - 1].ptr); |
} |
202,9 → 202,9 |
std::cerr << "bottom(" << offset << ") of " << objects.size() << "\n"; |
#endif |
//unsigned int count = objects.size(); |
assert (offset < objects.size()); |
PRIVATE::chkcell<ObjType> (objects[offset]); |
return static_cast<ObjType*>(objects[offset].ptr); |
assert (offset < m_objects.size()); |
PRIVATE::chkcell<ObjType> (m_objects[offset]); |
return static_cast<ObjType*>(m_objects[offset].ptr); |
} |
213,12 → 213,12 |
ObjType* Digester::result() |
{ |
ObjType* dummy = NULL; |
if (result_.type != typeid(dummy).name()) |
if (m_result_.type != typeid(dummy).name()) |
return NULL; |
#ifdef DESAXE_DEBUG |
std::cerr << "result-> " << static_cast<ObjType*>(result_.ptr) << "\n"; |
#endif |
return static_cast<ObjType*>(result_.ptr); |
return static_cast<ObjType*>(m_result_.ptr); |
} |
229,7 → 229,7 |
#ifdef DESAXE_DEBUG |
std::cerr << res << " ->result\n"; |
#endif |
result_ = PRIVATE::mkcell(res); |
m_result_ = PRIVATE::mkcell(res); |
} |
236,16 → 236,16 |
inline |
void Digester::pop() |
{ |
assert (1 <= (unsigned int) objects.size()); |
objects.pop_back(); |
assert (1 <= (unsigned int) m_objects.size()); |
m_objects.pop_back(); |
} |
inline |
void Digester::popn(unsigned int number) |
{ |
unsigned int count = (unsigned int) objects.size(); |
unsigned int count = (unsigned int) m_objects.size(); |
assert (number <= count); |
objects.resize(count - number); |
m_objects.resize(count - number); |
} |
256,7 → 256,7 |
#ifdef DESAXE_DEBUG |
std::cerr << "stack<- " << obj << "\n"; |
#endif |
objects.push_back(PRIVATE::mkcell(obj)); |
m_objects.push_back(PRIVATE::mkcell(obj)); |
} |
338,8 → 338,8 |
{ |
using namespace PRIVATE; |
std::map<Xml_string, VarPtr>::iterator cell = storage.find(idref); |
if (cell == storage.end()) |
std::map<Xml_string, VarPtr>::iterator cell = m_storage.find(idref); |
if (cell == m_storage.end()) |
{ |
#ifdef DESAXE_DEBUG |
std::cerr << "lookup[" << idref << "]-> NULL\n"; |
366,8 → 366,8 |
#ifdef DESAXE_DEBUG |
std::cerr << "store[" << idref << "] <- " << obj << "\n"; |
#endif |
storage[idref] = mkcell(obj); |
runPatches(patches[idref], storage[idref]); |
m_storage[idref] = mkcell(obj); |
runPatches(m_patches[idref], m_storage[idref]); |
} |
377,10 → 377,10 |
{ |
using namespace PRIVATE; |
std::map<Xml_string, VarPtr>::iterator cell = storage.find(idref); |
if (cell == storage.end()) |
std::map<Xml_string, VarPtr>::iterator cell = m_storage.find(idref); |
if (cell == m_storage.end()) |
{ |
patches[idref] = new Patch1<LinkType>(fun, patches[idref] ); |
m_patches[idref] = new Patch1<LinkType>(fun, m_patches[idref] ); |
} |
else |
{ |
394,10 → 394,10 |
{ |
using namespace PRIVATE; |
std::map<Xml_string, VarPtr>::iterator cell = storage.find(idref); |
if (cell == storage.end()) |
std::map<Xml_string, VarPtr>::iterator cell = m_storage.find(idref); |
if (cell == m_storage.end()) |
{ |
patches[idref] = new Patch2<ObjType,LinkType>(obj, fun, patches[idref] ); |
m_patches[idref] = new Patch2<ObjType,LinkType>(obj, fun, m_patches[idref] ); |
} |
else |
{ |
/trunk/Scribus/scribus/desaxe/saxXML.cpp |
---|
14,10 → 14,10 |
using namespace std; |
SaxXML::SaxXML(std::ostream& file, bool pretty) : m_stream(file), |
m_pretty(pretty), m_indentLevel(0), pendingEmptyTag(false) {} |
m_pretty(pretty), m_indentLevel(0), m_pendingEmptyTag(false) {} |
SaxXML::SaxXML(const char* filename, bool pretty) : m_file(filename, ios::out | ios::binary), m_stream(m_file), |
m_pretty(pretty), m_indentLevel(0), pendingEmptyTag(false) {} |
m_pretty(pretty), m_indentLevel(0), m_pendingEmptyTag(false) {} |
SaxXML::~SaxXML() { m_stream.flush(); m_file.close(); } |
36,7 → 36,7 |
void SaxXML::finalizePendingEmptyTag() |
{ |
if (pendingEmptyTag) { |
if (m_pendingEmptyTag) { |
if (m_pretty && m_manyAttributes) |
{ |
m_stream << "\n"; |
46,7 → 46,7 |
} |
else |
m_stream << " >"; |
pendingEmptyTag = false; |
m_pendingEmptyTag = false; |
} |
} |
87,7 → 87,7 |
m_stream << " " << fromXMLString(Xml_key(it)) << "=\"" << fromXMLString(txt) << "\""; |
} |
} |
pendingEmptyTag = true; |
m_pendingEmptyTag = true; |
++m_indentLevel; |
} |
95,7 → 95,7 |
void SaxXML::end(const Xml_string& tag) |
{ |
--m_indentLevel; |
if (pendingEmptyTag) { |
if (m_pendingEmptyTag) { |
if (m_pretty && m_manyAttributes) |
{ |
m_stream << "\n"; |
103,7 → 103,7 |
m_stream << " "; |
} |
m_stream << " />"; |
pendingEmptyTag = false; |
m_pendingEmptyTag = false; |
} |
else { |
if (m_pretty) |
/trunk/Scribus/scribus/desaxe/saxXML.h |
---|
34,7 → 34,7 |
bool m_pretty; |
int m_indentLevel; |
bool m_manyAttributes; |
bool pendingEmptyTag; |
bool m_pendingEmptyTag; |
void finalizePendingEmptyTag(); |
}; |
/trunk/Scribus/scribus/desaxe/uniqueid.cpp |
---|
11,15 → 11,15 |
void UniqueID::begin(const Xml_string& tag, Xml_attr attr) |
{ |
if (level > 0) // skip mode |
++level; |
if (m_level > 0) // skip mode |
++m_level; |
else |
{ |
Xml_attr::iterator it = attr.find("id"); |
if (it != attr.end() && seenIDs.find(Xml_data(it)) != seenIDs.end()) |
if (it != attr.end() && m_seenIDs.find(Xml_data(it)) != m_seenIDs.end()) |
{ |
// enter skip mode |
level = 1; |
m_level = 1; |
// replace with <tag idref="seenid" /> |
Xml_attr idattr; |
idattr["idref"] = Xml_data(it); |
29,7 → 29,7 |
else |
{ |
if (it != attr.end()) |
seenIDs.insert(Xml_data(it)); |
m_seenIDs.insert(Xml_data(it)); |
SaxFilter::begin(tag, attr); |
} |
} |
38,8 → 38,8 |
void UniqueID::end(const Xml_string& tag) |
{ |
if (level > 0) // skip mode |
--level; |
if (m_level > 0) // skip mode |
--m_level; |
else |
SaxFilter::end(tag); |
} |
46,6 → 46,6 |
void UniqueID::chars(const Xml_string& text) |
{ |
if (level == 0) |
if (m_level == 0) |
SaxFilter::chars(text); |
} |
/trunk/Scribus/scribus/desaxe/uniqueid.h |
---|
20,13 → 20,13 |
*/ |
class UniqueID : public SaxFilter { |
public: |
UniqueID(SaxHandler* delegate) : SaxFilter(delegate), seenIDs(), level(0) {} |
UniqueID(SaxHandler* delegate) : SaxFilter(delegate), m_seenIDs(), m_level(0) {} |
virtual void begin(const Xml_string& tag, Xml_attr attr); |
virtual void end(const Xml_string& tag); |
virtual void chars(const Xml_string& text); |
private: |
std::set<Xml_string> seenIDs; |
int level; |
std::set<Xml_string> m_seenIDs; |
int m_level; |
}; |
#endif |
/trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp |
---|
14,26 → 14,26 |
ScDLManager::ScDLManager(QObject *parent) |
: QObject(parent) |
{ |
dlID=0; |
thread=new ScDLThread(); |
connect(thread, SIGNAL(fileReceived(const QString &)), this, SLOT(dlReceived(const QString&))); |
connect(thread, SIGNAL(fileFailed(const QString &)), this, SLOT(dlFailed(const QString&))); |
connect(thread, SIGNAL(fileStarted(const QString &)), this, SLOT(dlStarted(const QString &))); |
m_dlID=0; |
m_thread=new ScDLThread(); |
connect(m_thread, SIGNAL(fileReceived(const QString &)), this, SLOT(dlReceived(const QString&))); |
connect(m_thread, SIGNAL(fileFailed(const QString &)), this, SLOT(dlFailed(const QString&))); |
connect(m_thread, SIGNAL(fileStarted(const QString &)), this, SLOT(dlStarted(const QString &))); |
//connect(thread, SIGNAL(finished()), this, SIGNAL(finished())); |
connect(thread, SIGNAL(finished()), this, SLOT(moveFinishedDownloads())); |
connect(m_thread, SIGNAL(finished()), this, SLOT(moveFinishedDownloads())); |
} |
ScDLManager::~ScDLManager() |
{ |
// Per Qt doc, deleting a running thread will probably result in a program crash. |
if (thread && !thread->isRunning()) |
delete thread; |
if (m_thread && !m_thread->isRunning()) |
delete m_thread; |
} |
void ScDLManager::addURL(const QUrl &url, bool overwrite, const QString& downloadLocation, const QString& destinationLocation, const QString& destinationName) |
{ |
DownloadData d; |
d.id=dlID++; |
d.id=m_dlID++; |
d.name=url.fileName(); |
d.url=url; |
d.downloadLocation=downloadLocation; |
40,15 → 40,15 |
d.destinationLocation=destinationLocation; |
d.destinationName=destinationName; |
d.state=DownloadData::New; |
fileList.append(d); |
m_fileList.append(d); |
thread->addURL(url, overwrite, downloadLocation, destinationLocation); |
m_thread->addURL(url, overwrite, downloadLocation, destinationLocation); |
} |
void ScDLManager::addURL(const QString &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation, const QString& destinationName) |
{ |
DownloadData d; |
d.id=dlID++; |
d.id=m_dlID++; |
d.name=QUrl(url).fileName(); |
d.url=url; |
d.downloadLocation=downloadLocation; |
55,9 → 55,9 |
d.destinationLocation=destinationLocation; |
d.destinationName=destinationName; |
d.state=DownloadData::New; |
fileList.append(d); |
m_fileList.append(d); |
thread->addURL(QUrl(url), overwrite, downloadLocation, destinationLocation); |
m_thread->addURL(QUrl(url), overwrite, downloadLocation, destinationLocation); |
} |
void ScDLManager::addURLs(const QStringList &urlList, bool overwrite, const QString &downloadLocation, const QString& destinationLocation) |
65,7 → 65,7 |
foreach(QString s, urlList) |
{ |
DownloadData d; |
d.id=dlID++; |
d.id=m_dlID++; |
d.name=QUrl(s).fileName(); |
d.url=s; |
d.downloadLocation=downloadLocation; |
72,21 → 72,21 |
d.destinationLocation=destinationLocation; |
d.destinationName=""; |
d.state=DownloadData::New; |
fileList.append(d); |
m_fileList.append(d); |
} |
thread->addURLs(urlList, overwrite, downloadLocation, destinationLocation); |
m_thread->addURLs(urlList, overwrite, downloadLocation, destinationLocation); |
} |
void ScDLManager::startDownloads() |
{ |
//qDebug()<<"Manager starting downloads..."; |
thread->startDownloads(); |
m_thread->startDownloads(); |
} |
void ScDLManager::dlStarted(const QString& filename) |
{ |
//qDebug()<<"File Started:"<<filename; |
QMutableListIterator<DownloadData> i(fileList); |
QMutableListIterator<DownloadData> i(m_fileList); |
while (i.hasNext()) |
{ |
i.next(); |
103,7 → 103,7 |
{ |
emit fileReceived(filename); |
//qDebug()<<"File Received:"<<filename; |
QMutableListIterator<DownloadData> i(fileList); |
QMutableListIterator<DownloadData> i(m_fileList); |
while (i.hasNext()) |
{ |
i.next(); |
120,7 → 120,7 |
{ |
emit fileFailed(filename); |
//qDebug()<<"File Failed:"<<filename; |
QMutableListIterator<DownloadData> i(fileList); |
QMutableListIterator<DownloadData> i(m_fileList); |
while (i.hasNext()) |
{ |
i.next(); |
135,7 → 135,7 |
void ScDLManager::moveFinishedDownloads() |
{ |
QMutableListIterator<DownloadData> i(fileList); |
QMutableListIterator<DownloadData> i(m_fileList); |
while (i.hasNext()) |
{ |
i.next(); |
/trunk/Scribus/scribus/downloadmanager/scdlmgr.h |
---|
42,9 → 42,9 |
void fileFailed(const QString& t); |
private: |
ScDLThread *thread; |
int dlID; |
QList <DownloadData> fileList; |
ScDLThread *m_thread; |
int m_dlID; |
QList <DownloadData> m_fileList; |
}; |
#endif |
/trunk/Scribus/scribus/downloadmanager/scdlthread.cpp |
---|
12,7 → 12,7 |
ScDLThread::ScDLThread(QObject *parent) : QThread(parent), |
downloadedCount(0), totalCount(0) |
m_downloadedCount(0), m_totalCount(0) |
{ |
connect(this, SIGNAL(runSignal()), this, SLOT(runSlot())); |
} |
34,8 → 34,8 |
QString l(QDir::cleanPath(location)); |
if (!l.endsWith("/")) |
l += "/"; |
downloadQueue.enqueue(qMakePair(url, l)); |
++totalCount; |
m_downloadQueue.enqueue(qMakePair(url, l)); |
++m_totalCount; |
} |
void ScDLThread::addURLs(const QStringList &urlList, bool overwrite, const QString& location, const QString& destinationLocation) |
50,14 → 50,14 |
QUrl url(u); |
if (!urlOK(u)) |
return; |
downloadQueue.enqueue(qMakePair(url, l)); |
++totalCount; |
m_downloadQueue.enqueue(qMakePair(url, l)); |
++m_totalCount; |
} |
} |
void ScDLThread::startDownloads() |
{ |
if (downloadQueue.isEmpty()) |
if (m_downloadQueue.isEmpty()) |
{ |
//qDebug()<<"No more downloads left"; |
emit finished(); |
95,14 → 95,14 |
void ScDLThread::startNextDownload() |
{ |
if (downloadQueue.isEmpty()) |
if (m_downloadQueue.isEmpty()) |
{ |
//qDebug()<<downloadedCount<<"/"<<totalCount<<"files downloaded successfully"; |
downloadedCount=totalCount=0; |
m_downloadedCount=m_totalCount=0; |
emit finished(); |
return; |
} |
QPair<QUrl, QString> urlPair=downloadQueue.dequeue(); |
QPair<QUrl, QString> urlPair=m_downloadQueue.dequeue(); |
QString filename = saveFileName(urlPair.first, urlPair.second, true); |
if (filename.isEmpty()) |
110,8 → 110,8 |
qDebug()<<"File name empty for url:"<<urlPair.first.toEncoded().constData(); |
return; |
} |
output.setFileName(filename); |
if (!output.open(QIODevice::WriteOnly)) |
m_output.setFileName(filename); |
if (!m_output.open(QIODevice::WriteOnly)) |
{ |
//qDebug()<<"Problem opening save file '"<<qPrintable(filename)<<"' for download '" |
// <<urlPair.first.toEncoded().constData()<<"': "<<qPrintable(output.errorString()); |
119,14 → 119,14 |
startNextDownload(); |
return; |
} |
emit fileStarted(output.fileName()); |
emit fileStarted(m_output.fileName()); |
QNetworkRequest request(urlPair.first); |
//QNetworkReply *nwr=manager.head(request); |
//qDebug()<<nwr->url()<<nwr->rawHeaderList(); |
//connect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); |
currentDownload = manager.get(request); |
connect(currentDownload, SIGNAL(finished()), this, SLOT(downloadFinished())); |
connect(currentDownload, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); |
m_currentDownload = m_manager.get(request); |
connect(m_currentDownload, SIGNAL(finished()), this, SLOT(downloadFinished())); |
connect(m_currentDownload, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); |
//qDebug()<<"Downloading:"<<urlPair.first.toEncoded().constData(); |
} |
133,8 → 133,8 |
void ScDLThread::downloadFinished() |
{ |
output.close(); |
if (currentDownload->error()) |
m_output.close(); |
if (m_currentDownload->error()) |
{ |
/* |
if(currentDownload->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 301 || currentDownload->rawHeaderList().contains("Location")) |
147,18 → 147,18 |
QUrl redirectUrl = currentDownload->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); |
qDebug()<<redirectUrl; |
*/ |
qDebug()<<"Failed: "<<qPrintable(currentDownload->errorString()); |
emit fileFailed(output.fileName()); |
if (output.exists()) |
output.remove(); |
qDebug()<<"Failed: "<<qPrintable(m_currentDownload->errorString()); |
emit fileFailed(m_output.fileName()); |
if (m_output.exists()) |
m_output.remove(); |
} |
else |
{ |
//qDebug()<<"Saving file:"<<qPrintable(output.fileName()); |
++downloadedCount; |
emit fileReceived(output.fileName()); |
++m_downloadedCount; |
emit fileReceived(m_output.fileName()); |
} |
currentDownload->deleteLater(); |
m_currentDownload->deleteLater(); |
startNextDownload(); |
} |
194,7 → 194,7 |
void ScDLThread::downloadReadyRead() |
{ |
output.write(currentDownload->readAll()); |
m_output.write(m_currentDownload->readAll()); |
} |
void ScDLThread::runSlot() |
/trunk/Scribus/scribus/downloadmanager/scdlthread.h |
---|
40,11 → 40,11 |
private: |
bool urlOK(QUrl url); |
QStringList m_urlList; |
QFile output; |
QQueue<QPair<QUrl, QString> > downloadQueue; |
int downloadedCount; |
int totalCount; |
QNetworkReply *currentDownload; |
QNetworkAccessManager manager; |
QFile m_output; |
QQueue<QPair<QUrl, QString> > m_downloadQueue; |
int m_downloadedCount; |
int m_totalCount; |
QNetworkReply *m_currentDownload; |
QNetworkAccessManager m_manager; |
}; |
#endif |
/trunk/Scribus/scribus/fonts/cff.cpp |
---|
546,35 → 546,35 |
} |
CFF::CFF() : bytes(), offsetSize(4) |
CFF::CFF() : m_bytes(), m_offsetSize(4) |
{ |
for (int i = 0; i <= sid_last_std; ++i) |
{ |
strings.append(stdStrings[i]); |
sids[stdStrings[i]] = i; |
m_strings.append(stdStrings[i]); |
m_sids[stdStrings[i]] = i; |
} |
} |
CFF::CFF(const QByteArray& cff) : bytes(cff) |
CFF::CFF(const QByteArray& cff) : m_bytes(cff) |
{ |
// read header |
offsetSize = cff[cff_offSize]; |
m_offsetSize = cff[cff_offSize]; |
uint pos = cff[cff_hdrSize]; |
qDebug() << "cff header" << offsetSize << "starts" << pos; |
qDebug() << "cff header" << m_offsetSize << "starts" << pos; |
// read names |
names = readIndex(pos); |
m_names = readIndex(pos); |
// read top dicts |
QList<QByteArray> topDicts = readIndex(pos); |
for (int i = 0; i < names.length(); ++i) |
for (int i = 0; i < m_names.length(); ++i) |
{ |
QByteArray fontName = names[i]; |
QByteArray fontName = m_names[i]; |
qDebug() << i << fontName; |
if (fontName.length() > 0 && fontName[0] != char(0)) |
{ |
fontTopDicts[fontName] = getDict(topDicts[i]); |
uint privLength = fontTopDicts[fontName][18].array[0].toCardinal(); |
uint privOffset = fontTopDicts[fontName][18].array[1].toCardinal(); |
m_fontTopDicts[fontName] = getDict(topDicts[i]); |
uint privLength = m_fontTopDicts[fontName][18].array[0].toCardinal(); |
uint privOffset = m_fontTopDicts[fontName][18].array[1].toCardinal(); |
getDict(readSegment(privOffset, privLength)); |
} |
} |
581,29 → 581,29 |
// read strings |
for (int i = 0; i <= sid_last_std; ++i) |
{ |
strings.append(stdStrings[i]); |
m_strings.append(stdStrings[i]); |
} |
strings.append(readIndex(pos)); |
for (int i = 0; i < strings.length(); ++i) |
m_strings.append(readIndex(pos)); |
for (int i = 0; i < m_strings.length(); ++i) |
{ |
// if ( i > sid_last_std) |
// qDebug() << i << strings[i]; |
sids[strings[i]] = i; |
m_sids[m_strings[i]] = i; |
} |
// read global subroutines |
globalSubr = readIndex(pos); |
m_globalSubr = readIndex(pos); |
} |
QByteArray CFF::readSegment(uint pos, uint size) const |
{ |
return QByteArray::fromRawData(bytes.data() + pos, size); |
return QByteArray::fromRawData(m_bytes.data() + pos, size); |
} |
uint CFF::readCard(uint pos) const |
{ |
return static_cast<uchar>(bytes[pos]) << 8 | static_cast<uchar>(bytes[pos+1]); |
return static_cast<uchar>(m_bytes[pos]) << 8 | static_cast<uchar>(m_bytes[pos+1]); |
} |
818,7 → 818,7 |
if (N == 0) |
return result; |
uint offSize = bytes[pos++]; |
uint offSize = m_bytes[pos++]; |
uint dataStart = pos + offSize * (N+1) - 1; |
qDebug() << "size" << N << "offsetsize" << offSize << "dataStart" << dataStart; |
uint start = 0; |
825,7 → 825,7 |
uint end = 0; |
for (uint c = 0; c < offSize; ++c) |
{ |
start = start << 8 | (uchar) bytes[pos++]; |
start = start << 8 | (uchar) m_bytes[pos++]; |
} |
start += dataStart; |
for (uint i = 0; i < N; ++i) |
833,7 → 833,7 |
end = 0; |
for (uint c = 0; c < offSize; ++c) |
{ |
end = end << 8 | (uchar) bytes[pos++]; |
end = end << 8 | (uchar) m_bytes[pos++]; |
} |
end += dataStart; |
result.append(readSegment(start, end-start)); |
851,8 → 851,8 |
for(int i = 0; i < 256; ++i) |
result.append(0); |
uchar format = bytes[pos++]; |
uchar N = bytes[pos++]; |
uchar format = m_bytes[pos++]; |
uchar N = m_bytes[pos++]; |
int gid; |
uchar code; |
switch (format) |
861,7 → 861,7 |
case 0x80: |
for (gid = 1; gid <= N; ++gid) |
{ |
code = bytes[pos++]; |
code = m_bytes[pos++]; |
if (result[code] == 0) |
{ |
result[code] = gid; |
873,8 → 873,8 |
gid = 1; |
for (int r = 0; r < N; ++r) |
{ |
uchar first = bytes[pos++]; |
uchar nLeft = bytes[pos++]; |
uchar first = m_bytes[pos++]; |
uchar nLeft = m_bytes[pos++]; |
for (code = first; code <= first + nLeft; ++code) |
{ |
if (result[code] == 0) |
888,10 → 888,10 |
} |
if (format >= 0x80) |
{ |
uchar nSupplements = bytes[pos++]; |
uchar nSupplements = m_bytes[pos++]; |
for (int i = 0; i < nSupplements; ++i) |
{ |
code = bytes[pos++]; |
code = m_bytes[pos++]; |
gid = readCard(pos); |
pos += 2; |
result[code] = gid; |
906,7 → 906,7 |
QList<sid_type> result; |
result.append(0); // sid for .notdef |
uchar format = bytes[pos++]; |
uchar format = m_bytes[pos++]; |
sid_type first; |
uchar nLeft1; |
926,7 → 926,7 |
{ |
first = readCard(pos); |
pos += 2; |
nLeft1 = bytes[pos++]; |
nLeft1 = m_bytes[pos++]; |
for (sid_type sid = first; sid <= first + nLeft1; ++sid) |
{ |
result.append(sid); |
993,9 → 993,9 |
void CFF::dump() |
{ |
qDebug() << "CFF" << fontTopDicts.count() << "fonts, size =" << bytes.size() << "offset size=" << offsetSize; |
qDebug() << "CFF" << m_fontTopDicts.count() << "fonts, size =" << m_bytes.size() << "offset size=" << m_offsetSize; |
QMap<QByteArray,QMap<operator_type,CFF_Variant> >::Iterator it; |
for (it = fontTopDicts.begin(); it != fontTopDicts.end(); ++it) |
for (it = m_fontTopDicts.begin(); it != m_fontTopDicts.end(); ++it) |
{ |
qDebug() << "Font" << it.key() << ":"; |
QMap<operator_type, CFF_Variant>::Iterator it2; |
1064,11 → 1064,11 |
void CFF::dump(QDataStream& out) const |
{ |
write(out, "<CFF version='1.0' offsetSize='" + num(offsetSize) + "' >\n"); |
for (int f = 0; f < names.length(); ++f) |
write(out, "<CFF version='1.0' offsetSize='" + num(m_offsetSize) + "' >\n"); |
for (int f = 0; f < m_names.length(); ++f) |
{ |
QByteArray font = names[f]; |
QMap<operator_type, CFF_Variant> topDict = fontTopDicts[font]; |
QByteArray font = m_names[f]; |
QMap<operator_type, CFF_Variant> topDict = m_fontTopDicts[font]; |
write(out, " <Font name='" + font + "' >\n"); |
write(out, " <TopDict>"); |
dumpDict(*this, topDict, out, " "); |
1128,10 → 1128,10 |
write(out, " </Font>\n"); |
} |
write(out, " <Strings>\n"); |
dumpStrings(strings, out, " "); |
dumpStrings(m_strings, out, " "); |
write(out, " </Strings>\n"); |
write(out, " <GlobalSubrs>\n"); |
dumpData(globalSubr, out, " "); |
dumpData(m_globalSubr, out, " "); |
write(out, " </GlobalSubrs>\n"); |
write(out, "</CFF>\n"); |
} |
1261,8 → 1261,8 |
uint CFF::writeSegment(const QByteArray& data) |
{ |
uint result = bytes.length(); |
bytes.append(data); |
uint result = m_bytes.length(); |
m_bytes.append(data); |
return result; |
} |
1270,16 → 1270,16 |
sid_type CFF::createSid(const QByteArray& str) |
{ |
sid_type result; |
if (!sids.contains(str)) |
if (!m_sids.contains(str)) |
{ |
result = strings.length(); |
strings.append(str); |
sids[str] = result; |
result = m_strings.length(); |
m_strings.append(str); |
m_sids[str] = result; |
qDebug() << "new SID" << result << "for" << str; |
} |
else |
{ |
result = sids[str]; |
result = m_sids[str]; |
} |
return result; |
} |
1290,32 → 1290,32 |
QList<QByteArray> oldStrings, |
QHash<operator_type, uint>& patchAddresses) |
{ |
offsetSize = 4; |
names.append(name); |
fontTopDicts[name] = dict; |
bytes.append((char) 1); |
bytes.append((char) 0); // format 1.0 |
bytes.append((char) 4); // header length 4 |
bytes.append((char) 4); // offsetSize 4 |
m_offsetSize = 4; |
m_names.append(name); |
m_fontTopDicts[name] = dict; |
m_bytes.append((char) 1); |
m_bytes.append((char) 0); // format 1.0 |
m_bytes.append((char) 4); // header length 4 |
m_bytes.append((char) 4); // offsetSize 4 |
// write Name index |
bytes.append(encodeBE(2,1)); // count |
m_bytes.append(encodeBE(2,1)); // count |
assert (name.length() < 255); |
bytes.append(encodeBE(1, 1)); // offSize |
bytes.append(encodeBE(1, 1)); // offset 1 |
bytes.append(encodeBE(1, 1 + name.length())); // offset 2 |
bytes.append(name); |
m_bytes.append(encodeBE(1, 1)); // offSize |
m_bytes.append(encodeBE(1, 1)); // offset 1 |
m_bytes.append(encodeBE(1, 1 + name.length())); // offset 2 |
m_bytes.append(name); |
// write TopDict index |
QByteArray topDict = makeDict(dict, oldStrings, patchAddresses); |
int offSize = requiredOffsetSize(topDict.length()); |
bytes.append(encodeBE(2, 1)); // count |
bytes.append(encodeBE(1, offSize)); // offSize |
bytes.append(encodeBE(offSize, 1)); // offset 1 |
bytes.append(encodeBE(offSize, 1 + topDict.length())); // offset 2 |
uint start = bytes.size(); |
bytes.append(topDict); |
m_bytes.append(encodeBE(2, 1)); // count |
m_bytes.append(encodeBE(1, offSize)); // offSize |
m_bytes.append(encodeBE(offSize, 1)); // offset 1 |
m_bytes.append(encodeBE(offSize, 1 + topDict.length())); // offset 2 |
uint start = m_bytes.size(); |
m_bytes.append(topDict); |
return start; |
} |
1437,18 → 1437,18 |
case cff_dict_Subrs: |
case cff_dict_FDArray: |
case cff_dict_FDSelect: |
assert (bytes[pos] == (char) cff_dict_Card32); |
assert (m_bytes[pos] == (char) cff_dict_Card32); |
++pos; |
bytes.replace(pos, 4, encodeBE(4, offset)); |
m_bytes.replace(pos, 4, encodeBE(4, offset)); |
qDebug() << "patch" << cff_operator(op) << "offset @" << pos << offset; |
break; |
case cff_dict_Private: |
c = bytes[pos]; |
c = m_bytes[pos]; |
if (c == cff_dict_Card16) |
{ |
if (length > 0) |
{ |
bytes.replace(pos+1, 2, encodeBE(2, length)); |
m_bytes.replace(pos+1, 2, encodeBE(2, length)); |
qDebug() << "patch priv short length @" << (pos+1) << length; |
} |
pos += 3; |
1457,7 → 1457,7 |
{ |
if (length > 0) |
{ |
bytes.replace(pos+1, 4, encodeBE(4, length)); |
m_bytes.replace(pos+1, 4, encodeBE(4, length)); |
qDebug() << "patch priv length @" << (pos+1) << length; |
} |
pos += 5; |
1474,9 → 1474,9 |
{ |
/* error */ |
} |
assert (bytes[pos] == (char) cff_dict_Card32); |
assert (m_bytes[pos] == (char) cff_dict_Card32); |
++pos; |
bytes.replace(pos, 4, encodeBE(4, offset)); |
m_bytes.replace(pos, 4, encodeBE(4, offset)); |
qDebug() << "patch priv offset @" << pos << offset; |
break; |
default: |
1586,8 → 1586,8 |
uint pos; |
// get top dict |
QByteArray fontName = names[faceIndex]; |
QMap<operator_type, CFF_Variant> topDict = fontTopDicts[fontName]; |
QByteArray fontName = m_names[faceIndex]; |
QMap<operator_type, CFF_Variant> topDict = m_fontTopDicts[fontName]; |
// get charstrings |
QList<QByteArray> charStrings; |
1638,7 → 1638,7 |
// now create new font |
CFF result; |
result.globalSubr = globalSubr; // no changes |
result.m_globalSubr = m_globalSubr; // no changes |
// subset |
if (cids.length() > 0) |
1660,9 → 1660,9 |
{ |
sid_type gid = cids[i]; |
sid_type sid = charset[gid]; |
if (sid < strings.length()) |
if (sid < m_strings.length()) |
{ |
sid = result.createSid(strings[sid]); |
sid = result.createSid(m_strings[sid]); |
} |
newCharset.append(sid); |
newCharStrings.append(charStrings[gid]); |
1677,9 → 1677,9 |
for (int i = 0; i < charset.length(); ++i) |
{ |
sid_type cid = charset[i]; |
if (cid < strings.length()) |
if (cid < m_strings.length()) |
{ |
cid = result.createSid(strings[cid]); |
cid = result.createSid(m_strings[cid]); |
} |
charset[i] = cid; |
} |
1687,19 → 1687,19 |
// create new private dict |
QHash<operator_type, uint> privatePatches; |
QByteArray privateBytes = result.makeDict(privateDict, strings, privatePatches); |
QByteArray privateBytes = result.makeDict(privateDict, m_strings, privatePatches); |
// write new header, name and topdict, remember offset positions for patching |
QHash<operator_type, uint> patchPositions; |
uint topDictOffset = result.writeTopDict(fontName, topDict, strings, patchPositions); |
uint topDictOffset = result.writeTopDict(fontName, topDict, m_strings, patchPositions); |
// write strings |
// makeDict() needs to be called before this in order to create SIDs for used strings |
result.writeSegment(makeIndex(result.strings.mid(sid_last_std + 1))); |
result.writeSegment(makeIndex(result.m_strings.mid(sid_last_std + 1))); |
// write global subr (required but maybe empty) |
result.writeSegment(makeIndex(globalSubr)); |
result.writeSegment(makeIndex(m_globalSubr)); |
// write encoding |
uint encodingOffset = encoding.size() > 1? result.writeSegment(makeEncoding(encoding)) : encoding.size() == 1? encoding[0] : 0; |
/trunk/Scribus/scribus/fonts/cff.h |
---|
184,37 → 184,37 |
QByteArray dump(const CFF_Variant& var) const; |
const QByteArray& data() const { |
return bytes; |
return m_bytes; |
} |
QList<QByteArray> fontNames() const { |
return fontTopDicts.keys(); |
return m_fontTopDicts.keys(); |
} |
uint offset(uint unscaled) |
{ |
return unscaled * offsetSize; |
return unscaled * m_offsetSize; |
} |
QByteArray string(sid_type sid) const { |
return sid < strings.length()? strings[sid] : ""; |
return sid < m_strings.length()? m_strings[sid] : ""; |
} |
sid_type sid(const QByteArray str) const { |
return sids.contains(str)? sids[str] : sid_max1; |
return m_sids.contains(str)? m_sids[str] : sid_max1; |
} |
void dump(QDataStream& out) const; |
private: |
QByteArray bytes; |
uint offsetSize; |
QByteArray m_bytes; |
uint m_offsetSize; |
QList<QByteArray> names; |
QMap<QByteArray, QMap<uint,CFF_Variant> > fontTopDicts; |
QList<QByteArray> strings; |
QHash<QByteArray,uint> sids; |
QList<QByteArray> globalSubr; |
QList<QByteArray> m_names; |
QMap<QByteArray, QMap<uint,CFF_Variant> > m_fontTopDicts; |
QList<QByteArray> m_strings; |
QHash<QByteArray,uint> m_sids; |
QList<QByteArray> m_globalSubr; |
sid_type createSid(const QByteArray& str); |
/trunk/Scribus/scribus/fonts/ftface.cpp |
---|
19,7 → 19,7 |
#include "fonts/scfontmetrics.h" |
// static: |
FT_Library FtFace::library = NULL; |
FT_Library FtFace::m_library = NULL; |
/***** |
ScFace lifecycle: unchecked -> loaded -> glyphs checked |
50,8 → 50,8 |
psName = psname; |
fontFile = path; |
faceIndex = face; |
if (!library) { |
if (FT_Init_FreeType( &library )) |
if (!m_library) { |
if (FT_Init_FreeType( &m_library )) |
sDebug(QObject::tr("Freetype2 library not available")); |
} |
} |
64,7 → 64,7 |
FT_Face FtFace::ftFace() const { |
if (!m_face) { |
if (FT_New_Face( library, QFile::encodeName(fontFile), faceIndex, & m_face )) { |
if (FT_New_Face( m_library, QFile::encodeName(fontFile), faceIndex, & m_face )) { |
status = ScFace::BROKEN; |
m_face = NULL; |
sDebug(QObject::tr("Font %1(%2) is broken").arg(fontFile).arg(faceIndex)); |
81,7 → 81,7 |
ScFaceData::load(); |
if (!m_face) { |
if (FT_New_Face( library, QFile::encodeName(fontFile), faceIndex, & m_face )) { |
if (FT_New_Face( m_library, QFile::encodeName(fontFile), faceIndex, & m_face )) { |
status = ScFace::BROKEN; |
m_face = NULL; |
sDebug(QObject::tr("Font %1(%2) is broken").arg(fontFile).arg(faceIndex)); |
/trunk/Scribus/scribus/fonts/ftface.h |
---|
97,7 → 97,7 |
protected: |
mutable FT_Face m_face; |
static FT_Library library; |
static FT_Library m_library; |
mutable QString m_pdfAscent; |
mutable QString m_pdfCapHeight; |
/trunk/Scribus/scribus/fonts/scface.cpp |
---|
26,7 → 26,7 |
isFixedPitch(false), |
hasGlyphNames(false), |
maxGlyph(0), |
cachedStatus(ScFace::UNKNOWN) |
m_cachedStatus(ScFace::UNKNOWN) |
{ |
} |
134,30 → 134,30 |
unicode emulate: spaces, hyphen, ligatures?, diacritics? |
*****/ |
ScFace::ScFace() : m(new ScFaceData()) |
ScFace::ScFace() : m_m(new ScFaceData()) |
{ |
m->refs = 1; |
m->usage = 0; |
m_m->refs = 1; |
m_m->usage = 0; |
} |
ScFace::ScFace(ScFaceData* data) : m(data) |
ScFace::ScFace(ScFaceData* data) : m_m(data) |
{ |
++(m->refs); |
m->cachedStatus = ScFace::UNKNOWN; |
++(m_m->refs); |
m_m->m_cachedStatus = ScFace::UNKNOWN; |
} |
ScFace::ScFace(const ScFace& other) : m(other.m), replacedName(other.replacedName), replacedInDoc(other.replacedInDoc) |
ScFace::ScFace(const ScFace& other) : m_m(other.m_m), m_replacedName(other.m_replacedName), m_replacedInDoc(other.m_replacedInDoc) |
{ |
++(m->refs); |
++(m_m->refs); |
} |
ScFace::~ScFace() |
{ |
if ( m && --(m->refs) == 0 ) { |
m->unload(); |
delete m; |
m = 0; |
if ( m_m && --(m_m->refs) == 0 ) { |
m_m->unload(); |
delete m_m; |
m_m = 0; |
} |
} |
164,17 → 164,17 |
ScFace& ScFace::operator=(const ScFace& other) |
{ |
if (m != other.m) |
if (m_m != other.m_m) |
{ |
if (other.m) |
++(other.m->refs); |
if ( m && --(m->refs) == 0 ) { |
m->unload(); |
delete m; |
if (other.m_m) |
++(other.m_m->refs); |
if ( m_m && --(m_m->refs) == 0 ) { |
m_m->unload(); |
delete m_m; |
} |
m = other.m; |
m_m = other.m_m; |
} |
replacedName = other.replacedName; |
m_replacedName = other.m_replacedName; |
return *this; |
} |
184,14 → 184,14 |
*/ |
bool ScFace::operator==(const ScFace& other) const |
{ |
return replacedName == other.replacedName && |
return m_replacedName == other.m_replacedName && |
( (isNone() && other.isNone() ) |
|| (m == other.m) |
|| (m->family == other.m->family |
&& m->style == other.m->style |
&& m->variant == other.m->variant |
&& m->fontFile == other.m->fontFile |
&& m-> faceIndex == other.m->faceIndex) ); |
|| (m_m == other.m_m) |
|| (m_m->family == other.m_m->family |
&& m_m->style == other.m_m->style |
&& m_m->variant == other.m_m->variant |
&& m_m->fontFile == other.m_m->fontFile |
&& m_m-> faceIndex == other.m_m->faceIndex) ); |
} |
203,146 → 203,146 |
bool ScFace::isSymbolic() const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->isSymbolic(); |
return m_m->isSymbolic(); |
} |
QString ScFace::pdfAscentAsString() const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->pdfAscentAsString(); |
return m_m->pdfAscentAsString(); |
} |
QString ScFace::pdfDescentAsString() const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->pdfDescentAsString(); |
return m_m->pdfDescentAsString(); |
} |
QString ScFace::pdfCapHeightAsString() const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->pdfCapHeightAsString(); |
return m_m->pdfCapHeightAsString(); |
} |
QString ScFace::pdfFontBBoxAsString() const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->pdfFontBBoxAsString(); |
return m_m->pdfFontBBoxAsString(); |
} |
QString ScFace::italicAngleAsString() const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->italicAngleAsString(); |
return m_m->italicAngleAsString(); |
} |
qreal ScFace::ascent(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->ascent(sz); |
return m_m->ascent(sz); |
} |
qreal ScFace::descent(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->descent(sz); |
return m_m->descent(sz); |
} |
qreal ScFace::xHeight(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->xHeight(sz); |
return m_m->xHeight(sz); |
} |
qreal ScFace::capHeight(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->capHeight(sz); |
return m_m->capHeight(sz); |
} |
qreal ScFace::height(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->height(sz); |
return m_m->height(sz); |
} |
qreal ScFace::strikeoutPos(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->strikeoutPos(sz); |
return m_m->strikeoutPos(sz); |
} |
qreal ScFace::underlinePos(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->underlinePos(sz); |
return m_m->underlinePos(sz); |
} |
qreal ScFace::strokeWidth(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->strokeWidth(sz); |
return m_m->strokeWidth(sz); |
} |
qreal ScFace::maxAdvanceWidth(qreal sz) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->maxAdvanceWidth(sz); |
return m_m->maxAdvanceWidth(sz); |
} |
void ScFace::increaseUsage() const |
{ |
m->usage++; |
m_m->usage++; |
} |
void ScFace::decreaseUsage() const |
{ |
if (m->usage == 1) |
if (m_m->usage == 1) |
unload(); |
m->usage--; |
m_m->usage--; |
} |
void ScFace::unload() const |
{ |
if (m->status >= ScFace::LOADED && usable()) { |
m->unload(); |
if (m_m->status >= ScFace::LOADED && usable()) { |
m_m->unload(); |
} |
// clear caches |
m->m_glyphWidth.clear(); |
m->m_glyphOutline.clear(); |
m_m->m_glyphWidth.clear(); |
m_m->m_glyphOutline.clear(); |
//m->m_cMap.clear(); |
m->status = ScFace::UNKNOWN; |
m_m->status = ScFace::UNKNOWN; |
} |
354,9 → 354,9 |
|| ch == SpecialChars::ZWSPACE || ch == SpecialChars::ZWNBSPACE || ch==SpecialChars::OBJECT) |
return CONTROL_GLYPHS + ch.unicode(); |
else if (ch == SpecialChars::NBSPACE) |
return m->char2CMap(QChar(' ')); |
return m_m->char2CMap(QChar(' ')); |
else if(ch == SpecialChars::NBHYPHEN) |
return m->char2CMap(QChar('-')); |
return m_m->char2CMap(QChar('-')); |
else |
return 0; |
} |
364,14 → 364,14 |
ScFace::gid_type ScFace::char2CMap(QChar ch) const |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
if (ch == SpecialChars::SHYPHEN) |
return emulateGlyph(ch); |
gid_type gl = m->char2CMap(ch); |
gid_type gl = m_m->char2CMap(ch); |
if (gl == 0) |
return emulateGlyph(ch); |
389,8 → 389,8 |
if (gl >= CONTROL_GLYPHS) // those are always empty |
return true; |
else if (gl != 0) { |
m->loadGlyph(gl); |
return ! m->m_glyphOutline[gl].broken; |
m_m->loadGlyph(gl); |
return ! m_m->m_glyphOutline[gl].broken; |
} |
else { |
return false; |
419,43 → 419,43 |
bool ScFace::EmbedFont(QByteArray &str) |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->EmbedFont(str); |
return m_m->EmbedFont(str); |
} |
bool ScFace::glyphNames(FaceEncoding& gList) |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
return m->glyphNames(gList); |
return m_m->glyphNames(gList); |
} |
void ScFace::RawData(QByteArray & bb) |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
m->RawData(bb); |
m_m->RawData(bb); |
} |
void ScFace::checkAllGlyphs() |
{ |
if (m->status == ScFace::UNKNOWN) { |
m->load(); |
if (m_m->status == ScFace::UNKNOWN) { |
m_m->load(); |
} |
if (m->status != ScFace::LOADED) { |
if (m_m->status != ScFace::LOADED) { |
return; |
} |
for (gid_type gl=0; gl <= m->maxGlyph; ++gl) { |
if (! m->m_glyphWidth.contains(gl)) { |
m->loadGlyph(gl); |
m->m_glyphWidth.remove(gl); |
m->m_glyphOutline.remove(gl); |
for (gid_type gl=0; gl <= m_m->maxGlyph; ++gl) { |
if (! m_m->m_glyphWidth.contains(gl)) { |
m_m->loadGlyph(gl); |
m_m->m_glyphWidth.remove(gl); |
m_m->m_glyphOutline.remove(gl); |
} |
} |
} |
/trunk/Scribus/scribus/fonts/scface.h |
---|
134,7 → 134,7 |
protected: |
friend class ScFace; |
Status cachedStatus; |
Status m_cachedStatus; |
// caches |
mutable QHash<gid_type, qreal> m_glyphWidth; |
149,7 → 149,7 |
m_glyphOutline.clear(); |
//m_cMap.clear(); |
status = qMax(cachedStatus, ScFace::LOADED); |
status = qMax(m_cachedStatus, ScFace::LOADED); |
} |
virtual void unload() const |
206,7 → 206,7 |
static const ScFace& none(); |
/// test for null object |
bool isNone() const { return m->status == NULLFACE; } |
bool isNone() const { return m_m->status == NULLFACE; } |
/// test if font is a symbolic font |
bool isSymbolic() const; |
233,93 → 233,93 |
void unload() const; |
/// the name Scribus uses for this font |
QString scName() const { return replacedName.isEmpty() ? m->scName : replacedName; } |
QString scName() const { return m_replacedName.isEmpty() ? m_m->scName : m_replacedName; } |
/// the name of the font which was used for replacement |
QString replacementName() const { return m->scName; } |
QString replacementName() const { return m_m->scName; } |
/// the name of the font which was used for replacement |
QString replacementForDoc() const { return replacedInDoc; } |
QString replacementForDoc() const { return m_replacedInDoc; } |
/// check if this is a replacement font |
bool isReplacement() const { return !replacedName.isEmpty(); } |
bool isReplacement() const { return !m_replacedName.isEmpty(); } |
/// makes a repalcement font for font "name" using this fonts data |
ScFace mkReplacementFor(QString name, QString doc) { |
ScFace result(m); |
result.replacedName = name; |
result.replacedInDoc = doc; |
ScFace result(m_m); |
result.m_replacedName = name; |
result.m_replacedInDoc = doc; |
return result; |
} |
void chReplacementTo(ScFace& other, QString doc) { |
QString oldName = replacedName; |
QString oldName = m_replacedName; |
(*this) = other; |
replacedName = oldName; |
replacedInDoc = doc; |
m_replacedName = oldName; |
m_replacedInDoc = doc; |
} |
/// the name PostScript uses for this font |
QString psName() const { return m->psName; } |
QString psName() const { return m_m->psName; } |
/// the physical location of the fontfile |
QString fontPath() const { return m->faceIndex >= 0 ? QString("%1(%2)").arg(m->fontFile).arg(m->faceIndex+1) : m->fontFile; } |
QString fontPath() const { return m_m->faceIndex >= 0 ? QString("%1(%2)").arg(m_m->fontFile).arg(m_m->faceIndex+1) : m_m->fontFile; } |
/// the file path of the fontfile |
QString fontFilePath() const { return m->fontFile; } |
QString fontFilePath() const { return m_m->fontFile; } |
/// if the fontfile contains more than one face, the index, else -1 |
int faceIndex() const { return m->faceIndex; } |
int faceIndex() const { return m_m->faceIndex; } |
/// path name of the document this face is local to |
QString localForDocument() const { return m->forDocument; } |
QString localForDocument() const { return m_m->forDocument; } |
/// font type, eg. Type1 or TTF |
FontType type() const { return m->typeCode; } |
FontType type() const { return m_m->typeCode; } |
/// font format, which might be a little more complicated |
FontFormat format()const { return m->formatCode; } |
FontFormat format()const { return m_m->formatCode; } |
/// test if this face can be used in documents |
bool usable() const { return m->usable && !isNone(); } |
bool usable() const { return m_m->usable && !isNone(); } |
/// test if this face should be outlined in documents |
bool outline() const { return usable() && m->outline; } |
bool outline() const { return usable() && m_m->outline; } |
/// test if this face can be embedded in PS/PDF |
bool embedPs() const { return m->embedPs && m->status < BROKENGLYPHS; } |
bool embedPs() const { return m_m->embedPs && m_m->status < BROKENGLYPHS; } |
/// test if this face can be embedded as outlines in PS/PDF |
bool subset() const { return m->subset && m->status < BROKEN; } |
bool subset() const { return m_m->subset && m_m->status < BROKEN; } |
void usable(bool flag) { m->usable = flag; } |
void embedPs(bool flag) { m->embedPs = flag; } |
void subset(bool flag) { m->subset = flag; } |
void outline(bool flag) { m->outline = flag; } |
void usable(bool flag) { m_m->usable = flag; } |
void embedPs(bool flag) { m_m->embedPs = flag; } |
void subset(bool flag) { m_m->subset = flag; } |
void outline(bool flag) { m_m->outline = flag; } |
/// deprecated? tells if the face has PS names |
bool hasNames() const { return m->hasNames(); } |
bool hasNames() const { return m_m->hasNames(); } |
/// tells if this font is an outline font |
bool isStroked() const { return m->isStroked; } |
bool isStroked() const { return m_m->isStroked; } |
/// tells if this font is a fixed pitch font |
bool isFixedPitch()const { return m->isFixedPitch; } |
bool isFixedPitch()const { return m_m->isFixedPitch; } |
/// tells if this is an OTF/CFF font |
bool isOTF() const { return m->typeCode == OTF; } |
bool isOTF() const { return m_m->typeCode == OTF; } |
/// returns the highest glyph index in this face |
gid_type maxGlyph() const { return m->maxGlyph; } |
gid_type maxGlyph() const { return m_m->maxGlyph; } |
/// returns the font family as seen by Scribus |
QString family() const { return m->family; } |
QString family() const { return m_m->family; } |
/// returns the font style as seen by Scribus (eg. bold, Italic) |
QString style() const { return m->style; } |
QString style() const { return m_m->style; } |
/// returns an additional discriminating String for this face |
QString variant() const { return m->variant; } |
QString variant() const { return m_m->variant; } |
// font metrics |
QString pdfAscentAsString() const; |
347,23 → 347,23 |
QString fontBBox(qreal sz=1.0) const { return fontDictionary(sz)["/FontBBox"]; } |
/// returns a map of values used for font dictionaries in PS/PDF |
QMap<QString,QString> fontDictionary(qreal sz=1.0) const { return m->fontDictionary(sz); } |
QMap<QString,QString> fontDictionary(qreal sz=1.0) const { return m_m->fontDictionary(sz); } |
// glyph interface |
/// returns the glyphs normal advance width at size 'sz' |
qreal glyphWidth(gid_type gl, qreal sz=1.0) const { return m->glyphWidth(gl, sz); } |
qreal glyphWidth(gid_type gl, qreal sz=1.0) const { return m_m->glyphWidth(gl, sz); } |
/// returns the glyph kerning between 'gl1' and 'gl2' at size 'sz' |
qreal glyphKerning(gid_type gl1, gid_type gl2, qreal sz=1.0) const { return qMax(gl1,gl2) < CONTROL_GLYPHS ? m->glyphKerning(gl1, gl2, sz) : 0; } |
qreal glyphKerning(gid_type gl1, gid_type gl2, qreal sz=1.0) const { return qMax(gl1,gl2) < CONTROL_GLYPHS ? m_m->glyphKerning(gl1, gl2, sz) : 0; } |
/// returns the glyphs bounding box at size 'sz', ie. the area where this glyph will produce marks |
GlyphMetrics glyphBBox(gid_type gl, qreal sz=1.0) const { return m->glyphBBox(gl, sz); } |
GlyphMetrics glyphBBox(gid_type gl, qreal sz=1.0) const { return m_m->glyphBBox(gl, sz); } |
/// returns the glyph's outline as a cubic Bezier path |
FPointArray glyphOutline(gid_type gl, qreal sz=1.0) const { return m->glyphOutline(gl, sz); } |
FPointArray glyphOutline(gid_type gl, qreal sz=1.0) const { return m_m->glyphOutline(gl, sz); } |
/// returns the glyph's origin FIXME: what's that exactly? |
FPoint glyphOrigin(gid_type gl, qreal sz=1.0) const { return m->glyphOrigin(gl, sz); } |
FPoint glyphOrigin(gid_type gl, qreal sz=1.0) const { return m_m->glyphOrigin(gl, sz); } |
// char interface |
393,9 → 393,9 |
friend class SCFonts; |
ScFace(ScFaceData* md); |
ScFaceData* m; |
QString replacedName; |
QString replacedInDoc; |
ScFaceData* m_m; |
QString m_replacedName; |
QString m_replacedInDoc; |
void initFaceData(); |
void checkAllGlyphs(); |
/trunk/Scribus/scribus/fonts/scface_ttf.cpp |
---|
25,13 → 25,13 |
: FtFace ( fam, sty, alt, scname, psname, path, face ) |
{ |
formatCode = ScFace::SFNT; |
kernFeature = 0; |
m_kernFeature = 0; |
} |
ScFace_ttf::~ ScFace_ttf() |
{ |
if ( kernFeature ) |
delete kernFeature; |
if ( m_kernFeature ) |
delete m_kernFeature; |
} |
bool ScFace_ttf::isSymbolic() const |
44,8 → 44,8 |
void ScFace_ttf::load() const |
{ |
if ( !kernFeature ) |
kernFeature = new KernFeature ( ftFace() ); |
if ( !m_kernFeature ) |
m_kernFeature = new KernFeature ( ftFace() ); |
FtFace::load(); |
sfnt::PostTable checkPost; |
FT_Face face = ftFace(); |
59,16 → 59,16 |
void ScFace_ttf::unload() const |
{ |
if ( kernFeature ) |
delete kernFeature; |
kernFeature = 0; |
if ( m_kernFeature ) |
delete m_kernFeature; |
m_kernFeature = 0; |
FtFace::unload(); |
} |
qreal ScFace_ttf::glyphKerning ( ScFace::gid_type gl1, ScFace::gid_type gl2, qreal sz ) const |
{ |
if ( kernFeature->isValid() ) |
return kernFeature->getPairValue ( gl1,gl2 ) / m_uniEM * sz; |
if ( m_kernFeature->isValid() ) |
return m_kernFeature->getPairValue ( gl1,gl2 ) / m_uniEM * sz; |
return FtFace::glyphKerning ( gl1, gl2, sz ); |
} |
/trunk/Scribus/scribus/fonts/scface_ttf.h |
---|
37,8 → 37,8 |
virtual bool isSymbolic() const; |
private: |
mutable KernFeature * kernFeature; |
mutable sfnt::PostTable checkPost; |
mutable KernFeature * m_kernFeature; |
mutable sfnt::PostTable m_checkPost; |
}; |
/trunk/Scribus/scribus/fonts/sfnt.cpp |
---|
309,8 → 309,8 |
uint PostTable::numberOfGlyphs() const |
{ |
if (names.length() > 0) |
return names.length(); |
if (m_names.length() > 0) |
return m_names.length(); |
else |
return post_format10_names_count; |
} |
317,9 → 317,9 |
QString PostTable::nameFor(uint glyph) const |
{ |
if (glyph < (uint) names.length()) |
if (glyph < (uint) m_names.length()) |
{ |
return names[glyph]; |
return m_names[glyph]; |
} |
else if (glyph < sfnt::post_format10_names_count) |
{ |
357,7 → 357,7 |
{ |
case sfnt::post_format10: |
usable = true; |
names.clear(); |
m_names.clear(); |
return; |
case sfnt::post_format20: |
break; |
407,7 → 407,7 |
return; |
} |
usedNames[name] = gid; |
names.append(name); |
m_names.append(name); |
} |
errorMsg = ""; |
usable = true; |
1204,7 → 1204,7 |
KernFeature::KernFeature ( FT_Face face ) : m_valid ( true ) |
{ |
FontName = QString (face->family_name) + " " + QString (face->style_name); |
m_FontName = QString (face->family_name) + " " + QString (face->style_name); |
// qDebug() <<"KF"<<FontName; |
// QTime t; |
// t.start(); |
1214,8 → 1214,8 |
// qDebug() <<"\t"<<"GPOS table len"<<length; |
if ( length > 32 ) |
{ |
GPOSTableRaw.resize ( length ); |
FT_Load_Sfnt_Table ( face, TTAG_GPOS, 0, reinterpret_cast<FT_Byte*> ( GPOSTableRaw.data() ), &length ); |
m_GPOSTableRaw.resize ( length ); |
FT_Load_Sfnt_Table ( face, TTAG_GPOS, 0, reinterpret_cast<FT_Byte*> ( m_GPOSTableRaw.data() ), &length ); |
makeCoverage(); |
} |
1222,7 → 1222,7 |
else |
m_valid = false; |
GPOSTableRaw.clear(); |
m_GPOSTableRaw.clear(); |
// coverages.clear(); |
} |
else |
1229,7 → 1229,7 |
m_valid = false; |
if (!m_valid) |
pairs.clear(); |
m_pairs.clear(); |
// qDebug() <<"\t"<<m_valid; |
// qDebug() <<"\t"<<t.elapsed(); |
} |
1238,7 → 1238,7 |
{ |
m_valid = kf.m_valid; |
if ( m_valid ) |
pairs = kf.pairs; |
m_pairs = kf.m_pairs; |
} |
1251,22 → 1251,22 |
if (!m_valid) |
return 0.0; |
if (pairs.contains(glyph1) && |
pairs[glyph1].contains(glyph2)) |
if (m_pairs.contains(glyph1) && |
m_pairs[glyph1].contains(glyph2)) |
{ |
return pairs[glyph1][glyph2]; |
return m_pairs[glyph1][glyph2]; |
} |
//qDebug()<<"Search in classes"; |
foreach (const quint16& coverageId, coverages.keys()) |
foreach (const quint16& coverageId, m_coverages.keys()) |
{ |
// for each pairpos table, coverage lists covered _first_ (left) glyph |
if (!coverages[coverageId].contains(glyph1)) |
if (!m_coverages[coverageId].contains(glyph1)) |
continue; |
foreach(const quint16& classDefOffset, classGlyphFirst[coverageId].keys()) |
foreach(const quint16& classDefOffset, m_classGlyphFirst[coverageId].keys()) |
{ |
const ClassDefTable& cdt(classGlyphFirst[coverageId][classDefOffset]); |
const ClassDefTable& cdt(m_classGlyphFirst[coverageId][classDefOffset]); |
foreach(const quint16& classIndex, cdt.keys()) |
{ |
const QList<quint16>& gl(cdt[classIndex]); |
1274,9 → 1274,9 |
continue; |
//qDebug()<<"Found G1"<<glyph1<<"in Class"<<classIndex<<"at pos"<<gl.indexOf(glyph1); |
// Now we got the index of the first glyph class, see if glyph2 is in one of the left glyphs classes attached to this subtable. |
foreach(const quint16& classDefOffset2, classGlyphSecond[coverageId].keys()) |
foreach(const quint16& classDefOffset2, m_classGlyphSecond[coverageId].keys()) |
{ |
const ClassDefTable& cdt2(classGlyphSecond[coverageId][classDefOffset2]); |
const ClassDefTable& cdt2(m_classGlyphSecond[coverageId][classDefOffset2]); |
foreach(const quint16& classIndex2, cdt2.keys()) |
{ |
const QList<quint16>& gl2(cdt2[classIndex2]); |
1284,9 → 1284,9 |
{ |
//qDebug()<<"Found G2"<<glyph2<<"in Class"<<classIndex2<<"at pos"<<gl2.indexOf(glyph2); |
double v(classValue[coverageId][classIndex][classIndex2]); |
double v(m_classValue[coverageId][classIndex][classIndex2]); |
// Cache this pair into "pairs" map. |
pairs[glyph1][glyph2] = v; |
m_pairs[glyph1][glyph2] = v; |
return v; |
} |
} |
1299,7 → 1299,7 |
void KernFeature::makeCoverage() |
{ |
if ( GPOSTableRaw.isEmpty() ) |
if ( m_GPOSTableRaw.isEmpty() ) |
return; |
quint16 FeatureList_Offset= toUint16 ( 6 ); |
1311,10 → 1311,10 |
for ( quint16 FeatureRecord ( 0 ); FeatureRecord < FeatureCount; ++ FeatureRecord ) |
{ |
int rawIdx ( FeatureList_Offset + 2 + ( 6 * FeatureRecord ) ); |
quint32 tag ( FT_MAKE_TAG ( GPOSTableRaw.at ( rawIdx ), |
GPOSTableRaw.at ( rawIdx + 1 ), |
GPOSTableRaw.at ( rawIdx + 2 ), |
GPOSTableRaw.at ( rawIdx + 3 ) ) ); |
quint32 tag ( FT_MAKE_TAG ( m_GPOSTableRaw.at ( rawIdx ), |
m_GPOSTableRaw.at ( rawIdx + 1 ), |
m_GPOSTableRaw.at ( rawIdx + 2 ), |
m_GPOSTableRaw.at ( rawIdx + 3 ) ) ); |
if ( tag == TTAG_kern ) |
{ |
FeatureKern_Offset << ( toUint16 ( rawIdx + 4 ) + FeatureList_Offset ); |
1361,7 → 1361,7 |
for ( unsigned int gl ( 0 ); gl < GlyphCount; ++gl ) |
{ |
coverages[SubTable] << toUint16 ( GlyphID + ( gl * 2 ) ); |
m_coverages[SubTable] << toUint16 ( GlyphID + ( gl * 2 ) ); |
} |
} |
else if ( 2 == CoverageFormat ) // Coverage Format2 => ranges based |
1381,12 → 1381,12 |
if (Start <= End) |
{ |
for ( unsigned int gl ( Start ); gl <= End; ++gl ) |
coverages[SubTable] << gl; |
m_coverages[SubTable] << gl; |
} |
else |
{ |
for ( int gl ( Start ); gl >= (int) End; --gl ) |
coverages[SubTable] << gl; |
m_coverages[SubTable] << gl; |
} |
} |
} |
1424,7 → 1424,7 |
for ( int psIdx ( 0 ); psIdx < PairSetCount; ++ psIdx ) |
{ |
int oldSecondGlyph = -1; |
unsigned int FirstGlyph ( coverages[subtableOffset][psIdx] ); |
unsigned int FirstGlyph ( m_coverages[subtableOffset][psIdx] ); |
quint16 PairSetOffset ( toUint16 ( subtableOffset +10 + ( 2 * psIdx ) ) + subtableOffset ); |
quint16 PairValueCount ( toUint16 ( PairSetOffset ) ); |
quint16 PairValueRecord ( PairSetOffset + 2 ); |
1439,7 → 1439,7 |
// (http://partners.adobe.com/public/developer/opentype/index_table_formats2.html) |
if (oldSecondGlyph >= SecondGlyph) |
continue; |
pairs[FirstGlyph][SecondGlyph] = double ( Value1 ); |
m_pairs[FirstGlyph][SecondGlyph] = double ( Value1 ); |
oldSecondGlyph = SecondGlyph; |
} |
} |
1449,7 → 1449,7 |
for ( int psIdx ( 0 ); psIdx < PairSetCount; ++ psIdx ) |
{ |
int oldSecondGlyph = -1; |
unsigned int FirstGlyph ( coverages[subtableOffset][psIdx] ); |
unsigned int FirstGlyph ( m_coverages[subtableOffset][psIdx] ); |
quint16 PairSetOffset ( toUint16 ( subtableOffset +10 + ( 2 * psIdx ) ) + subtableOffset ); |
quint16 PairValueCount ( toUint16 ( PairSetOffset ) ); |
quint16 PairValueRecord ( PairSetOffset + 2 ); |
1464,7 → 1464,7 |
// (http://partners.adobe.com/public/developer/opentype/index_table_formats2.html) |
if (oldSecondGlyph >= SecondGlyph) |
continue; |
pairs[FirstGlyph][SecondGlyph] = double ( Value1 ); |
m_pairs[FirstGlyph][SecondGlyph] = double ( Value1 ); |
oldSecondGlyph = SecondGlyph; |
} |
} |
1498,7 → 1498,7 |
qint16 Value1 ( toInt16 ( Class2Record + ( C2 * ( 2 * 2 ) ) ) ); |
if (Value1 != 0) |
{ |
classValue[subtableOffset][C1][C2] = double ( Value1 ); |
m_classValue[subtableOffset][C1][C2] = double ( Value1 ); |
} |
} |
} |
1513,7 → 1513,7 |
qint16 Value1 ( toInt16 ( Class2Record + ( C2 * 2 ) ) ); |
if (Value1 != 0) |
{ |
classValue[subtableOffset][C1][C2] = double ( Value1 ); |
m_classValue[subtableOffset][C1][C2] = double ( Value1 ); |
} |
} |
} |
1532,13 → 1532,13 |
{ |
if (leftGlyph) |
{ |
if (classGlyphFirst.contains(coverageId) && classGlyphFirst[coverageId].contains(classDefOffset)) |
return classGlyphFirst[coverageId][classDefOffset]; |
if (m_classGlyphFirst.contains(coverageId) && m_classGlyphFirst[coverageId].contains(classDefOffset)) |
return m_classGlyphFirst[coverageId][classDefOffset]; |
} |
else |
{ |
if (classGlyphSecond.contains(coverageId) && classGlyphSecond[coverageId].contains(classDefOffset)) |
return classGlyphSecond[coverageId][classDefOffset]; |
if (m_classGlyphSecond.contains(coverageId) && m_classGlyphSecond[coverageId].contains(classDefOffset)) |
return m_classGlyphSecond[coverageId][classDefOffset]; |
} |
ClassDefTable ret; |
1589,9 → 1589,9 |
qDebug() <<"Unknown Class Table type"; |
// if possible (all glyphs are "classed"), avoid to pass through this slow piece of code. |
if (excludeList.count() != coverages[coverageId].count()) |
if (excludeList.count() != m_coverages[coverageId].count()) |
{ |
foreach(const quint16& gidx, coverages[coverageId]) |
foreach(const quint16& gidx, m_coverages[coverageId]) |
{ |
if (!excludeList.contains(gidx)) |
ret[0] << gidx; |
1598,9 → 1598,9 |
} |
} |
if (leftGlyph) |
classGlyphFirst[coverageId][classDefOffset] = ret; |
m_classGlyphFirst[coverageId][classDefOffset] = ret; |
else |
classGlyphSecond[coverageId][classDefOffset] = ret; |
m_classGlyphSecond[coverageId][classDefOffset] = ret; |
return ret; |
} |
1607,7 → 1607,7 |
quint16 KernFeature::toUint16 ( quint16 index ) |
{ |
if ( ( index + 2 ) > GPOSTableRaw.count() ) |
if ( ( index + 2 ) > m_GPOSTableRaw.count() ) |
{ |
// qDebug() << "HORROR!" << index << GPOSTableRaw.count() << FontName ; |
// Rather no kerning at all than random kerning |
1615,8 → 1615,8 |
return 0; |
} |
// FIXME I just do not know how it has to be done *properly* |
quint8 c1 ( GPOSTableRaw.at ( index ) ); |
quint8 c2 ( GPOSTableRaw.at ( index + 1 ) ); |
quint8 c1 ( m_GPOSTableRaw.at ( index ) ); |
quint8 c2 ( m_GPOSTableRaw.at ( index + 1 ) ); |
quint16 ret ( ( c1 << 8 ) | c2 ); |
return ret; |
} |
1623,13 → 1623,13 |
qint16 KernFeature::toInt16 ( quint16 index ) |
{ |
if ( ( index + 2 ) > GPOSTableRaw.count() ) |
if ( ( index + 2 ) > m_GPOSTableRaw.count() ) |
{ |
return 0; |
} |
// FIXME I just do not know how it has to be done *properly* |
quint8 c1 ( GPOSTableRaw.at ( index ) ); |
quint8 c2 ( GPOSTableRaw.at ( index + 1 ) ); |
quint8 c1 ( m_GPOSTableRaw.at ( index ) ); |
quint8 c2 ( m_GPOSTableRaw.at ( index + 1 ) ); |
qint16 ret ( ( c1 << 8 ) | c2 ); |
return ret; |
} |
/trunk/Scribus/scribus/fonts/sfnt.h |
---|
49,7 → 49,7 |
QString nameFor(uint glyphId) const; |
void readFrom(FT_Face face); |
private: |
QList<QString> names; |
QList<QString> m_names; |
}; |
} //namespace |
88,12 → 88,12 |
private: |
bool m_valid; |
QByteArray GPOSTableRaw; |
QMap<quint16,QList<quint16> > coverages; |
mutable QMap<quint16, QMap<quint16, double> > pairs; |
QMap< quint16, QMap<quint16, ClassDefTable> > classGlyphFirst; // < subtable offset, map<offset, class definition table> > for first glyph |
QMap< quint16, QMap<quint16, ClassDefTable> > classGlyphSecond; // < subtable offset, map<offset, class definition table> > for second glyph |
QMap< quint16, QMap<int, QMap<int, double> > > classValue; // < subtable offset, map<class1, map<class2, value> > > |
QByteArray m_GPOSTableRaw; |
QMap<quint16,QList<quint16> > m_coverages; |
mutable QMap<quint16, QMap<quint16, double> > m_pairs; |
QMap< quint16, QMap<quint16, ClassDefTable> > m_classGlyphFirst; // < subtable offset, map<offset, class definition table> > for first glyph |
QMap< quint16, QMap<quint16, ClassDefTable> > m_classGlyphSecond; // < subtable offset, map<offset, class definition table> > for second glyph |
QMap< quint16, QMap<int, QMap<int, double> > > m_classValue; // < subtable offset, map<class1, map<class2, value> > > |
void makeCoverage(); |
void makePairs ( quint16 subtableOffset ); |
102,7 → 102,7 |
inline quint16 toUint16 ( quint16 index ); |
inline qint16 toInt16 ( quint16 index ); |
QString FontName;// for debugging purpose |
QString m_FontName;// for debugging purpose |
}; |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.cpp |
---|
91,8 → 91,8 |
QDomDocument designMapDom; |
if(designMapDom.setContent(f)) |
{ |
inSubLayer = 0; |
layerCount = 0; |
m_inSubLayer = 0; |
m_layerCount = 0; |
QDomElement docElem = designMapDom.documentElement(); |
m_imageInfoRecord.exifInfo.height = docElem.attribute("h", "0").toInt(); |
m_imageInfoRecord.exifInfo.width = docElem.attribute("w", "0").toInt(); |
140,7 → 140,7 |
if (lay.tagName() == "layer") |
{ |
struct PSDLayer layer; |
QString layerName = lay.attribute("name", QString("layer%1").arg(layerCount+1)); |
QString layerName = lay.attribute("name", QString("layer%1").arg(m_layerCount+1)); |
QString compositeOp = lay.attribute("composite-op"); |
double opacity = lay.attribute("opacity", "1.0").toDouble(); |
int x = lay.attribute("x", "0").toInt(); |
160,14 → 160,14 |
double sy = img.height() / 40.0; |
imt = sy < sx ? img.scaled(qRound(img.width() / sx), qRound(img.height() / sx), Qt::IgnoreAspectRatio, Qt::SmoothTransformation) : |
img.scaled(qRound(img.width() / sy), qRound(img.height() / sy), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); |
if (inSubLayer == 0) |
if (m_inSubLayer == 0) |
{ |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerCount))) |
opacity = m_imageInfoRecord.RequestProps[layerCount].opacity / 255.0; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerCount))) |
visible = m_imageInfoRecord.RequestProps[layerCount].visible; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerCount))) |
compositeOp = m_imageInfoRecord.RequestProps[layerCount].blend; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(m_layerCount))) |
opacity = m_imageInfoRecord.RequestProps[m_layerCount].opacity / 255.0; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(m_layerCount))) |
visible = m_imageInfoRecord.RequestProps[m_layerCount].visible; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(m_layerCount))) |
compositeOp = m_imageInfoRecord.RequestProps[m_layerCount].blend; |
layer.layerName = layerName; |
layer.channelType.clear(); |
layer.channelLen.clear(); |
180,7 → 180,7 |
layer.flags = visible ? 0 : 2; |
layer.thumb = imt.copy(); |
m_imageInfoRecord.layerInfo.append(layer); |
layerCount++; |
m_layerCount++; |
} |
if (visible) |
{ |
195,20 → 195,20 |
else if (lay.tagName() == "stack") |
{ |
struct PSDLayer layer; |
QString layerName = lay.attribute("name", QString("layer%1").arg(layerCount+1)); |
QString layerName = lay.attribute("name", QString("layer%1").arg(m_layerCount+1)); |
QString compositeOp = lay.attribute("composite-op"); |
double opacity = lay.attribute("opacity", "1.0").toDouble(); |
int x = lay.attribute("x", "0").toInt(); |
int y = lay.attribute("y", "0").toInt(); |
bool visible = lay.attribute("visibility", "visible") == "visible"; |
if (inSubLayer == 0) |
if (m_inSubLayer == 0) |
{ |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerCount))) |
opacity = m_imageInfoRecord.RequestProps[layerCount].opacity / 255.0; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerCount))) |
visible = m_imageInfoRecord.RequestProps[layerCount].visible; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(layerCount))) |
compositeOp = m_imageInfoRecord.RequestProps[layerCount].blend; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(m_layerCount))) |
opacity = m_imageInfoRecord.RequestProps[m_layerCount].opacity / 255.0; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(m_layerCount))) |
visible = m_imageInfoRecord.RequestProps[m_layerCount].visible; |
if ((m_imageInfoRecord.isRequest) && (m_imageInfoRecord.RequestProps.contains(m_layerCount))) |
compositeOp = m_imageInfoRecord.RequestProps[m_layerCount].blend; |
layer.layerName = layerName; |
layer.channelType.clear(); |
layer.channelLen.clear(); |
220,9 → 220,9 |
layer.maskWidth = 0; |
layer.flags = visible ? 0 : 2; |
m_imageInfoRecord.layerInfo.append(layer); |
layerCount++; |
m_layerCount++; |
} |
inSubLayer++; |
m_inSubLayer++; |
if (visible) |
{ |
painter->save(); |
232,7 → 232,7 |
painter->endLayer(); |
painter->restore(); |
} |
inSubLayer--; |
m_inSubLayer--; |
} |
} |
} |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.h |
---|
26,8 → 26,8 |
void parseStackXML(QDomElement &elem, ScPainter *painter, ScZipHandler *uz); |
int blendModeToInt(QString compositeOp); |
QString blendModeToString(QString compositeOp); |
int inSubLayer; |
int layerCount; |
int m_inSubLayer; |
int m_layerCount; |
}; |
#endif |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.cpp |
---|
82,13 → 82,13 |
ts >> vers; |
if (vers == 0x1101) |
{ |
pctVersion = 1; |
m_pctVersion = 1; |
h = pgW - pgX; |
w = pgH - pgY; |
x = pgY; |
y = pgX; |
resX = 72.0; |
resY = 72.0; |
m_resX = 72.0; |
m_resY = 72.0; |
} |
else if (vers == 0x0011) |
{ |
95,7 → 95,7 |
ts >> vers2 >> vers3; |
if ((vers2 == 0x02FF) && (vers3 == 0x0C00)) |
{ |
pctVersion = 2; |
m_pctVersion = 2; |
qint16 vExt; |
ts >> vExt; |
if (vExt == -1) |
108,8 → 108,8 |
ts >> pgX2 >> pgY2 >> pgW2 >> pgH2; |
ts >> dummy; |
ts >> dummy; |
resX = 72.0; |
resY = 72.0; |
m_resX = 72.0; |
m_resY = 72.0; |
h = pgW - pgX; |
w = pgH - pgY; |
x = pgY; |
126,8 → 126,8 |
w = pgH - pgY; |
x = pgY; |
y = pgX; |
resX = xres; |
resY = yres; |
m_resX = xres; |
m_resY = yres; |
} |
} |
} |
142,39 → 142,39 |
initialize(); |
double x=0.0, y=0.0, w=0.0, h=0.0; |
parseHeader(fn, x, y, w, h); |
docWidth = w; |
docHeight = h; |
baseX = -x; |
baseY = -y; |
m_docWidth = w; |
m_docHeight = h; |
m_baseX = -x; |
m_baseY = -y; |
QFile f(fn); |
if (f.open(QIODevice::ReadOnly)) |
{ |
QDataStream ts(&f); |
ts.device()->seek(522); |
m_image = QImage(docWidth, docHeight, QImage::Format_ARGB32); |
m_image = QImage(m_docWidth, m_docHeight, QImage::Format_ARGB32); |
if (m_image.isNull()) |
return false; |
m_image.fill(qRgba(255, 255, 255, 255)); |
imagePainter.begin(&m_image); |
imagePainter.setRenderHint(QPainter::Antialiasing , true); |
imagePainter.translate(baseX, baseY); |
patternMode = false; |
patternData.resize(0); |
backColor = Qt::white; |
foreColor = Qt::black; |
Coords = QPainterPath(); |
LineW = 1.0; |
currentPoint = QPoint(0, 0); |
currentPointT = QPoint(0, 0); |
ovalSize = QPoint(0, 0); |
fontMap.clear(); |
currentTextSize = 12; |
currentFontID = 0; |
currentFontStyle = 0; |
imageData.resize(0); |
skipOpcode = false; |
postscriptMode = false; |
textIsPostScript = false; |
m_imagePainter.begin(&m_image); |
m_imagePainter.setRenderHint(QPainter::Antialiasing , true); |
m_imagePainter.translate(m_baseX, m_baseY); |
m_patternMode = false; |
m_patternData.resize(0); |
m_backColor = Qt::white; |
m_foreColor = Qt::black; |
m_Coords = QPainterPath(); |
m_LineW = 1.0; |
m_currentPoint = QPoint(0, 0); |
m_currentPointT = QPoint(0, 0); |
m_ovalSize = QPoint(0, 0); |
m_fontMap.clear(); |
m_currentTextSize = 12; |
m_currentFontID = 0; |
m_currentFontStyle = 0; |
m_imageData.resize(0); |
m_skipOpcode = false; |
m_postscriptMode = false; |
m_textIsPostScript = false; |
quint16 vers = 0; |
ts >> vers; |
while (vers == 0) |
188,7 → 188,7 |
} |
if (vers == 0x1101) |
{ |
pctVersion = 1; // Pict Version 1 |
m_pctVersion = 1; // Pict Version 1 |
parsePict(ts); |
} |
else |
195,15 → 195,15 |
{ |
ts.skipRawData(4); // skip the next 4 Bytes |
ts >> vers; // read the version info |
pctVersion = 2; // Pict Extended Version 2 |
m_pctVersion = 2; // Pict Extended Version 2 |
ts.skipRawData(22); |
parsePict(ts); |
} |
imagePainter.end(); |
m_imagePainter.end(); |
m_imageInfoRecord.type = ImageTypeOther; |
m_imageInfoRecord.exifDataValid = false; |
m_imageInfoRecord.xres = resX; |
m_imageInfoRecord.yres = resY; |
m_imageInfoRecord.xres = m_resX; |
m_imageInfoRecord.yres = m_resY; |
m_imageInfoRecord.BBoxX = 0; |
m_imageInfoRecord.colorspace = ColorSpaceRGB; |
m_imageInfoRecord.BBoxH = m_image.height(); |
221,7 → 221,7 |
quint16 opCode, dataLen; |
quint8 dataLenByte; |
quint32 dataLenLong; |
if (pctVersion == 1) |
if (m_pctVersion == 1) |
{ |
ts >> dataLenByte; |
opCode = dataLenByte; |
653,12 → 653,12 |
handleComment(ts, true); |
break; |
case 0x00FF: // End of Pict |
if (imageData.size() > 0) |
if (m_imageData.size() > 0) |
{ |
QImage image; |
image.loadFromData(imageData); |
image.loadFromData(m_imageData); |
image = image.convertToFormat(QImage::Format_ARGB32); |
imagePainter.drawImage(0, 0, image); |
m_imagePainter.drawImage(0, 0, image); |
} |
// qDebug() << "End of Pict"; |
return; |
688,7 → 688,7 |
void ScImgDataLoader_PICT::alignStreamToWord(QDataStream &ts, uint len) |
{ |
ts.skipRawData(len); |
if (pctVersion == 1) |
if (m_pctVersion == 1) |
return; |
uint adj = ts.device()->pos() % 2; |
if (adj != 0) |
755,9 → 755,9 |
blueC = qRound((Bc / 65535.0) * 255.0); |
QColor c = QColor(redC, greenC, blueC); |
if (back) |
backColor = c; |
m_backColor = c; |
else |
foreColor = c; |
m_foreColor = c; |
} |
void ScImgDataLoader_PICT::handleColorRGB(QDataStream &ts, bool back) |
770,22 → 770,22 |
blueC = qRound((Bc / 65535.0) * 255.0); |
QColor c = QColor(redC, greenC, blueC); |
if (back) |
backColor = c; |
m_backColor = c; |
else |
foreColor = c; |
m_foreColor = c; |
} |
void ScImgDataLoader_PICT::handlePenPattern(QDataStream &ts) |
{ |
patternData.resize(8); |
ts.readRawData(patternData.data(), 8); |
patternMode = false; |
for (int a = 0; a < patternData.size(); a++) |
m_patternData.resize(8); |
ts.readRawData(m_patternData.data(), 8); |
m_patternMode = false; |
for (int a = 0; a < m_patternData.size(); a++) |
{ |
uchar d = patternData[a]; |
uchar d = m_patternData[a]; |
if ((d != 0x00) && (d != 0xFF)) |
{ |
patternMode = true; |
m_patternMode = true; |
break; |
} |
} |
800,26 → 800,26 |
polySize -= 14; // subtract size count, bounding rect and first point from size |
qint16 x, y; |
ts >> y >> x; |
Coords = QPainterPath(); |
Coords.moveTo(x, y); |
m_Coords = QPainterPath(); |
m_Coords.moveTo(x, y); |
QBrush fillBrush; |
if (patternMode) |
if (m_patternMode) |
fillBrush = setFillPattern(); |
else |
fillBrush = QBrush(foreColor); |
fillBrush = QBrush(m_foreColor); |
for(unsigned i = 0; i < polySize; i += 4) |
{ |
ts >> y >> x; |
Coords.lineTo(x, y); |
m_Coords.lineTo(x, y); |
} |
if (opCode == 0x0070) |
imagePainter.strokePath(Coords, QPen(foreColor, LineW)); |
m_imagePainter.strokePath(m_Coords, QPen(m_foreColor, m_LineW)); |
else if (opCode == 0x0071) |
imagePainter.fillPath(Coords, fillBrush); |
m_imagePainter.fillPath(m_Coords, fillBrush); |
else if (opCode == 0x0072) |
imagePainter.fillPath(Coords, QBrush(backColor)); |
m_imagePainter.fillPath(m_Coords, QBrush(m_backColor)); |
else if (opCode == 0x0074) |
imagePainter.fillPath(Coords, fillBrush); |
m_imagePainter.fillPath(m_Coords, fillBrush); |
else |
{ |
// qDebug() << QString("Not implemented OpCode: 0x%1").arg(opCode, 4, 16, QLatin1Char('0')); |
831,82 → 831,82 |
{ |
QRect bounds = readRect(ts); |
QBrush fillBrush; |
if (patternMode) |
if (m_patternMode) |
fillBrush = setFillPattern(); |
else |
fillBrush = QBrush(foreColor); |
fillBrush = QBrush(m_foreColor); |
// qDebug() << QString("Handle Rect/Oval 0x%1").arg(opCode, 4, 16, QLatin1Char('0')); |
if (opCode == 0x0030) |
{ |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.setBrush(Qt::NoBrush); |
imagePainter.drawRect(bounds); |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawRect(bounds); |
} |
else if (opCode == 0x0031) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawRect(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawRect(bounds); |
} |
else if (opCode == 0x0032) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(QBrush(backColor)); |
imagePainter.drawRect(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(QBrush(m_backColor)); |
m_imagePainter.drawRect(bounds); |
} |
else if (opCode == 0x0034) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawRect(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawRect(bounds); |
} |
else if (opCode == 0x0040) |
{ |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.setBrush(Qt::NoBrush); |
imagePainter.drawRoundedRect(bounds, ovalSize.x(), ovalSize.y()); |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
else if (opCode == 0x0041) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawRoundedRect(bounds, ovalSize.x(), ovalSize.y()); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
else if (opCode == 0x0042) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(QBrush(backColor)); |
imagePainter.drawRoundedRect(bounds, ovalSize.x(), ovalSize.y()); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(QBrush(m_backColor)); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
else if (opCode == 0x0044) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawRoundedRect(bounds, ovalSize.x(), ovalSize.y()); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
else if (opCode == 0x0050) |
{ |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.setBrush(Qt::NoBrush); |
imagePainter.drawEllipse(bounds); |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawEllipse(bounds); |
} |
else if (opCode == 0x0051) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawEllipse(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawEllipse(bounds); |
} |
else if (opCode == 0x0052) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(QBrush(backColor)); |
imagePainter.drawEllipse(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(QBrush(m_backColor)); |
m_imagePainter.drawEllipse(bounds); |
} |
else if (opCode == 0x0054) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawEllipse(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawEllipse(bounds); |
} |
else |
{ |
913,89 → 913,89 |
// qDebug() << QString("Not implemented OpCode: 0x%1").arg(opCode, 4, 16, QLatin1Char('0')); |
return; |
} |
currRect = bounds; |
m_currRect = bounds; |
} |
void ScImgDataLoader_PICT::handleSameShape(QDataStream &ts, quint16 opCode) |
{ |
// qDebug() << QString("Handle Same Rect/Oval 0x%1").arg(opCode, 4, 16, QLatin1Char('0')); |
QRect bounds = currRect; |
QRect bounds = m_currRect; |
QBrush fillBrush; |
if (patternMode) |
if (m_patternMode) |
fillBrush = setFillPattern(); |
else |
fillBrush = QBrush(foreColor); |
fillBrush = QBrush(m_foreColor); |
if (opCode == 0x0038) |
{ |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.setBrush(Qt::NoBrush); |
imagePainter.drawRect(bounds); |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawRect(bounds); |
} |
else if (opCode == 0x0039) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawRect(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawRect(bounds); |
} |
else if (opCode == 0x003A) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(QBrush(backColor)); |
imagePainter.drawRect(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(QBrush(m_backColor)); |
m_imagePainter.drawRect(bounds); |
} |
else if (opCode == 0x003C) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawRect(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawRect(bounds); |
} |
else if (opCode == 0x0048) |
{ |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.setBrush(Qt::NoBrush); |
imagePainter.drawRoundedRect(bounds, ovalSize.x(), ovalSize.y()); |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
else if (opCode == 0x0049) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawRoundedRect(bounds, ovalSize.x(), ovalSize.y()); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
else if (opCode == 0x004A) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(QBrush(backColor)); |
imagePainter.drawRoundedRect(bounds, ovalSize.x(), ovalSize.y()); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(QBrush(m_backColor)); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
else if (opCode == 0x004C) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawRoundedRect(bounds, ovalSize.x(), ovalSize.y()); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
else if (opCode == 0x0058) |
{ |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.setBrush(Qt::NoBrush); |
imagePainter.drawEllipse(bounds); |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawEllipse(bounds); |
} |
else if (opCode == 0x0059) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawEllipse(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawEllipse(bounds); |
} |
else if (opCode == 0x005A) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(QBrush(backColor)); |
imagePainter.drawEllipse(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(QBrush(m_backColor)); |
m_imagePainter.drawEllipse(bounds); |
} |
else if (opCode == 0x005C) |
{ |
imagePainter.setPen(Qt::NoPen); |
imagePainter.setBrush(fillBrush); |
imagePainter.drawEllipse(bounds); |
m_imagePainter.setPen(Qt::NoPen); |
m_imagePainter.setBrush(fillBrush); |
m_imagePainter.drawEllipse(bounds); |
} |
else |
{ |
1026,7 → 1026,7 |
break; |
} |
} |
fontMap.insert(fontID, fontName); |
m_fontMap.insert(fontID, fontName); |
alignStreamToWord(ts, 0); |
// qDebug() << "Handle FontName" << fontName << "ID" << fontID; |
} |
1035,7 → 1035,7 |
{ |
quint16 fontSize; |
ts >> fontSize; |
currentTextSize = fontSize; |
m_currentTextSize = fontSize; |
// qDebug() << "Handle Text Size" << fontSize; |
} |
1043,7 → 1043,7 |
{ |
quint16 fontID; |
ts >> fontID; |
currentFontID = fontID; |
m_currentFontID = fontID; |
// qDebug() << "Handle Text Font" << fontID; |
} |
1052,7 → 1052,7 |
quint8 style; |
ts >> style; |
alignStreamToWord(ts, 0); |
currentFontStyle = style; |
m_currentFontStyle = style; |
// qDebug() << "Text Style" << style; |
} |
1064,19 → 1064,19 |
switch (mode) |
{ |
case 0: |
imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
break; |
case 1: |
imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
break; |
case 2: |
imagePainter.setCompositionMode(QPainter::CompositionMode_Xor); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_Xor); |
break; |
case 3: |
imagePainter.setCompositionMode(QPainter::CompositionMode_Xor); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_Xor); |
break; |
default: |
imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
break; |
} |
} |
1090,9 → 1090,9 |
QByteArray text; |
text.resize(textLen); |
ts.readRawData(text.data(), textLen); |
if (!textIsPostScript) |
if (!m_textIsPostScript) |
{ |
currentPointT = QPoint(x, y); |
m_currentPointT = QPoint(x, y); |
createTextPath(text); |
// qDebug() << "Handle Long Text at" << x << y << text; |
} |
1106,10 → 1106,10 |
QByteArray text; |
text.resize(textLen); |
ts.readRawData(text.data(), textLen); |
if (!textIsPostScript) |
if (!m_textIsPostScript) |
{ |
QPoint s = currentPointT; |
currentPointT = QPoint(s.x()+dh, s.y()); |
QPoint s = m_currentPointT; |
m_currentPointT = QPoint(s.x()+dh, s.y()); |
createTextPath(text); |
// qDebug() << "Handle DH Text at" << currentPointT << text; |
} |
1123,10 → 1123,10 |
QByteArray text; |
text.resize(textLen); |
ts.readRawData(text.data(), textLen); |
if (!textIsPostScript) |
if (!m_textIsPostScript) |
{ |
QPoint s = currentPointT; |
currentPointT = QPoint(s.x(), s.y()+dv); |
QPoint s = m_currentPointT; |
m_currentPointT = QPoint(s.x(), s.y()+dv); |
createTextPath(text); |
// qDebug() << "Handle DV Text at" << currentPointT << text; |
} |
1140,10 → 1140,10 |
QByteArray text; |
text.resize(textLen); |
ts.readRawData(text.data(), textLen); |
if (!textIsPostScript) |
if (!m_textIsPostScript) |
{ |
QPoint s = currentPointT; |
currentPointT = QPoint(s.x()+dh, s.y()+dv); |
QPoint s = m_currentPointT; |
m_currentPointT = QPoint(s.x()+dh, s.y()+dv); |
createTextPath(text); |
// qDebug() << "Handle DHV Text" << dh << dv << "->" << currentPointT << text; |
} |
1155,30 → 1155,30 |
QTextCodec *codec = QTextCodec::codecForName("Apple Roman"); |
QString string = codec->toUnicode(textString); |
QFont textFont; |
if (!fontMap.contains(currentFontID)) |
if (!m_fontMap.contains(m_currentFontID)) |
textFont = QFont(); |
else |
{ |
QString fontName = fontMap[currentFontID]; |
textFont = QFont(fontName, currentTextSize); |
QString fontName = m_fontMap[m_currentFontID]; |
textFont = QFont(fontName, m_currentTextSize); |
QFontInfo inf(textFont); |
// qDebug() << "Using Font" << inf.family() << "for" << fontName; |
} |
textFont.setPixelSize(currentTextSize); |
if (currentFontStyle & 1) |
textFont.setPixelSize(m_currentTextSize); |
if (m_currentFontStyle & 1) |
textFont.setBold(true); |
if (currentFontStyle & 2) |
if (m_currentFontStyle & 2) |
textFont.setItalic(true); |
if (currentFontStyle & 4) |
if (m_currentFontStyle & 4) |
textFont.setUnderline(true); |
QPainterPath painterPath; |
painterPath.addText( currentPointT.x(), currentPointT.y(), textFont, string); |
painterPath.addText( m_currentPointT.x(), m_currentPointT.y(), textFont, string); |
QBrush fillBrush; |
if (patternMode) |
if (m_patternMode) |
fillBrush = setFillPattern(); |
else |
fillBrush = QBrush(foreColor); |
imagePainter.fillPath(painterPath, fillBrush); |
fillBrush = QBrush(m_foreColor); |
m_imagePainter.fillPath(painterPath, fillBrush); |
} |
void ScImgDataLoader_PICT::handlePenMode(QDataStream &ts) |
1189,19 → 1189,19 |
switch (mode) |
{ |
case 0: |
imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
break; |
case 1: |
imagePainter.setCompositionMode(QPainter::CompositionMode_Xor); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_Xor); |
break; |
case 8: |
imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
break; |
case 9: |
imagePainter.setCompositionMode(QPainter::CompositionMode_Xor); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_Xor); |
break; |
default: |
imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
m_imagePainter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
break; |
} |
} |
1211,7 → 1211,7 |
// qDebug() << "Handle Pen Size"; |
quint16 x, y; |
ts >> y >> x; |
LineW = qMax(x, y); |
m_LineW = qMax(x, y); |
} |
void ScImgDataLoader_PICT::handleOvalSize(QDataStream &ts) |
1219,7 → 1219,7 |
// qDebug() << "Handle Oval Size"; |
quint16 x, y; |
ts >> y >> x; |
ovalSize = QPoint(x, y); |
m_ovalSize = QPoint(x, y); |
} |
void ScImgDataLoader_PICT::handleShortLine(QDataStream &ts) |
1228,9 → 1228,9 |
qint8 dh, dv; |
ts >> y >> x; |
ts >> dh >> dv; |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.drawLine(x, y, x + dh, y + dv); |
currentPoint = QPoint(x+dh, y+dv); |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.drawLine(x, y, x + dh, y + dv); |
m_currentPoint = QPoint(x+dh, y+dv); |
// qDebug() << "Handle Short Line" << x << y << "+" << dh << dv << "->" << currentPoint; |
} |
1240,10 → 1240,10 |
ts >> dh >> dv; |
if ((dh == 0) && (dv == 0)) |
return; |
QPoint s = currentPoint; |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.drawLine(s.x(), s.y(), s.x() + dh, s.y() + dv); |
currentPoint = QPoint(s.x()+dh, s.y()+dv); |
QPoint s = m_currentPoint; |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.drawLine(s.x(), s.y(), s.x() + dh, s.y() + dv); |
m_currentPoint = QPoint(s.x()+dh, s.y()+dv); |
// qDebug() << "Handle Short Line from" << dh << dv << "->" << currentPoint; |
} |
1252,9 → 1252,9 |
qint16 x1, x2, y1, y2; |
ts >> y1 >> x1; |
ts >> y2 >> x2; |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.drawLine(x1, y1, x2, y2); |
currentPoint = QPoint(x2, y2); |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.drawLine(x1, y1, x2, y2); |
m_currentPoint = QPoint(x2, y2); |
// qDebug() << "Handle Line" << x1 << y1 << "->" << currentPoint; |
} |
1264,10 → 1264,10 |
ts >> y >> x; |
if ((x == 0) && (y == 0)) |
return; |
QPoint s = currentPoint; |
imagePainter.setPen(QPen(foreColor, LineW)); |
imagePainter.drawLine(s.x(), s.y(), x, y); |
currentPoint = QPoint(x, y); |
QPoint s = m_currentPoint; |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.drawLine(s.x(), s.y(), x, y); |
m_currentPoint = QPoint(x, y); |
// qDebug() << "Handle Line from" << s << "->" << currentPoint; |
} |
1354,7 → 1354,7 |
} |
else |
ts >> pixByteCount; |
if (!skipOpcode) |
if (!m_skipOpcode) |
{ |
QByteArray data; |
data.resize(pixByteCount); |
1438,19 → 1438,19 |
ts.skipRawData(pixByteCount); |
} |
} |
if (skipOpcode) |
if (m_skipOpcode) |
{ |
image.loadFromData(imageData); |
image.loadFromData(m_imageData); |
isPixmap = true; |
imageData.resize(0); |
m_imageData.resize(0); |
} |
if ((component_size == 24) || (component_size == 8) || (component_size == 1) || (component_size == 5) || (component_size == 4) || (!isPixmap) || (skipOpcode)) |
if ((component_size == 24) || (component_size == 8) || (component_size == 1) || (component_size == 5) || (component_size == 4) || (!isPixmap) || (m_skipOpcode)) |
{ |
image = image.convertToFormat(QImage::Format_ARGB32); |
if (!isPixmap) |
image.invertPixels(); |
imagePainter.drawImage(dstRect, image); |
skipOpcode = false; |
m_imagePainter.drawImage(dstRect, image); |
m_skipOpcode = false; |
} |
alignStreamToWord(ts, 0); |
} |
1503,9 → 1503,9 |
ts >> dummyLong; |
ts >> imgDataSize; |
alignStreamToWord(ts, 38); |
imageData.resize(imgDataSize); |
ts.readRawData(imageData.data(), imgDataSize); |
skipOpcode = true; |
m_imageData.resize(imgDataSize); |
ts.readRawData(m_imageData.data(), imgDataSize); |
m_skipOpcode = true; |
} |
} |
else |
1518,7 → 1518,7 |
} |
ts >> mode; |
handlePixmap(ts, mode); |
skipOpcode = true; |
m_skipOpcode = true; |
} |
ts.device()->seek(pos + dataLenLong); |
// qDebug() << "File Pos" << ts.device()->pos(); |
1612,12 → 1612,12 |
qDebug() << "Comment type: SetLineWidth"; |
break; */ |
case 190: // PostScriptBegin |
postscriptMode = true; |
m_postscriptMode = true; |
// qDebug() << "Comment type: PostScriptBegin"; |
break; |
case 191: // PostScriptEnd |
postscriptMode = false; |
textIsPostScript = false; |
m_postscriptMode = false; |
m_textIsPostScript = false; |
// qDebug() << "Comment type: PostScriptEnd"; |
break; |
case 192: // PostScriptHandle |
1627,7 → 1627,7 |
// qDebug() << "Comment type: PostScriptFile"; |
break; |
case 194: // TextIsPostScript |
textIsPostScript = true; |
m_textIsPostScript = true; |
// qDebug() << "Comment type: TextIsPostScript"; |
break; |
/* case 195: // ResourcePS |
1755,13 → 1755,13 |
{ |
QImage image = QImage(8, 8, QImage::Format_Mono); |
QVector<QRgb> colors; |
colors.append(backColor.rgb()); |
colors.append(foreColor.rgb()); |
colors.append(m_backColor.rgb()); |
colors.append(m_foreColor.rgb()); |
image.setColorTable(colors); |
for (int rr = 0; rr < 8; rr++) |
{ |
uchar *q = (uchar*)(image.scanLine(rr)); |
*q = patternData[rr]; |
*q = m_patternData[rr]; |
} |
image = image.convertToFormat(QImage::Format_ARGB32); |
return QBrush(image); |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.h |
---|
65,34 → 65,34 |
QByteArray decodeRLE(QByteArray &in, quint16 bytesPerLine, int twoByte); |
QBrush setFillPattern(); |
int baseX, baseY; |
int docWidth; |
int docHeight; |
double resX, resY; |
int m_baseX, m_baseY; |
int m_docWidth; |
int m_docHeight; |
double m_resX, m_resY; |
double LineW; |
QColor backColor; |
QColor foreColor; |
bool patternMode; |
QByteArray patternData; |
QRect currRect; |
QBrush currPatternBrush; |
QRect lastImageRect; |
QPoint ovalSize; |
QMap<int, QString> fontMap; |
int currentTextSize; |
int currentFontID; |
int currentFontStyle; |
QByteArray imageData; |
double m_LineW; |
QColor m_backColor; |
QColor m_foreColor; |
bool m_patternMode; |
QByteArray m_patternData; |
QRect m_currRect; |
QBrush m_currPatternBrush; |
QRect m_lastImageRect; |
QPoint m_ovalSize; |
QMap<int, QString> m_fontMap; |
int m_currentTextSize; |
int m_currentFontID; |
int m_currentFontStyle; |
QByteArray m_imageData; |
QPainterPath Coords; |
QPoint currentPoint; |
QPoint currentPointT; |
QPainter imagePainter; |
bool postscriptMode; |
bool textIsPostScript; |
int pctVersion; |
bool skipOpcode; |
QPainterPath m_Coords; |
QPoint m_currentPoint; |
QPoint m_currentPointT; |
QPainter m_imagePainter; |
bool m_postscriptMode; |
bool m_textIsPostScript; |
int m_pctVersion; |
bool m_skipOpcode; |
}; |
#endif |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp |
---|
42,8 → 42,8 |
ScImgDataLoader_PS::ScImgDataLoader_PS(void) : ScImgDataLoader() |
{ |
doThumbnail = false; |
hasThumbnail = false; |
m_doThumbnail = false; |
m_hasThumbnail = false; |
initSupportedFormatList(); |
} |
50,8 → 50,8 |
void ScImgDataLoader_PS::initialize(void) |
{ |
doThumbnail = false; |
hasThumbnail = false; |
m_doThumbnail = false; |
m_hasThumbnail = false; |
ScImgDataLoader::initialize(); |
} |
130,7 → 130,7 |
ScTextStream ts2(&tmp, QIODevice::ReadOnly); |
QString tmp2; |
ts2 >> tmp2; |
FontListe.removeAll(tmp2); |
m_FontListe.removeAll(tmp2); |
} |
} |
} |
143,18 → 143,18 |
ScColor cc; |
double x, y, b, h, c, m, k; |
bool found = false; |
isDCS1 = false; |
isDCS2 = false; |
isDCS2multi = false; |
isPhotoshop = false; |
hasPhotoshopImageData = false; |
hasThumbnail = false; |
inTrailer = false; |
BBoxInTrailer = false; |
isRotated = false; |
m_isDCS1 = false; |
m_isDCS2 = false; |
m_isDCS2multi = false; |
m_isPhotoshop = false; |
m_hasPhotoshopImageData = false; |
m_hasThumbnail = false; |
m_inTrailer = false; |
m_BBoxInTrailer = false; |
m_isRotated = false; |
int plateCount = 0; |
uint startPos = 0; |
FontListe.clear(); |
m_FontListe.clear(); |
QFile f(fn); |
if (f.open(QIODevice::ReadOnly)) |
{ |
163,7 → 163,7 |
if (getDouble(tempBuf.mid(0, 4), true) == 0xC5D0D3C6) |
{ |
startPos = getDouble(tempBuf.mid(4, 4), false); |
if (doThumbnail) |
if (m_doThumbnail) |
{ |
f.seek(0); |
QByteArray tmp2buf(29, ' '); |
199,7 → 199,7 |
m_imageInfoRecord.exifInfo.thumbnail = thum.qImage().copy(); |
} |
QFile::remove(tmpFile); |
hasThumbnail = true; |
m_hasThumbnail = true; |
} |
} |
} |
211,7 → 211,7 |
{ |
tmp = readLinefromDataStream(ts); |
if (tmp.startsWith("%%Creator: ")) |
Creator = tmp.remove("%%Creator: "); |
m_Creator = tmp.remove("%%Creator: "); |
if (tmp.startsWith("%%Pages: ")) |
{ |
tmp = tmp.remove("%%Pages: "); |
221,13 → 221,13 |
m_imageInfoRecord.numberOfPages = pages; |
} |
if (tmp.startsWith("%%Trailer")) |
inTrailer = true; |
m_inTrailer = true; |
if (tmp.startsWith("%%BoundingBox:")) |
{ |
found = true; |
if (inTrailer) |
BBoxInTrailer = true; |
BBox = tmp.remove("%%BoundingBox:"); |
if (m_inTrailer) |
m_BBoxInTrailer = true; |
m_BBox = tmp.remove("%%BoundingBox:"); |
} |
if (!found) |
{ |
234,35 → 234,35 |
if (tmp.startsWith("%%BoundingBox")) |
{ |
found = true; |
if (inTrailer) |
BBoxInTrailer = true; |
BBox = tmp.remove("%%BoundingBox"); |
if (m_inTrailer) |
m_BBoxInTrailer = true; |
m_BBox = tmp.remove("%%BoundingBox"); |
} |
} |
if (tmp.startsWith("%%Orientation:")) |
{ |
if (tmp.contains("Landscape")) |
isRotated = true; |
m_isRotated = true; |
} |
if (tmp.startsWith("%%CyanPlate:")) |
{ |
colorPlates.insert("Cyan", tmp.remove("%%CyanPlate: ")); |
isDCS1 = true; |
m_colorPlates.insert("Cyan", tmp.remove("%%CyanPlate: ")); |
m_isDCS1 = true; |
} |
if (tmp.startsWith("%%MagentaPlate:")) |
{ |
colorPlates.insert("Magenta", tmp.remove("%%MagentaPlate: ")); |
isDCS1 = true; |
m_colorPlates.insert("Magenta", tmp.remove("%%MagentaPlate: ")); |
m_isDCS1 = true; |
} |
if (tmp.startsWith("%%YellowPlate:")) |
{ |
colorPlates.insert("Yellow", tmp.remove("%%YellowPlate: ")); |
isDCS1 = true; |
m_colorPlates.insert("Yellow", tmp.remove("%%YellowPlate: ")); |
m_isDCS1 = true; |
} |
if (tmp.startsWith("%%BlackPlate:")) |
{ |
colorPlates.insert("Black", tmp.remove("%%BlackPlate: ")); |
isDCS1 = true; |
m_colorPlates.insert("Black", tmp.remove("%%BlackPlate: ")); |
m_isDCS1 = true; |
} |
if (tmp.startsWith("%%PlateFile: (")) |
{ |
281,7 → 281,7 |
uint pos = posStr.toUInt(); |
uint len = lenStr.toUInt(); |
struct plateOffsets offs; |
if (Creator.contains("Photoshop Version 9")) // This is very strange, it seems that there is a bug in PS 9 which writes weired entries |
if (m_Creator.contains("Photoshop Version 9")) // This is very strange, it seems that there is a bug in PS 9 which writes weired entries |
{ |
pos -= (191 + plateCount * 83); |
len -= 83; |
288,15 → 288,15 |
} |
offs.pos = pos; |
offs.len = len; |
colorPlates2.insert(plateNam, offs); |
isDCS2 = true; |
m_colorPlates2.insert(plateNam, offs); |
m_isDCS2 = true; |
plateCount++; |
} |
else |
{ |
colorPlates.insert(plateNam, lenStr); |
isDCS2 = true; |
isDCS2multi = true; |
m_colorPlates.insert(plateNam, lenStr); |
m_isDCS2 = true; |
m_isDCS2multi = true; |
} |
} |
} |
309,7 → 309,7 |
if (!tmp2.contains("(atend)")) |
{ |
if (!tmp2.isEmpty()) |
FontListe.append(tmp2); |
m_FontListe.append(tmp2); |
while (!ts.atEnd()) |
{ |
uint oldPos = ts.device()->pos(); |
324,7 → 324,7 |
QString tmp2; |
ts2 >> tmp2; |
if (!tmp2.isEmpty()) |
FontListe.append(tmp2); |
m_FontListe.append(tmp2); |
} |
} |
else |
341,7 → 341,7 |
FarNam = FarNam.remove(FarNam.length()-1,1); |
cc = ScColor(static_cast<int>(255 * c), static_cast<int>(255 * m), static_cast<int>(255 * y), static_cast<int>(255 * k)); |
cc.setSpotColor(true); |
CustColors.insert(FarNam, cc); |
m_CustColors.insert(FarNam, cc); |
while (!ts.atEnd()) |
{ |
uint oldPos = ts.device()->pos(); |
360,7 → 360,7 |
FarNam = FarNam.remove(FarNam.length()-1,1); |
cc = ScColor(static_cast<int>(255 * c), static_cast<int>(255 * m), static_cast<int>(255 * y), static_cast<int>(255 * k)); |
cc.setSpotColor(true); |
CustColors.insert(FarNam, cc); |
m_CustColors.insert(FarNam, cc); |
} |
} |
if (tmp.startsWith("%%EndComments")) |
375,12 → 375,12 |
} |
if (tmp.startsWith("%ImageData: ")) |
{ |
hasPhotoshopImageData = true; |
m_hasPhotoshopImageData = true; |
tmp.remove("%ImageData: "); |
ScTextStream ts2(&tmp, QIODevice::ReadOnly); |
ts2 >> psXSize >> psYSize >> psDepth >> psMode >> psChannel >> psBlock >> psDataType >> psCommand; |
psCommand = psCommand.remove(0,1); |
psCommand = psCommand.remove(psCommand.length()-1,1); |
ts2 >> m_psXSize >> m_psYSize >> m_psDepth >> m_psMode >> m_psChannel >> m_psBlock >> m_psDataType >> m_psCommand; |
m_psCommand = m_psCommand.remove(0,1); |
m_psCommand = m_psCommand.remove(m_psCommand.length()-1,1); |
} |
if (tmp.startsWith("%BeginPhotoshop")) |
{ |
393,7 → 393,7 |
QDataStream strPhot( &psdata, QIODevice::ReadOnly); |
strPhot.setByteOrder( QDataStream::BigEndian ); |
PSDHeader fakeHeader; |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
fakeHeader.width = qRound(b); |
fakeHeader.height = qRound(h); |
409,7 → 409,7 |
it.value().map(mm); |
} |
} |
isPhotoshop = true; |
m_isPhotoshop = true; |
break; |
} |
for (int a = 2; a < tmp.length(); a += 2) |
420,7 → 420,7 |
psdata[psdata.size()-1] = data; |
} |
} |
if ((doThumbnail) && ((hasThumbnail) || (!m_imageInfoRecord.exifInfo.thumbnail.isNull()))) |
if ((m_doThumbnail) && ((m_hasThumbnail) || (!m_imageInfoRecord.exifInfo.thumbnail.isNull()))) |
return true; |
} |
if (tmp.startsWith("%%BeginICCProfile:")) |
490,28 → 490,28 |
m_imageInfoRecord.type = ImageTypeEPS; |
m_imageInfoRecord.exifDataValid = false; |
m_imageInfoRecord.numberOfPages = 1; // will be overwritten by parse() |
doThumbnail = thumbnail; |
colorPlates2.clear(); |
colorPlates.clear(); |
CustColors.clear(); |
CustColors.insert("Cyan", ScColor(255, 0, 0, 0)); |
CustColors.insert("Magenta", ScColor(0, 255, 0, 0)); |
CustColors.insert("Yellow", ScColor(0, 0, 255, 0)); |
CustColors.insert("Black", ScColor(0, 0, 0, 255)); |
m_doThumbnail = thumbnail; |
m_colorPlates2.clear(); |
m_colorPlates.clear(); |
m_CustColors.clear(); |
m_CustColors.insert("Cyan", ScColor(255, 0, 0, 0)); |
m_CustColors.insert("Magenta", ScColor(0, 255, 0, 0)); |
m_CustColors.insert("Yellow", ScColor(0, 0, 255, 0)); |
m_CustColors.insert("Black", ScColor(0, 0, 0, 255)); |
found = parseData(fn); |
if (FontListe.count() != 0) |
if (m_FontListe.count() != 0) |
{ |
scanForFonts(fn); |
if (FontListe.count() != 0) |
if (m_FontListe.count() != 0) |
{ |
bool missing = false; |
QString missingF = ""; |
for (int fo = 0; fo < FontListe.count(); fo++) |
for (int fo = 0; fo < m_FontListe.count(); fo++) |
{ |
if (!PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.contains(FontListe[fo])) |
if (!PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.contains(m_FontListe[fo])) |
{ |
missing = true; |
missingF += FontListe[fo]+"\n"; |
missingF += m_FontListe[fo]+"\n"; |
} |
} |
if (missing) |
523,17 → 523,17 |
} |
if ((thumbnail) && (m_imageInfoRecord.exifDataValid) && (!m_imageInfoRecord.exifInfo.thumbnail.isNull())) |
{ |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
m_imageInfoRecord.exifInfo.width = qRound(b); |
m_imageInfoRecord.exifInfo.height = qRound(h); |
m_image = m_imageInfoRecord.exifInfo.thumbnail; |
if ((isPhotoshop) && (hasPhotoshopImageData)) |
if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
{ |
m_imageInfoRecord.exifInfo.width = psXSize; |
m_imageInfoRecord.exifInfo.height = psYSize; |
m_imageInfoRecord.exifInfo.width = m_psXSize; |
m_imageInfoRecord.exifInfo.height = m_psYSize; |
m_imageInfoRecord.type = ImageType7; |
if (psMode == 4) |
if (m_psMode == 4) |
{ |
m_imageInfoRecord.colorspace = ColorSpaceCMYK; |
QRgb *s; |
563,15 → 563,15 |
} |
if (found) |
{ |
if (isDCS1) |
if (m_isDCS1) |
loadDCS1(fn, gsRes); |
else if (isDCS2) |
else if (m_isDCS2) |
loadDCS2(fn, gsRes); |
else if ((isPhotoshop) && (hasPhotoshopImageData)) |
else if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
loadPhotoshop(fn, gsRes); |
else if ((!m_imageInfoRecord.isEmbedded) || ((m_imageInfoRecord.isEmbedded) && (m_profileComponents == 3))) |
{ |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
QStringList args; |
xres = gsRes; |
578,7 → 578,7 |
yres = gsRes; |
if (extensionIndicatesEPS(ext)) |
{ |
if (!BBoxInTrailer) |
if (!m_BBoxInTrailer) |
args.append("-dEPSCrop"); |
} |
args.append("-r"+QString::number(gsRes)); |
589,7 → 589,7 |
if (retg == 0) |
{ |
m_image.load(tmpFile); |
if ((extensionIndicatesEPS(ext) && BBoxInTrailer) || (isRotated)) |
if ((extensionIndicatesEPS(ext) && m_BBoxInTrailer) || (m_isRotated)) |
{ |
int ex = qRound(x * gsRes / 72.0); |
int ey = qRound(m_image.height() - h); |
597,7 → 597,7 |
int eh = qRound(h - y * gsRes / 72.0); |
m_image = m_image.copy(ex, ey, ew, eh); |
} |
if ((!ScCore->havePNGAlpha()) || (isRotated)) |
if ((!ScCore->havePNGAlpha()) || (m_isRotated)) |
{ |
int wi = m_image.width(); |
int hi = m_image.height(); |
643,7 → 643,7 |
} |
else |
{ |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
h = h * gsRes / 72.0; |
QStringList args; |
732,7 → 732,7 |
void ScImgDataLoader_PS::loadPhotoshop(QString fn, int gsRes) |
{ |
if ((psDataType >= 1) && (psDataType <= 6) && ((psMode == 3) || (psMode == 4))) |
if ((m_psDataType >= 1) && (m_psDataType <= 6) && ((m_psMode == 3) || (m_psMode == 4))) |
{ |
loadPhotoshopBinary(fn); |
return; |
746,12 → 746,12 |
int GsMajor; |
int GsMinor; |
getNumericGSVersion(GsMajor, GsMinor); |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
h = h * gsRes / 72.0; |
if (extensionIndicatesEPS(ext)) |
args.append("-dEPSCrop"); |
if (psMode == 4) |
if (m_psMode == 4) |
args.append("-dGrayValues=256"); |
if ((GsMajor >= 8) && (GsMinor >= 53)) |
args.append("-dNOPSICC"); // prevent GS from applying an embedded ICC profile as it will be applied later on in ScImage. |
758,13 → 758,13 |
args.append("-r"+QString::number(gsRes)); |
args.append("-sOutputFile=" + tmpFile); |
args.append(QDir::toNativeSeparators(fn)); |
if (psMode == 4) |
if (m_psMode == 4) |
retg = callGS(args, "bitcmyk"); |
else |
retg = callGS(args); |
if (retg == 0) |
{ |
if (psMode == 4) |
if (m_psMode == 4) |
{ |
m_image = QImage( qRound(b * gsRes / 72.0), qRound(h * gsRes / 72.0), QImage::Format_ARGB32 ); |
m_image.fill(qRgba(0, 0, 0, 0)); |
1158,7 → 1158,7 |
void ScImgDataLoader_PS::loadPhotoshopBinary(QString fn) |
{ |
double x, y, b, h; |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
QFileInfo fi = QFileInfo(fn); |
QString ext = fi.suffix().toLower(); |
1165,16 → 1165,16 |
QString tmpFile = QDir::toNativeSeparators(ScPaths::getTempFileDir() + "sc1.jpg"); |
QFile f2(tmpFile); |
QString tmp; |
m_image = QImage(psXSize, psYSize, QImage::Format_ARGB32); |
m_image = QImage(m_psXSize, m_psYSize, QImage::Format_ARGB32); |
m_image.fill(qRgba(0, 0, 0, 0)); |
m_imageInfoRecord.xres = qRound(psXSize / b * 72.0); |
m_imageInfoRecord.yres = qRound(psYSize / h * 72.0); |
m_imageInfoRecord.xres = qRound(m_psXSize / b * 72.0); |
m_imageInfoRecord.yres = qRound(m_psYSize / h * 72.0); |
QByteArray psdata; |
QFile f(fn); |
int yCount = 0; |
if (f.open(QIODevice::ReadOnly)) |
{ |
if (psDataType > 2) |
if (m_psDataType > 2) |
{ |
f2.open(QIODevice::WriteOnly); |
} |
1182,27 → 1182,27 |
while (!ts.atEnd()) |
{ |
tmp = readLinefromDataStream(ts); |
if (tmp == psCommand) |
if (tmp == m_psCommand) |
{ |
if (psDataType == 1) |
if (m_psDataType == 1) |
{ |
QRgb *p; |
uchar cc, cm, cy, ck; |
for (int yh = 0; yh < m_image.height(); ++yh ) |
{ |
if (psMode == 4) |
psdata.resize(psXSize * (4 + psChannel)); |
if (m_psMode == 4) |
psdata.resize(m_psXSize * (4 + m_psChannel)); |
else |
psdata.resize(psXSize * (3 + psChannel)); |
psdata.resize(m_psXSize * (3 + m_psChannel)); |
f.read(psdata.data(), psdata.size()); |
p = (QRgb *)m_image.scanLine( yh ); |
for (int xh = 0; xh < m_image.width(); ++xh ) |
{ |
cc = psdata[xh]; |
cm = psdata[psXSize+xh]; |
cy = psdata[psXSize*2+xh]; |
ck = psdata[psXSize*3+xh]; |
if (psMode == 4) |
cm = psdata[m_psXSize+xh]; |
cy = psdata[m_psXSize*2+xh]; |
ck = psdata[m_psXSize*3+xh]; |
if (m_psMode == 4) |
*p = qRgba(cc, cm, cy, ck); |
else |
*p = qRgba(cc, cm, cy, 255); |
1210,7 → 1210,7 |
} |
} |
} |
else if (psDataType > 1) |
else if (m_psDataType > 1) |
{ |
while (!ts.atEnd()) |
{ |
1217,7 → 1217,7 |
tmp = readLinefromDataStream(ts); |
if ((tmp.isEmpty()) || (tmp.startsWith("%%EndBinary"))) |
break; |
if (psDataType == 2) |
if (m_psDataType == 2) |
{ |
for (int a = 0; a < tmp.length(); a += 2) |
{ |
1234,7 → 1234,7 |
psdata.resize(0); |
} |
} |
if (psDataType > 2) |
if (m_psDataType > 2) |
{ |
f2.close(); |
loadPSjpeg(tmpFile); |
1250,11 → 1250,11 |
for (int xh = 0; xh < m_image.width(); ++xh ) |
{ |
cc = psdata[yCount+xh]; |
cm = psdata[yCount+psXSize+xh]; |
cy = psdata[yCount+psXSize*2+xh]; |
if (psMode == 4) |
cm = psdata[yCount+m_psXSize+xh]; |
cy = psdata[yCount+m_psXSize*2+xh]; |
if (m_psMode == 4) |
{ |
ck = psdata[yCount+psXSize*3+xh]; |
ck = psdata[yCount+m_psXSize*3+xh]; |
*p = qRgba(cc, cm, cy, ck); |
} |
else |
1261,14 → 1261,14 |
*p = qRgba(cc, cm, cy, 255); |
p++; |
} |
if (psMode == 4) |
yCount += psXSize * (4 + psChannel); |
if (m_psMode == 4) |
yCount += m_psXSize * (4 + m_psChannel); |
else |
yCount += psXSize * (3 + psChannel); |
yCount += m_psXSize * (3 + m_psChannel); |
} |
} |
} |
if (psMode == 4) |
if (m_psMode == 4) |
{ |
m_imageInfoRecord.colorspace = ColorSpaceCMYK; |
m_pixelFormat = Format_YMCK_8; |
1294,7 → 1294,7 |
void ScImgDataLoader_PS::loadPhotoshopBinary(QString fn, QImage &tmpImg) |
{ |
double x, y, b, h; |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
QFileInfo fi = QFileInfo(fn); |
QString ext = fi.suffix().toLower(); |
1301,7 → 1301,7 |
QString tmpFile = QDir::toNativeSeparators(ScPaths::getTempFileDir() + "sc1.jpg"); |
QFile f2(tmpFile); |
QString tmp; |
tmpImg = QImage(psXSize, psYSize, QImage::Format_ARGB32); |
tmpImg = QImage(m_psXSize, m_psYSize, QImage::Format_ARGB32); |
tmpImg.fill(qRgba(0, 0, 0, 0)); |
QByteArray psdata; |
QFile f(fn); |
1308,7 → 1308,7 |
int yCount = 0; |
if (f.open(QIODevice::ReadOnly)) |
{ |
if (psDataType > 2) |
if (m_psDataType > 2) |
{ |
f2.open(QIODevice::WriteOnly); |
} |
1316,28 → 1316,28 |
while (!ts.atEnd()) |
{ |
tmp = readLinefromDataStream(ts); |
if (tmp == psCommand) |
if (tmp == m_psCommand) |
{ |
if (psDataType == 1) |
if (m_psDataType == 1) |
{ |
QRgb *p; |
uchar cc, cm, cy, ck; |
for (int yh = 0; yh < tmpImg.height(); ++yh ) |
{ |
if (psMode == 4) |
psdata.resize(psXSize * (4 + psChannel)); |
if (m_psMode == 4) |
psdata.resize(m_psXSize * (4 + m_psChannel)); |
else |
psdata.resize(psXSize * (3 + psChannel)); |
psdata.resize(m_psXSize * (3 + m_psChannel)); |
f.read(psdata.data(), psdata.size()); |
p = (QRgb *)tmpImg.scanLine( yh ); |
for (int xh = 0; xh < tmpImg.width(); ++xh ) |
{ |
cc = psdata[xh]; |
cm = psdata[psXSize+xh]; |
cy = psdata[psXSize*2+xh]; |
if (psMode == 4) |
cm = psdata[m_psXSize+xh]; |
cy = psdata[m_psXSize*2+xh]; |
if (m_psMode == 4) |
{ |
ck = psdata[psXSize*3+xh]; |
ck = psdata[m_psXSize*3+xh]; |
*p = qRgba(cc, cm, cy, ck); |
} |
else |
1346,7 → 1346,7 |
} |
} |
} |
else if (psDataType > 1) |
else if (m_psDataType > 1) |
{ |
while (!ts.atEnd()) |
{ |
1353,7 → 1353,7 |
tmp = readLinefromDataStream(ts); |
if ((tmp.isEmpty()) || (tmp.startsWith("%%EndBinary"))) |
break; |
if (psDataType == 2) |
if (m_psDataType == 2) |
{ |
for (int a = 0; a < tmp.length(); a += 2) |
{ |
1370,7 → 1370,7 |
psdata.resize(0); |
} |
} |
if (psDataType > 2) |
if (m_psDataType > 2) |
{ |
f2.close(); |
loadPSjpeg(tmpFile, tmpImg); |
1386,11 → 1386,11 |
for (int xh = 0; xh < tmpImg.width(); ++xh ) |
{ |
cc = psdata[yCount+xh]; |
cm = psdata[yCount+psXSize+xh]; |
cy = psdata[yCount+psXSize*2+xh]; |
if (psMode == 4) |
cm = psdata[yCount+m_psXSize+xh]; |
cy = psdata[yCount+m_psXSize*2+xh]; |
if (m_psMode == 4) |
{ |
ck = psdata[yCount+psXSize*3+xh]; |
ck = psdata[yCount+m_psXSize*3+xh]; |
*p = qRgba(cc, cm, cy, ck); |
} |
else |
1397,10 → 1397,10 |
*p = qRgba(cc, cm, cy, 255); |
p++; |
} |
if (psMode == 4) |
yCount += psXSize * (4 + psChannel); |
if (m_psMode == 4) |
yCount += m_psXSize * (4 + m_psChannel); |
else |
yCount += psXSize * (3 + psChannel); |
yCount += m_psXSize * (3 + m_psChannel); |
} |
} |
} |
1424,22 → 1424,22 |
QString picFile = QDir::toNativeSeparators(fn); |
float xres = gsRes; |
float yres = gsRes; |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
xres = gsRes; |
yres = gsRes; |
if ((isPhotoshop) && (hasPhotoshopImageData)) |
if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
{ |
m_image = QImage(psXSize, psYSize, QImage::Format_ARGB32); |
xres = psXSize / b * 72.0; |
yres = psYSize / h * 72.0; |
m_image = QImage(m_psXSize, m_psYSize, QImage::Format_ARGB32); |
xres = m_psXSize / b * 72.0; |
yres = m_psYSize / h * 72.0; |
} |
else |
m_image = QImage( qRound(b * gsRes / 72.0), qRound(h * gsRes / 72.0), QImage::Format_ARGB32 ); |
m_image.fill(qRgba(0, 0, 0, 0)); |
if (!isDCS2multi) |
if (!m_isDCS2multi) |
{ |
for (QMap<QString, plateOffsets>::Iterator it = colorPlates2.begin(); it != colorPlates2.end(); ++it) |
for (QMap<QString, plateOffsets>::Iterator it = m_colorPlates2.begin(); it != m_colorPlates2.end(); ++it) |
{ |
QByteArray imgc(it.value().len, ' '); |
QFile f(picFile); |
1454,11 → 1454,11 |
f2.write(imgc.data(), it.value().len); |
f2.close(); |
imgc.resize(0); |
if ((isPhotoshop) && (hasPhotoshopImageData)) |
if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
{ |
QImage tmpImg; |
loadPhotoshopBinary(tmpFile2, tmpImg); |
blendImages(tmpImg, CustColors[it.key()]); |
blendImages(tmpImg, m_CustColors[it.key()]); |
} |
else |
{ |
1471,7 → 1471,7 |
{ |
QImage tmpImg; |
tmpImg.load(tmpFile); |
blendImages(tmpImg, CustColors[it.key()]); |
blendImages(tmpImg, m_CustColors[it.key()]); |
QFile::remove(tmpFile); |
} |
} |
1480,14 → 1480,14 |
} |
else |
{ |
for (QMap<QString, QString>::Iterator it = colorPlates.begin(); it != colorPlates.end(); ++it) |
for (QMap<QString, QString>::Iterator it = m_colorPlates.begin(); it != m_colorPlates.end(); ++it) |
{ |
tmpFile2 = QDir::toNativeSeparators(baseFile+"/"+it.value()); |
if ((isPhotoshop) && (hasPhotoshopImageData)) |
if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
{ |
QImage tmpImg; |
loadPhotoshopBinary(tmpFile2, tmpImg); |
blendImages(tmpImg, CustColors[it.key()]); |
blendImages(tmpImg, m_CustColors[it.key()]); |
} |
else |
{ |
1500,7 → 1500,7 |
{ |
QImage tmpImg; |
tmpImg.load(tmpFile); |
blendImages(tmpImg, CustColors[it.key()]); |
blendImages(tmpImg, m_CustColors[it.key()]); |
QFile::remove(tmpFile); |
} |
args.clear(); |
1537,7 → 1537,7 |
QString picFile; |
float xres = gsRes; |
float yres = gsRes; |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
xres = gsRes; |
yres = gsRes; |
1548,7 → 1548,7 |
args.append("-dEPSCrop"); |
args.append("-r"+QString::number(gsRes)); |
args.append("-sOutputFile="+tmpFile); |
picFile = QDir::toNativeSeparators(baseFile+"/"+colorPlates["Cyan"]); |
picFile = QDir::toNativeSeparators(baseFile+"/"+m_colorPlates["Cyan"]); |
args.append(picFile); |
int retg = callGS(args); |
if (retg == 0) |
1564,7 → 1564,7 |
args.append("-dEPSCrop"); |
args.append("-r"+QString::number(gsRes)); |
args.append("-sOutputFile="+tmpFile); |
picFile = QDir::toNativeSeparators(baseFile+"/"+colorPlates["Magenta"]); |
picFile = QDir::toNativeSeparators(baseFile+"/"+m_colorPlates["Magenta"]); |
args.append(picFile); |
retg = callGS(args); |
if (retg == 0) |
1580,7 → 1580,7 |
args.append("-dEPSCrop"); |
args.append("-r"+QString::number(gsRes)); |
args.append("-sOutputFile="+tmpFile); |
picFile = QDir::toNativeSeparators(baseFile+"/"+colorPlates["Yellow"]); |
picFile = QDir::toNativeSeparators(baseFile+"/"+m_colorPlates["Yellow"]); |
args.append(picFile); |
retg = callGS(args); |
if (retg == 0) |
1596,7 → 1596,7 |
args.append("-dEPSCrop"); |
args.append("-r"+QString::number(gsRes)); |
args.append("-sOutputFile="+tmpFile); |
picFile = QDir::toNativeSeparators(baseFile+"/"+colorPlates["Black"]); |
picFile = QDir::toNativeSeparators(baseFile+"/"+m_colorPlates["Black"]); |
args.append(picFile); |
retg = callGS(args); |
if (retg == 0) |
1675,7 → 1675,7 |
found = parseData(fn); |
if (found) |
{ |
ScTextStream ts2(&BBox, QIODevice::ReadOnly); |
ScTextStream ts2(&m_BBox, QIODevice::ReadOnly); |
ts2 >> x >> y >> b >> h; |
h = h * gsRes / 72.0; |
QStringList args; |
1683,7 → 1683,7 |
yres = gsRes; |
if (extensionIndicatesEPS(ext)) |
{ |
if (!BBoxInTrailer) |
if (!m_BBoxInTrailer) |
args.append("-dEPSCrop"); |
} |
args.append("-r"+QString::number(gsRes)); |
1694,7 → 1694,7 |
if (retg == 0) |
{ |
m_image.load(tmpFile); |
if ((extensionIndicatesEPS(ext) && BBoxInTrailer) || (isRotated)) |
if ((extensionIndicatesEPS(ext) && m_BBoxInTrailer) || (m_isRotated)) |
{ |
int ex = qRound(x * gsRes / 72.0); |
int ey = qRound(m_image.height() - h); |
1702,7 → 1702,7 |
int eh = qRound(h - y * gsRes / 72.0); |
m_image = m_image.copy(ex, ey, ew, eh); |
} |
if ((!ScCore->havePNGAlpha()) || (isRotated)) |
if ((!ScCore->havePNGAlpha()) || (m_isRotated)) |
{ |
int wi = m_image.width(); |
int hi = m_image.height(); |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.h |
---|
31,30 → 31,30 |
uint pos; |
uint len; |
}; |
QMap<QString, plateOffsets> colorPlates2; |
QMap<QString, QString> colorPlates; |
QString BBox; |
QString Creator; |
bool isDCS1; |
bool isDCS2; |
bool isDCS2multi; |
bool isPhotoshop; |
bool hasPhotoshopImageData; |
bool doThumbnail; |
bool hasThumbnail; |
bool inTrailer; |
bool BBoxInTrailer; |
bool isRotated; |
int psXSize; |
int psYSize; |
int psDepth; |
int psMode; |
int psChannel; |
int psBlock; |
int psDataType; |
QString psCommand; |
QMap<QString,ScColor> CustColors; |
QStringList FontListe; |
QMap<QString, plateOffsets> m_colorPlates2; |
QMap<QString, QString> m_colorPlates; |
QString m_BBox; |
QString m_Creator; |
bool m_isDCS1; |
bool m_isDCS2; |
bool m_isDCS2multi; |
bool m_isPhotoshop; |
bool m_hasPhotoshopImageData; |
bool m_doThumbnail; |
bool m_hasThumbnail; |
bool m_inTrailer; |
bool m_BBoxInTrailer; |
bool m_isRotated; |
int m_psXSize; |
int m_psYSize; |
int m_psDepth; |
int m_psMode; |
int m_psChannel; |
int m_psBlock; |
int m_psDataType; |
QString m_psCommand; |
QMap<QString,ScColor> m_CustColors; |
QStringList m_FontListe; |
public: |
ScImgDataLoader_PS(void); |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp |
---|
121,11 → 121,11 |
f.close(); |
m_imageInfoRecord.valid = true; |
if (header.color_mode == CM_CMYK) |
m_imageInfoRecord.valid = hasAlpha = (maxChannels > 4); |
m_imageInfoRecord.valid = hasAlpha = (m_maxChannels > 4); |
else if (header.color_mode == CM_GRAYSCALE) |
m_imageInfoRecord.valid = hasAlpha = (maxChannels > 1); |
m_imageInfoRecord.valid = hasAlpha = (m_maxChannels > 1); |
else |
m_imageInfoRecord.valid = hasAlpha = (maxChannels >= 4); |
m_imageInfoRecord.valid = hasAlpha = (m_maxChannels >= 4); |
return true; |
} |
return false; |
258,7 → 258,7 |
m_pixelFormat = Format_RGBA_8; |
} |
r_image.fill(0); |
maxChannels = header.channel_count; |
m_maxChannels = header.channel_count; |
uint tmp; |
uint cresStart; |
uint cdataStart; |
296,15 → 296,15 |
srand(314159265); |
for (int i = 0; i < 4096; i++) |
random_table[i] = rand(); |
m_random_table[i] = rand(); |
int tmpd; |
int swap; |
for (int i = 0; i < 4096; i++) |
{ |
swap = i + rand() % (4096 - i); |
tmpd = random_table[i]; |
random_table[i] = random_table[swap]; |
random_table[swap] = tmpd; |
tmpd = m_random_table[i]; |
m_random_table[i] = m_random_table[swap]; |
m_random_table[swap] = tmpd; |
} |
// Skip mode data. FIX: this is incorrect, it's the Colormap Data for indexed Images |
s >> tmp; |
330,7 → 330,7 |
{ |
case 0: // RGB colour |
col.setColorRGB(c >> 8, m >> 8, y >> 8); |
colorTableSc.append(col); |
m_colorTableSc.append(col); |
break; |
case 1: // HSB colour |
hc = c >> 8; |
338,11 → 338,11 |
bc = y >> 8; |
HSVTORGB(hc, sc, bc); |
col.setColorRGB(hc, sc, bc); |
colorTableSc.append(col); |
m_colorTableSc.append(col); |
break; |
case 2: // CMYK colour |
col.setColor(c >> 8, m >> 8, y >> 8, k >> 8); |
colorTableSc.append(col); |
m_colorTableSc.append(col); |
break; |
case 3: // Pantone |
case 4: // Focoltone |
350,15 → 350,15 |
case 6: // Toyo 88 colorfinder 1050 |
case 7: // LAB colour space |
case 10: // HKS colors |
if (colorTableSc.count() == 0) |
colorTableSc.append(ScColor(0, 0, 0, 255)); |
if (m_colorTableSc.count() == 0) |
m_colorTableSc.append(ScColor(0, 0, 0, 255)); |
else |
colorTableSc.append(ScColor(0, 0, 0, 0)); |
m_colorTableSc.append(ScColor(0, 0, 0, 0)); |
specialColour = true; |
break; |
case 8: // Grayscale |
c = qRound((c / 10000.0) * 255); |
colorTableSc.append(ScColor(0, 0, 0, c)); |
m_colorTableSc.append(ScColor(0, 0, 0, c)); |
break; |
} |
} |
384,21 → 384,21 |
} |
PSDDuotone_Color colSpec; |
colSpec.Name = colName; |
colSpec.Color = colorTableSc[cda]; |
colSpec.Color = m_colorTableSc[cda]; |
colSpec.Curve = tmcu; |
m_imageInfoRecord.duotoneColors.append(colSpec); |
} |
// Initialize loading curve tables with default values |
curveTable1.resize(256); |
curveTable2.resize(256); |
curveTable3.resize(256); |
curveTable4.resize(256); |
m_curveTable1.resize(256); |
m_curveTable2.resize(256); |
m_curveTable3.resize(256); |
m_curveTable4.resize(256); |
for (int x = 0 ; x < 256 ; x++) |
{ |
curveTable1[x] = x; |
curveTable2[x] = x; |
curveTable3[x] = x; |
curveTable4[x] = x; |
m_curveTable1[x] = x; |
m_curveTable2[x] = x; |
m_curveTable3[x] = x; |
m_curveTable4[x] = x; |
} |
} |
else |
420,34 → 420,34 |
} |
if (cda == 0) |
{ |
curveTable1.resize(256); |
m_curveTable1.resize(256); |
for (int x = 0 ; x < 256 ; x++) |
{ |
curveTable1[x] = qMin(255, qMax(0, qRound(getCurveYValue(tmcu, x / 255.0) * 255))); |
m_curveTable1[x] = qMin(255, qMax(0, qRound(getCurveYValue(tmcu, x / 255.0) * 255))); |
} |
} |
else if (cda == 1) |
{ |
curveTable2.resize(256); |
m_curveTable2.resize(256); |
for (int x = 0 ; x < 256 ; x++) |
{ |
curveTable2[x] = qMin(255, qMax(0, qRound(getCurveYValue(tmcu, x / 255.0) * 255))); |
m_curveTable2[x] = qMin(255, qMax(0, qRound(getCurveYValue(tmcu, x / 255.0) * 255))); |
} |
} |
else if (cda == 2) |
{ |
curveTable3.resize(256); |
m_curveTable3.resize(256); |
for (int x = 0 ; x < 256 ; x++) |
{ |
curveTable3[x] = qMin(255, qMax(0, qRound(getCurveYValue(tmcu, x / 255.0) * 255))); |
m_curveTable3[x] = qMin(255, qMax(0, qRound(getCurveYValue(tmcu, x / 255.0) * 255))); |
} |
} |
else if (cda == 3) |
{ |
curveTable4.resize(256); |
m_curveTable4.resize(256); |
for (int x = 0 ; x < 256 ; x++) |
{ |
curveTable4[x] = qMin(255, qMax(0, qRound(getCurveYValue(tmcu, x / 255.0) * 255))); |
m_curveTable4[x] = qMin(255, qMax(0, qRound(getCurveYValue(tmcu, x / 255.0) * 255))); |
} |
} |
} |
461,7 → 461,7 |
colorTableR.clear(); |
colorTableG.clear(); |
colorTableB.clear(); |
colorTable.clear(); |
m_colorTable.clear(); |
uchar r; |
for (uint cc = 0; cc < 256; cc++) |
{ |
480,7 → 480,7 |
} |
for (uint cc = 0; cc < 256; cc++) |
{ |
colorTable.append(qRgb(colorTableR[cc], colorTableG[cc], colorTableB[cc])); |
m_colorTable.append(qRgb(colorTableR[cc], colorTableG[cc], colorTableB[cc])); |
} |
} |
} |
554,7 → 554,7 |
lay.width = right - left; |
s >> numChannels; |
// Qt4 check these conversions |
maxChannels = qMax(maxChannels, (int)numChannels); |
m_maxChannels = qMax(m_maxChannels, (int)numChannels); |
if (numChannels > 6) // we don't support images with more than 6 channels yet |
{ |
m_imageInfoRecord.layerInfo.clear(); |
694,7 → 694,7 |
} |
else if ((header.color_mode == CM_INDEXED) && (component != 3)) |
{ |
int ccol = colorTable[cbyte]; |
int ccol = m_colorTable[cbyte]; |
ptr[0] = qRed(ccol); |
ptr[1] = qGreen(ccol); |
ptr[2] = qBlue(ccol); |
758,7 → 758,7 |
else if ((header.color_mode == CM_INDEXED) && (component != 3)) |
{ |
ptr -= component; |
int ccol = colorTable[cbyte]; |
int ccol = m_colorTable[cbyte]; |
ptr[0] = qRed(ccol); |
ptr[1] = qGreen(ccol); |
ptr[2] = qBlue(ccol); |
805,7 → 805,7 |
else if ((header.color_mode == CM_INDEXED) && (component != 3)) |
{ |
ptr -= component; |
int ccol = colorTable[val]; |
int ccol = m_colorTable[val]; |
ptr[0] = qRed(ccol); |
ptr[1] = qGreen(ccol); |
ptr[2] = qBlue(ccol); |
1027,7 → 1027,7 |
layOpa = m_imageInfoRecord.RequestProps[layer].opacity; |
for (int l = 0; l < r2_image.height(); l++) |
{ |
srand(random_table[ l % 4096]); |
srand(m_random_table[ l % 4096]); |
for (int k = 0; k < r2_image.width(); k++) |
{ |
int rand_val = rand() & 0xff; |
1406,7 → 1406,7 |
else if ((header.color_mode == CM_INDEXED) && (components[channel] != 3)) |
{ |
ptr -= components[channel]; |
int ccol = colorTable[cbyte]; |
int ccol = m_colorTable[cbyte]; |
ptr[0] = qRed(ccol); |
ptr[1] = qGreen(ccol); |
ptr[2] = qBlue(ccol); |
1450,7 → 1450,7 |
else if ((header.color_mode == CM_INDEXED) && (components[channel] != 3)) |
{ |
ptr -= components[channel]; |
int ccol = colorTable[val]; |
int ccol = m_colorTable[val]; |
ptr[0] = qRed(ccol); |
ptr[1] = qGreen(ccol); |
ptr[2] = qBlue(ccol); |
1503,7 → 1503,7 |
else if ((header.color_mode == CM_INDEXED) && (components[channel] != 3)) |
{ |
ptr -= components[channel]; |
int ccol = colorTable[cbyte]; |
int ccol = m_colorTable[cbyte]; |
ptr[0] = qRed(ccol); |
ptr[1] = qGreen(ccol); |
ptr[2] = qBlue(ccol); |
1583,27 → 1583,27 |
int c, c1, c2, c3, m, m1, m2, m3, y, y1, y2, y3, k, k1, k2, k3; |
uchar cb = 255 - cbyte; |
ScColor col; |
if (colorTableSc.count() == 1) |
if (m_colorTableSc.count() == 1) |
{ |
colorTableSc[0].getRawRGBColor(&c, &m, &y); |
ptr[0] = qMin((c * curveTable1[(int)cbyte]) >> 8, 255); |
ptr[1] = qMin((m * curveTable1[(int)cbyte]) >> 8, 255); |
ptr[2] = qMin((y * curveTable1[(int)cbyte]) >> 8, 255); |
m_colorTableSc[0].getRawRGBColor(&c, &m, &y); |
ptr[0] = qMin((c * m_curveTable1[(int)cbyte]) >> 8, 255); |
ptr[1] = qMin((m * m_curveTable1[(int)cbyte]) >> 8, 255); |
ptr[2] = qMin((y * m_curveTable1[(int)cbyte]) >> 8, 255); |
} |
else if (colorTableSc.count() == 2) |
else if (m_colorTableSc.count() == 2) |
{ |
ScColorEngine::getCMYKValues(colorTableSc[0], NULL, cmyk); |
ScColorEngine::getCMYKValues(m_colorTableSc[0], NULL, cmyk); |
cmyk.getValues(c, m, y, k); |
c = qMin((c * curveTable1[(int)cb]) >> 8, 255); |
m = qMin((m * curveTable1[(int)cb]) >> 8, 255); |
y = qMin((y * curveTable1[(int)cb]) >> 8, 255); |
k = qMin((k * curveTable1[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(colorTableSc[1], NULL, cmyk); |
c = qMin((c * m_curveTable1[(int)cb]) >> 8, 255); |
m = qMin((m * m_curveTable1[(int)cb]) >> 8, 255); |
y = qMin((y * m_curveTable1[(int)cb]) >> 8, 255); |
k = qMin((k * m_curveTable1[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(m_colorTableSc[1], NULL, cmyk); |
cmyk.getValues(c1, m1, y1, k1); |
c1 = qMin((c1 * curveTable2[(int)cb]) >> 8, 255); |
m1 = qMin((m1 * curveTable2[(int)cb]) >> 8, 255); |
y1 = qMin((y1 * curveTable2[(int)cb]) >> 8, 255); |
k1 = qMin((k1 * curveTable2[(int)cb]) >> 8, 255); |
c1 = qMin((c1 * m_curveTable2[(int)cb]) >> 8, 255); |
m1 = qMin((m1 * m_curveTable2[(int)cb]) >> 8, 255); |
y1 = qMin((y1 * m_curveTable2[(int)cb]) >> 8, 255); |
k1 = qMin((k1 * m_curveTable2[(int)cb]) >> 8, 255); |
col = ScColor(qMin(c+c1, 255), qMin(m+m1, 255), qMin(y+y1, 255), qMin(k+k1, 255)); |
col.getRawRGBColor(&c, &m, &y); |
ptr[0] = c; |
1610,26 → 1610,26 |
ptr[1] = m; |
ptr[2] = y; |
} |
else if (colorTableSc.count() == 3) |
else if (m_colorTableSc.count() == 3) |
{ |
ScColorEngine::getCMYKValues(colorTableSc[0], NULL, cmyk); |
ScColorEngine::getCMYKValues(m_colorTableSc[0], NULL, cmyk); |
cmyk.getValues(c, m, y, k); |
c = qMin((c * curveTable1[(int)cb]) >> 8, 255); |
m = qMin((m * curveTable1[(int)cb]) >> 8, 255); |
y = qMin((y * curveTable1[(int)cb]) >> 8, 255); |
k = qMin((k * curveTable1[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(colorTableSc[1], NULL, cmyk); |
c = qMin((c * m_curveTable1[(int)cb]) >> 8, 255); |
m = qMin((m * m_curveTable1[(int)cb]) >> 8, 255); |
y = qMin((y * m_curveTable1[(int)cb]) >> 8, 255); |
k = qMin((k * m_curveTable1[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(m_colorTableSc[1], NULL, cmyk); |
cmyk.getValues(c1, m1, y1, k1); |
c1 = qMin((c1 * curveTable2[(int)cb]) >> 8, 255); |
m1 = qMin((m1 * curveTable2[(int)cb]) >> 8, 255); |
y1 = qMin((y1 * curveTable2[(int)cb]) >> 8, 255); |
k1 = qMin((k1 * curveTable2[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(colorTableSc[2], NULL, cmyk); |
c1 = qMin((c1 * m_curveTable2[(int)cb]) >> 8, 255); |
m1 = qMin((m1 * m_curveTable2[(int)cb]) >> 8, 255); |
y1 = qMin((y1 * m_curveTable2[(int)cb]) >> 8, 255); |
k1 = qMin((k1 * m_curveTable2[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(m_colorTableSc[2], NULL, cmyk); |
cmyk.getValues(c2, m2, y2, k2); |
c2 = qMin((c2 * curveTable3[(int)cb]) >> 8, 255); |
m2 = qMin((m2 * curveTable3[(int)cb]) >> 8, 255); |
y2 = qMin((y2 * curveTable3[(int)cb]) >> 8, 255); |
k2 = qMin((k2 * curveTable3[(int)cb]) >> 8, 255); |
c2 = qMin((c2 * m_curveTable3[(int)cb]) >> 8, 255); |
m2 = qMin((m2 * m_curveTable3[(int)cb]) >> 8, 255); |
y2 = qMin((y2 * m_curveTable3[(int)cb]) >> 8, 255); |
k2 = qMin((k2 * m_curveTable3[(int)cb]) >> 8, 255); |
col = ScColor(qMin(c+c1+c2, 255), qMin(m+m1+m2, 255), qMin(y+y1+y2, 255), qMin(k+k1+k2, 255)); |
col.getRawRGBColor(&c, &m, &y); |
ptr[0] = c; |
1636,32 → 1636,32 |
ptr[1] = m; |
ptr[2] = y; |
} |
else if (colorTableSc.count() == 4) |
else if (m_colorTableSc.count() == 4) |
{ |
ScColorEngine::getCMYKValues(colorTableSc[0], NULL, cmyk); |
ScColorEngine::getCMYKValues(m_colorTableSc[0], NULL, cmyk); |
cmyk.getValues(c, m, y, k); |
c = qMin((c * curveTable1[(int)cb]) >> 8, 255); |
m = qMin((m * curveTable1[(int)cb]) >> 8, 255); |
y = qMin((y * curveTable1[(int)cb]) >> 8, 255); |
k = qMin((k * curveTable1[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(colorTableSc[1], NULL, cmyk); |
c = qMin((c * m_curveTable1[(int)cb]) >> 8, 255); |
m = qMin((m * m_curveTable1[(int)cb]) >> 8, 255); |
y = qMin((y * m_curveTable1[(int)cb]) >> 8, 255); |
k = qMin((k * m_curveTable1[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(m_colorTableSc[1], NULL, cmyk); |
cmyk.getValues(c1, m1, y1, k1); |
c1 = qMin((c1 * curveTable2[(int)cb]) >> 8, 255); |
m1 = qMin((m1 * curveTable2[(int)cb]) >> 8, 255); |
y1 = qMin((y1 * curveTable2[(int)cb]) >> 8, 255); |
k1 = qMin((k1 * curveTable2[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(colorTableSc[2], NULL, cmyk); |
c1 = qMin((c1 * m_curveTable2[(int)cb]) >> 8, 255); |
m1 = qMin((m1 * m_curveTable2[(int)cb]) >> 8, 255); |
y1 = qMin((y1 * m_curveTable2[(int)cb]) >> 8, 255); |
k1 = qMin((k1 * m_curveTable2[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(m_colorTableSc[2], NULL, cmyk); |
cmyk.getValues(c2, m2, y2, k2); |
c2 = qMin((c2 * curveTable3[(int)cb]) >> 8, 255); |
m2 = qMin((m2 * curveTable3[(int)cb]) >> 8, 255); |
y2 = qMin((y2 * curveTable3[(int)cb]) >> 8, 255); |
k2 = qMin((k2 * curveTable3[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(colorTableSc[3], NULL, cmyk); |
c2 = qMin((c2 * m_curveTable3[(int)cb]) >> 8, 255); |
m2 = qMin((m2 * m_curveTable3[(int)cb]) >> 8, 255); |
y2 = qMin((y2 * m_curveTable3[(int)cb]) >> 8, 255); |
k2 = qMin((k2 * m_curveTable3[(int)cb]) >> 8, 255); |
ScColorEngine::getCMYKValues(m_colorTableSc[3], NULL, cmyk); |
cmyk.getValues(c3, m3, y3, k3); |
c3 = qMin((c3 * curveTable4[(int)cb]) >> 8, 255); |
m3 = qMin((m3 * curveTable4[(int)cb]) >> 8, 255); |
y3 = qMin((y3 * curveTable4[(int)cb]) >> 8, 255); |
k3 = qMin((k3 * curveTable4[(int)cb]) >> 8, 255); |
c3 = qMin((c3 * m_curveTable4[(int)cb]) >> 8, 255); |
m3 = qMin((m3 * m_curveTable4[(int)cb]) >> 8, 255); |
y3 = qMin((y3 * m_curveTable4[(int)cb]) >> 8, 255); |
k3 = qMin((k3 * m_curveTable4[(int)cb]) >> 8, 255); |
col = ScColor(qMin(c+c1+c2+c3, 255), qMin(m+m1+m2+m3, 255), qMin(y+y1+y2+y3, 255), qMin(k+k1+k2+k3, 255)); |
col.getRawRGBColor(&c, &m, &y); |
ptr[0] = c; |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.h |
---|
39,9 → 39,9 |
protected: |
QList<unsigned int> colorTable; |
QList<ScColor> colorTableSc; |
int random_table[4096]; |
QList<unsigned int> m_colorTable; |
QList<ScColor> m_colorTableSc; |
int m_random_table[4096]; |
void initSupportedFormatList(); |
57,11 → 57,11 |
bool parseLayer( QDataStream & s, const PSDHeader & header); |
QString getLayerString(QDataStream & s); |
void putDuotone(uchar *ptr, uchar cbyte); |
int maxChannels; |
QVector<int> curveTable1; |
QVector<int> curveTable2; |
QVector<int> curveTable3; |
QVector<int> curveTable4; |
int m_maxChannels; |
QVector<int> m_curveTable1; |
QVector<int> m_curveTable2; |
QVector<int> m_curveTable3; |
QVector<int> m_curveTable4; |
}; |
#endif |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp |
---|
394,7 → 394,7 |
{ |
for (int l = 0; l < tmp->height(); l++) |
{ |
srand(random_table[ l % 4096]); |
srand(m_random_table[ l % 4096]); |
for (int k = 0; k < tmp->width(); k++) |
{ |
int rand_val = rand() & 0xff; |
659,14 → 659,14 |
} |
srand(314159265); |
for (int i = 0; i < 4096; i++) |
random_table[i] = rand(); |
m_random_table[i] = rand(); |
for (int i = 0; i < 4096; i++) |
{ |
int tmp; |
int swap = i + rand() % (4096 - i); |
tmp = random_table[i]; |
random_table[i] = random_table[swap]; |
random_table[swap] = tmp; |
tmp = m_random_table[i]; |
m_random_table[i] = m_random_table[swap]; |
m_random_table[swap] = tmp; |
} |
int test; |
bool valid = m_imageInfoRecord.isRequest; |
691,10 → 691,10 |
TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres); |
TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT , &resolutionunit); |
size = widtht * heightt; |
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric); |
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &m_photometric); |
TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planar); |
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample); |
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel); |
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &m_samplesperpixel); |
TIFFGetField(tif, TIFFTAG_FILLORDER, &fillorder); |
TIFFGetField(tif, TIFFTAG_MAKE, &scannerMake); |
747,12 → 747,12 |
m_imageInfoRecord.valid = (m_imageInfoRecord.PDSpathData.size())>0?true:false; |
if (thumbnail) |
{ |
if (photometric == PHOTOMETRIC_SEPARATED) |
if (m_photometric == PHOTOMETRIC_SEPARATED) |
{ |
isCMYK = true; |
m_imageInfoRecord.colorspace = ColorSpaceCMYK; |
} |
else if (samplesperpixel == 1) |
else if (m_samplesperpixel == 1) |
{ |
m_imageInfoRecord.colorspace = ColorSpaceGray; |
isCMYK = false; |
837,13 → 837,13 |
fakeHeader.height = heightt; |
fakeHeader.channel_count = numChannels; |
fakeHeader.depth = 8; |
if (photometric == PHOTOMETRIC_SEPARATED) |
if (m_photometric == PHOTOMETRIC_SEPARATED) |
{ |
isCMYK = true; |
fakeHeader.color_mode = CM_CMYK; |
chans = 5; |
} |
else if (samplesperpixel == 1) |
else if (m_samplesperpixel == 1) |
{ |
fakeHeader.color_mode = CM_GRAYSCALE; |
isCMYK = false; |
886,12 → 886,12 |
if ((!foundPS) || (failedPS)) |
{ |
int chans = 4; |
if (photometric == PHOTOMETRIC_SEPARATED) |
if (m_photometric == PHOTOMETRIC_SEPARATED) |
{ |
if (samplesperpixel > 5) |
if (m_samplesperpixel > 5) |
chans = 4; |
else |
chans = samplesperpixel; |
chans = m_samplesperpixel; |
} |
else |
chans = 4; |
912,7 → 912,7 |
} |
tmpImg.fill(0); |
if (!getImageData(tif, &tmpImg, widtht, heightt, size, photometric, bitspersample, samplesperpixel, bilevel, isCMYK)) |
if (!getImageData(tif, &tmpImg, widtht, heightt, size, m_photometric, bitspersample, m_samplesperpixel, bilevel, isCMYK)) |
{ |
TIFFClose(tif); |
return false; |
994,7 → 994,7 |
m_imageInfoRecord.colorspace = ColorSpaceCMYK; |
m_pixelFormat = (r_image.channels() == 5) ? Format_CMYKA_8 : Format_CMYK_8; |
} |
else if (samplesperpixel == 1) |
else if (m_samplesperpixel == 1) |
{ |
// Do not set m_pixelFormat here as the real pixel format is most probably different than gray |
if (bitspersample == 1) |
1500,7 → 1500,7 |
layOpa = m_imageInfoRecord.RequestProps[layer].opacity; |
for (int l = 0; l < r2_image.height(); l++) |
{ |
srand(random_table[ l % 4096]); |
srand(m_random_table[ l % 4096]); |
for (int k = 0; k < r2_image.width(); k++) |
{ |
int rand_val = rand() & 0xff; |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.h |
---|
29,8 → 29,8 |
}; |
void initSupportedFormatList(); |
int getLayers(const QString& fn, int page); |
bool getImageData(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16 photometric, uint16 bitspersample, uint16 samplesperpixel, bool &bilevel, bool &isCMYK); |
bool getImageData_RGBA(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16 bitspersample, uint16 samplesperpixel); |
bool getImageData(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16 m_photometric, uint16 bitspersample, uint16 m_samplesperpixel, bool &bilevel, bool &isCMYK); |
bool getImageData_RGBA(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, uint16 bitspersample, uint16 m_samplesperpixel); |
void blendOntoTarget(RawImage *tmp, int layOpa, QString layBlend, bool cmyk, bool useMask); |
QString getLayerString(QDataStream & s); |
bool loadChannel( QDataStream & s, const PSDHeader & header, QList<PSDLayer> &layerInfo, uint layer, int channel, int component, RawImage &tmpImg); |
40,8 → 40,8 |
bool testAlphaChannelAvailability(const QString& fn, int page, bool& hasAlpha); |
void unmultiplyRGBA(RawImage *image); |
int random_table[4096]; |
uint16 photometric, samplesperpixel; |
int m_random_table[4096]; |
uint16 m_photometric, m_samplesperpixel; |
public: |
ScImgDataLoader_TIFF(void); |
/trunk/Scribus/scribus/localemgr.cpp |
---|
54,7 → 54,7 |
void LocaleManager::init() |
{ |
sysLocale=QLocale::system(); |
m_sysLocale=QLocale::system(); |
// qDebug()<<"language:"<<QLocale::languageToString(sysLocale.language()); |
// qDebug()<<"measurement:"<<sysLocale.measurementSystem(); |
// qDebug()<<"bcp47name:"<<sysLocale.bcp47Name(); |
66,24 → 66,24 |
{ |
//Build table; |
//No, we don't translate these, they are internal use that don't get to the GUI |
localeTable.clear(); |
localeTable.append(LocaleDef("default","mm", "A4" )); |
localeTable.append(LocaleDef("en", "in", "Letter")); |
localeTable.append(LocaleDef("en_AU", "mm", "A4" )); |
localeTable.append(LocaleDef("en_GB", "mm", "A4" )); |
localeTable.append(LocaleDef("en_US", "in", "Letter")); |
localeTable.append(LocaleDef("fr", "mm", "A4" )); |
localeTable.append(LocaleDef("fr_QC", "pica", "Letter")); |
m_localeTable.clear(); |
m_localeTable.append(LocaleDef("default","mm", "A4" )); |
m_localeTable.append(LocaleDef("en", "in", "Letter")); |
m_localeTable.append(LocaleDef("en_AU", "mm", "A4" )); |
m_localeTable.append(LocaleDef("en_GB", "mm", "A4" )); |
m_localeTable.append(LocaleDef("en_US", "in", "Letter")); |
m_localeTable.append(LocaleDef("fr", "mm", "A4" )); |
m_localeTable.append(LocaleDef("fr_QC", "pica", "Letter")); |
} |
void LocaleManager::printSelectedForLocale(const QString& locale) |
{ |
QString selectedLocale(locale); |
for (int i = 0; i < localeTable.size(); ++i) |
for (int i = 0; i < m_localeTable.size(); ++i) |
{ |
if (localeTable[i].m_locale==selectedLocale) |
if (m_localeTable[i].m_locale==selectedLocale) |
{ |
qDebug()<<localeTable[i].m_locale.leftJustified(6) << ": " << localeTable[i].m_unit << ": " << localeTable[i].m_pageSize; |
qDebug()<<m_localeTable[i].m_locale.leftJustified(6) << ": " << m_localeTable[i].m_unit << ": " << m_localeTable[i].m_pageSize; |
return; |
} |
} |
90,11 → 90,11 |
qDebug()<<"No definition for locale: "<<selectedLocale; |
selectedLocale="default"; |
for (int i = 0; i < localeTable.size(); ++i) |
for (int i = 0; i < m_localeTable.size(); ++i) |
{ |
if (localeTable[i].m_locale==selectedLocale) |
if (m_localeTable[i].m_locale==selectedLocale) |
{ |
qDebug()<<localeTable[i].m_locale.leftJustified(6) << ": " << localeTable[i].m_unit << ": " << localeTable[i].m_pageSize; |
qDebug()<<m_localeTable[i].m_locale.leftJustified(6) << ": " << m_localeTable[i].m_unit << ": " << m_localeTable[i].m_pageSize; |
return; |
} |
} |
103,15 → 103,15 |
QString LocaleManager::pageSizeForLocale(const QString& locale) |
{ |
QString selectedLocale(locale); |
for (int i = 0; i < localeTable.size(); ++i) |
for (int i = 0; i < m_localeTable.size(); ++i) |
{ |
if (localeTable[i].m_locale==selectedLocale) |
return localeTable[i].m_pageSize; |
if (m_localeTable[i].m_locale==selectedLocale) |
return m_localeTable[i].m_pageSize; |
} |
//qDebug()<<"No definition for locale: "<<selectedLocale; |
//No, we don't translate these, they are internal use that don't get to the GUI |
if (sysLocale.measurementSystem()==0) |
if (m_sysLocale.measurementSystem()==0) |
return "A4"; |
else |
return "Letter"; |
122,14 → 122,14 |
QString LocaleManager::unitForLocale(const QString &locale) |
{ |
QString selectedLocale(locale); |
for (int i = 0; i < localeTable.size(); ++i) |
for (int i = 0; i < m_localeTable.size(); ++i) |
{ |
if (localeTable[i].m_locale==selectedLocale) |
return localeTable[i].m_unit; |
if (m_localeTable[i].m_locale==selectedLocale) |
return m_localeTable[i].m_unit; |
} |
//qDebug()<<"No definition for locale: "<<selectedLocale; |
//No, we don't translate these, they are internal use that don't get to the GUI |
if (sysLocale.measurementSystem()==0) |
if (m_sysLocale.measurementSystem()==0) |
return "mm"; |
else |
return "in"; |
139,7 → 139,7 |
LocaleManager::~LocaleManager() |
{ |
localeTable.clear(); |
m_localeTable.clear(); |
} |
/trunk/Scribus/scribus/localemgr.h |
---|
69,8 → 69,8 |
private: |
static LocaleManager* m_instance; |
QList <LocaleDef> localeTable; |
QLocale sysLocale; |
QList <LocaleDef> m_localeTable; |
QLocale m_sysLocale; |
void generateLocaleList(); |
}; |
/trunk/Scribus/scribus/notesstyles.cpp |
---|
12,13 → 12,13 |
bool NotesStyle::operator!=(const NotesStyle& n2) |
{ |
return ((nameStr != n2.nameStr) || (startNum != n2.startNum) || (m_endNotesStyle != n2.m_endNotesStyle) || |
(getType() != static_cast<NotesStyle>(n2).getType()) || (numRange != n2.numRange) || |
(prefixStr != n2.prefixStr) || (suffixStr != n2.suffixStr) || |
(autoNotesHeight != n2.autoNotesHeight) || (autoNotesWidth != n2.autoNotesWidth) || |
(autoRemoveEmptyNotesFrames != n2.autoRemoveEmptyNotesFrames) || (autoWeldNotesFrames != n2.autoWeldNotesFrames) || |
(superscriptInMaster != n2.superscriptInMaster) || (superscriptInNote != n2.superscriptInNote) || |
(marksCharStyle != n2.marksCharStyle) || (notesParaStyle != n2.notesParaStyle) |
return ((m_nameStr != n2.m_nameStr) || (m_startNum != n2.m_startNum) || (m_endNotesStyle != n2.m_endNotesStyle) || |
(getType() != static_cast<NotesStyle>(n2).getType()) || (m_numRange != n2.m_numRange) || |
(m_prefixStr != n2.m_prefixStr) || (m_suffixStr != n2.m_suffixStr) || |
(m_autoNotesHeight != n2.m_autoNotesHeight) || (m_autoNotesWidth != n2.m_autoNotesWidth) || |
(m_autoRemoveEmptyNotesFrames != n2.m_autoRemoveEmptyNotesFrames) || (m_autoWeldNotesFrames != n2.m_autoWeldNotesFrames) || |
(m_superscriptInMaster != n2.m_superscriptInMaster) || (m_superscriptInNote != n2.m_superscriptInNote) || |
(m_marksCharStyle != n2.m_marksCharStyle) || (m_notesParaStyle != n2.m_notesParaStyle) |
); |
} |
/trunk/Scribus/scribus/notesstyles.h |
---|
28,64 → 28,64 |
class SCRIBUS_API NotesStyle |
{ |
public: |
NotesStyle() : nameStr ("Default"), startNum(1), m_endNotesStyle(false), numeration(), numRange(NSRdocument), prefixStr(""), suffixStr(")"), |
autoNotesHeight(true), autoNotesWidth(true), autoRemoveEmptyNotesFrames(true), autoWeldNotesFrames(true), |
superscriptInNote(true), superscriptInMaster(true), marksCharStyle(""), notesParaStyle("") {} |
NotesStyle() : m_nameStr ("Default"), m_startNum(1), m_endNotesStyle(false), m_numeration(), m_numRange(NSRdocument), m_prefixStr(""), m_suffixStr(")"), |
m_autoNotesHeight(true), m_autoNotesWidth(true), m_autoRemoveEmptyNotesFrames(true), m_autoWeldNotesFrames(true), |
m_superscriptInNote(true), m_superscriptInMaster(true), m_marksCharStyle(""), m_notesParaStyle("") {} |
~NotesStyle() {} |
bool operator!=(const NotesStyle& n2); |
QString name() const { return nameStr; } |
void setName(const QString s) { nameStr = s; } |
int start() const { return startNum; } |
void setStart(const int i) { startNum = i; } |
void setRange(NumerationRange ns) { numRange = ns; } |
const NumerationRange& range() const { return numRange; } |
QString prefix() const { return prefixStr; } |
void setPrefix (const QString str) { prefixStr = str; } |
QString suffix() const { return suffixStr; } |
void setSuffix (const QString str) { suffixStr = str; } |
QString name() const { return m_nameStr; } |
void setName(const QString s) { m_nameStr = s; } |
int start() const { return m_startNum; } |
void setStart(const int i) { m_startNum = i; } |
void setRange(NumerationRange ns) { m_numRange = ns; } |
const NumerationRange& range() const { return m_numRange; } |
QString prefix() const { return m_prefixStr; } |
void setPrefix (const QString str) { m_prefixStr = str; } |
QString suffix() const { return m_suffixStr; } |
void setSuffix (const QString str) { m_suffixStr = str; } |
QString numString(const int num) const { return numeration.numString(num); } |
void setType(const NumFormat type) { numeration.numFormat = type; } |
const NumFormat& getType() const { return numeration.numFormat; } |
QString numString(const int num) const { return m_numeration.numString(num); } |
void setType(const NumFormat type) { m_numeration.numFormat = type; } |
const NumFormat& getType() const { return m_numeration.numFormat; } |
bool isEndNotes() const { return m_endNotesStyle; } |
bool isAutoNotesHeight() const { return autoNotesHeight; } |
void setAutoNotesHeight(bool set) { autoNotesHeight = set; } |
bool isAutoNotesWidth() const { return autoNotesWidth; } |
void setAutoNotesWidth(bool set) { autoNotesWidth = set; } |
bool isAutoRemoveEmptyNotesFrames() const { return autoRemoveEmptyNotesFrames; } |
void setAutoRemoveEmptyNotesFrames(bool set) { autoRemoveEmptyNotesFrames = set; } |
bool isAutoWeldNotesFrames() const { return autoWeldNotesFrames; } |
void setAutoWeldNotesFrames(bool set) { autoWeldNotesFrames = set; } |
bool isSuperscriptInNote() const { return superscriptInNote; } |
void setSuperscriptInNote(bool set) { superscriptInNote = set; } |
bool isSuperscriptInMaster() const { return superscriptInMaster; } |
void setSuperscriptInMaster(bool set) { superscriptInMaster = set; } |
const QString marksChStyle() const { return marksCharStyle; } |
void setMarksCharStyle(const QString styleName) { marksCharStyle = styleName; } |
const QString notesParStyle() const { return notesParaStyle; } |
void setNotesParStyle(const QString styleName) { notesParaStyle = styleName; } |
bool isAutoNotesHeight() const { return m_autoNotesHeight; } |
void setAutoNotesHeight(bool set) { m_autoNotesHeight = set; } |
bool isAutoNotesWidth() const { return m_autoNotesWidth; } |
void setAutoNotesWidth(bool set) { m_autoNotesWidth = set; } |
bool isAutoRemoveEmptyNotesFrames() const { return m_autoRemoveEmptyNotesFrames; } |
void setAutoRemoveEmptyNotesFrames(bool set) { m_autoRemoveEmptyNotesFrames = set; } |
bool isAutoWeldNotesFrames() const { return m_autoWeldNotesFrames; } |
void setAutoWeldNotesFrames(bool set) { m_autoWeldNotesFrames = set; } |
bool isSuperscriptInNote() const { return m_superscriptInNote; } |
void setSuperscriptInNote(bool set) { m_superscriptInNote = set; } |
bool isSuperscriptInMaster() const { return m_superscriptInMaster; } |
void setSuperscriptInMaster(bool set) { m_superscriptInMaster = set; } |
const QString marksChStyle() const { return m_marksCharStyle; } |
void setMarksCharStyle(const QString styleName) { m_marksCharStyle = styleName; } |
const QString notesParStyle() const { return m_notesParaStyle; } |
void setNotesParStyle(const QString styleName) { m_notesParaStyle = styleName; } |
void setEndNotes(bool); |
private: |
QString nameStr; //unique name of notes style |
int startNum; //numeration starts with that number |
QString m_nameStr; //unique name of notes style |
int m_startNum; //numeration starts with that number |
bool m_endNotesStyle; //if not true this is set of footnotes |
Numeration numeration; |
NumerationRange numRange; //range of numeration for current set |
QString prefixStr; |
QString suffixStr; |
bool autoNotesHeight; //change height of notes frames to its content automaticaly? |
bool autoNotesWidth; //change width of notes frames automaticaly if width of master frame changes? |
bool autoRemoveEmptyNotesFrames; |
bool autoWeldNotesFrames; |
bool superscriptInNote; |
bool superscriptInMaster; |
QString marksCharStyle; |
QString notesParaStyle; |
Numeration m_numeration; |
NumerationRange m_numRange; //range of numeration for current set |
QString m_prefixStr; |
QString m_suffixStr; |
bool m_autoNotesHeight; //change height of notes frames to its content automaticaly? |
bool m_autoNotesWidth; //change width of notes frames automaticaly if width of master frame changes? |
bool m_autoRemoveEmptyNotesFrames; |
bool m_autoWeldNotesFrames; |
bool m_superscriptInNote; |
bool m_superscriptInMaster; |
QString m_marksCharStyle; |
QString m_notesParaStyle; |
}; |
class SCRIBUS_API TextNote : public QObject |
/trunk/Scribus/scribus/pageitem_textframe.cpp |
---|
302,30 → 302,30 |
return; |
QString newShadow = m_Doc->masterPageMode() ? OnMasterPage : QString::number(OwnPage); |
if (newShadow != currentShadow) { |
if (currentShadow == OnMasterPage) { |
if (newShadow != m_currentShadow) { |
if (m_currentShadow == OnMasterPage) { |
// masterpage was edited, clear all shadows |
shadows.clear(); |
m_shadows.clear(); |
} |
if (!shadows.contains(newShadow)) { |
if (!shadows.contains(OnMasterPage)) { |
shadows[OnMasterPage] = itemText; |
if (!m_shadows.contains(newShadow)) { |
if (!m_shadows.contains(OnMasterPage)) { |
m_shadows[OnMasterPage] = itemText; |
// const ParagraphStyle& pstyle(shadows[OnMasterPage].paragraphStyle(0)); |
// qDebug() << QString("Pageitem_Textframe: style of master: %1 align=%2").arg(pstyle.parent()).arg(pstyle.alignment()); |
// qDebug() << QString("Pageitem_Textframe: shadow itemText->%1").arg(OnMasterPage); |
} |
if (newShadow != OnMasterPage) { |
shadows[newShadow] = shadows[OnMasterPage].copy(); |
m_shadows[newShadow] = m_shadows[OnMasterPage].copy(); |
// const ParagraphStyle& pstyle(shadows[newShadow].paragraphStyle(0)); |
// qDebug() << QString("Pageitem_Textframe: style of shadow copy: %1 align=%2").arg(pstyle.parent()).arg(pstyle.alignment()); |
} |
// qDebug() << QString("Pageitem_Textframe: shadow %1<-%2").arg(newShadow).arg(OnMasterPage); |
} |
itemText = shadows[newShadow]; |
itemText = m_shadows[newShadow]; |
// const ParagraphStyle& pstyle(itemText.paragraphStyle(0)); |
// qDebug() << QString("Pageitem_Textframe: style of shadow: %1 align=%2").arg(pstyle.parent()).arg(pstyle.alignment()); |
invalid = true; |
currentShadow = newShadow; |
m_currentShadow = newShadow; |
} |
} |
/* |
/trunk/Scribus/scribus/pageitem_textframe.h |
---|
116,8 → 116,8 |
QList<int> incompletePositions; |
void setShadow(); |
QString currentShadow; |
QMap<QString,StoryText> shadows; |
QString m_currentShadow; |
QMap<QString,StoryText> m_shadows; |
bool checkKeyIsShortcut(QKeyEvent *k); |
QRectF m_origAnnotPos; |
/trunk/Scribus/scribus/pagesize.cpp |
---|
35,9 → 35,9 |
bool valuesSet=false; |
generateSizeList(); |
//Build based on untranslated key value |
if (pageSizeList.contains(sizeName)) |
if (m_pageSizeList.contains(sizeName)) |
{ |
PageSizeInfoMap::Iterator it = pageSizeList.find(sizeName); |
PageSizeInfoMap::Iterator it = m_pageSizeList.find(sizeName); |
m_pageSizeName=it.key(); |
m_width=it.value().width; |
m_height=it.value().height; |
48,7 → 48,7 |
else //build based on translated value. |
{ |
PageSizeInfoMap::Iterator it; |
for (it=pageSizeList.begin();it!=pageSizeList.end() && valuesSet!=true;++it) |
for (it=m_pageSizeList.begin();it!=m_pageSizeList.end() && valuesSet!=true;++it) |
{ |
if (sizeName==it.value().trSizeName) |
{ |
85,7 → 85,7 |
QStringList pageSizes; |
pageSizes.clear(); |
PageSizeInfoMap::ConstIterator it; |
for (it=pageSizeList.begin();it!=pageSizeList.end();++it) |
for (it=m_pageSizeList.begin();it!=m_pageSizeList.end();++it) |
pageSizes.append(it.key()); |
return QStringList(pageSizes); |
} |
95,7 → 95,7 |
QStringList pageSizes; |
pageSizes.clear(); |
PageSizeInfoMap::ConstIterator it; |
for (it=pageSizeList.begin();it!=pageSizeList.end();++it) |
for (it=m_pageSizeList.begin();it!=m_pageSizeList.end();++it) |
pageSizes.append(it.value().trSizeName); |
return QStringList(pageSizes); |
} |
172,13 → 172,13 |
info.height = mm2pts(2378.0); |
info.pageUnitIndex = SC_MM; |
info.trSizeName = QObject::tr("4A0"); |
pageSizeList.insert("4A0", info); |
m_pageSizeList.insert("4A0", info); |
//2A0 |
info.width = mm2pts(1189.0); |
info.height = mm2pts(1682.0); |
info.pageUnitIndex = SC_MM; |
info.trSizeName = QObject::tr("2A0"); |
pageSizeList.insert("2A0", info); |
m_pageSizeList.insert("2A0", info); |
//Continue with rest of A series |
// do not use the formula below, as it is correct in theory, |
// but due to rounding errors it gives incorrect results. |
206,7 → 206,7 |
info.pageUnitIndex = SC_MM; |
name = QString("A%1").arg(format); |
info.trSizeName = name; |
pageSizeList.insert(name, info); |
m_pageSizeList.insert(name, info); |
} |
/* B series */ |
221,7 → 221,7 |
info.pageUnitIndex=SC_MM; |
name = QString("B%1").arg(format); |
info.trSizeName = name; |
pageSizeList.insert(name, info); |
m_pageSizeList.insert(name, info); |
} |
/* C series */ |
Awidths.clear(); |
235,7 → 235,7 |
info.pageUnitIndex=SC_MM; |
name = QString("C%1").arg(format); |
info.trSizeName = name; |
pageSizeList.insert(name, info); |
m_pageSizeList.insert(name, info); |
} |
/* |
width = 1000.0; |
280,7 → 280,7 |
info.pageUnitIndex=SC_MM; |
name=QString("PA%1").arg(format); |
info.trSizeName=name; |
pageSizeList.insert(name, info); |
m_pageSizeList.insert(name, info); |
tmp = height; |
height = width; |
width = floor(tmp / 2.0); |
306,7 → 306,7 |
info.height=in2pts(impHeights[i]); |
info.pageUnitIndex=SC_IN; |
info.trSizeName=impTrNames[i]; |
pageSizeList.insert(impNames[i], info); |
m_pageSizeList.insert(impNames[i], info); |
} |
//Comm10E |
info.width=in2pts(4.125); |
313,13 → 313,13 |
info.height=in2pts(9.5); |
info.pageUnitIndex=SC_IN; |
info.trSizeName=QObject::tr("Comm10E"); |
pageSizeList.insert("Comm10E", info); |
m_pageSizeList.insert("Comm10E", info); |
//DLE |
info.width=mm2pts(110); |
info.height=mm2pts(220); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("DLE"); |
pageSizeList.insert("DLE", info); |
m_pageSizeList.insert("DLE", info); |
// additional page sizes used by Viva Designer |
//Compact Disc |
info.width=mm2pts(119.9); |
326,31 → 326,31 |
info.height=mm2pts(120.7); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("Compact Disc"); |
pageSizeList.insert("Compact Disc", info); |
m_pageSizeList.insert("Compact Disc", info); |
//Letter Half |
info.width=mm2pts(139.7); |
info.height=mm2pts(215.9); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("Letter Half"); |
pageSizeList.insert("Letter Half", info); |
m_pageSizeList.insert("Letter Half", info); |
//US Letter |
info.width=mm2pts(215.9); |
info.height=mm2pts(279.4); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("US Letter"); |
pageSizeList.insert("US Letter", info); |
m_pageSizeList.insert("US Letter", info); |
//US Legal |
info.width=mm2pts(215.9); |
info.height=mm2pts(355.6); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("US Legal"); |
pageSizeList.insert("US Legal", info); |
m_pageSizeList.insert("US Legal", info); |
//11x17 |
info.width=in2pts(11); |
info.height=in2pts(17); |
info.pageUnitIndex=SC_IN; |
info.trSizeName=QObject::tr("11x17"); |
pageSizeList.insert("11x17", info); |
m_pageSizeList.insert("11x17", info); |
//Executive |
//Folio |
//Ledger |
362,7 → 362,7 |
void PageSize::printSizeList() |
{ |
PageSizeInfoMap::Iterator it; |
for (it=pageSizeList.begin();it!=pageSizeList.end();++it) |
for (it=m_pageSizeList.begin();it!=m_pageSizeList.end();++it) |
std::cout << it.key().leftJustified(6).toStdString() << ": " << it.value().width << " x " << it.value().height << ", " << it.value().width*unitGetRatioFromIndex(it.value().pageUnitIndex) << " x " << it.value().height*unitGetRatioFromIndex(it.value().pageUnitIndex) << ", " << it.value().trSizeName.toStdString() << std::endl; |
} |
/trunk/Scribus/scribus/pagesize.h |
---|
59,7 → 59,7 |
QStringList untransPageSizeList(const QStringList &transList); |
private: |
QMap<QString, PageSizeInfo > pageSizeList; |
QMap<QString, PageSizeInfo > m_pageSizeList; |
double m_width; |
double m_height; |
int m_pageUnitIndex; |
/trunk/Scribus/scribus/pdflib.cpp |
---|
3,28 → 3,28 |
#include "pdflib_core.h" |
PDFlib::PDFlib(ScribusDoc & docu) |
: impl( new PDFLibCore(docu) ) |
: m_impl( new PDFLibCore(docu) ) |
{ |
Q_ASSERT(impl); |
Q_ASSERT(m_impl); |
} |
PDFlib::~PDFlib() |
{ |
delete static_cast<PDFLibCore*>(impl); |
delete static_cast<PDFLibCore*>(m_impl); |
} |
bool PDFlib::doExport(const QString& fn, const QString& nam, int Components, |
const std::vector<int> & pageNs, const QMap<int,QPixmap> & thumbs) |
{ |
return static_cast<PDFLibCore*>(impl)->doExport(fn, nam, Components, pageNs, thumbs); |
return static_cast<PDFLibCore*>(m_impl)->doExport(fn, nam, Components, pageNs, thumbs); |
} |
const QString& PDFlib::errorMessage(void) |
{ |
return static_cast<PDFLibCore*>(impl)->errorMessage(); |
return static_cast<PDFLibCore*>(m_impl)->errorMessage(); |
} |
bool PDFlib::exportAborted(void) |
{ |
return static_cast<PDFLibCore*>(impl)->exportAborted(); |
return static_cast<PDFLibCore*>(m_impl)->exportAborted(); |
} |
/trunk/Scribus/scribus/pdflib.h |
---|
65,7 → 65,7 |
private: |
/// A pointer to the real implementation of pdflib . |
void* impl; |
void* m_impl; |
}; |
#endif |
/trunk/Scribus/scribus/pdfwriter.cpp |
---|
452,14 → 452,14 |
MetaDataObj = 0; |
ResourcesObj = 0; |
CurrentObj = 0; |
m_CurrentObj = 0; |
KeyLen = 5; |
KeyGen.resize(32); |
OwnerKey.resize(32); |
UserKey.resize(32); |
FileID.resize(16); |
EncryKey.resize(5); |
m_KeyLen = 5; |
m_KeyGen.resize(32); |
m_OwnerKey.resize(32); |
m_UserKey.resize(32); |
m_FileID.resize(16); |
m_EncryKey.resize(5); |
int kg_array[] = { |
0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, |
467,7 → 467,7 |
0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, |
0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a }; |
for (int a = 0; a < 32; ++a) |
KeyGen[a] = kg_array[a]; |
m_KeyGen[a] = kg_array[a]; |
} |
474,11 → 474,11 |
bool Writer::open(const QString& fn) |
{ |
Spool.setFileName(fn); |
if (!Spool.open(QIODevice::WriteOnly)) |
m_Spool.setFileName(fn); |
if (!m_Spool.open(QIODevice::WriteOnly)) |
return false; |
outStream.setDevice(&Spool); |
ObjCounter = 9; |
m_outStream.setDevice(&m_Spool); |
m_ObjCounter = 9; |
return true; |
} |
487,12 → 487,12 |
{ |
if (encrypted) |
{ |
QByteArray step1 = ComputeRC4Key(ObjCounter); |
return new ScRC4EncodeFilter(&outStream, step1.data(), qMin(KeyLen+5, 16)); |
QByteArray step1 = ComputeRC4Key(m_ObjCounter); |
return new ScRC4EncodeFilter(&m_outStream, step1.data(), qMin(m_KeyLen+5, 16)); |
} |
else |
{ |
return new ScNullEncodeFilter(&outStream); |
return new ScNullEncodeFilter(&m_outStream); |
} |
} |
499,13 → 499,13 |
bool Writer::close(bool abortExport) |
{ |
bool result = (Spool.error() == QFile::NoError); |
bool result = (m_Spool.error() == QFile::NoError); |
Spool.close(); |
m_Spool.close(); |
if (abortExport || !result) |
{ |
if (Spool.exists()) |
Spool.remove(); |
if (m_Spool.exists()) |
m_Spool.remove(); |
} |
return result; |
} |
513,7 → 513,7 |
void Writer::setFileId(const QByteArray& id) |
{ |
FileID = QCryptographicHash::hash(id, QCryptographicHash::Md5); |
m_FileID = QCryptographicHash::hash(id, QCryptographicHash::Md5); |
} |
523,24 → 523,24 |
QByteArray uk = ""; |
if (keyLen16) |
KeyLen = 16; |
m_KeyLen = 16; |
else |
KeyLen = 5; |
m_KeyLen = 5; |
CalcOwnerKey(PassOwner, PassUser); |
CalcUserKey(PassUser, Permissions); |
for (uint cl2 = 0; cl2 < 32; ++cl2) |
ok += (OwnerKey[cl2]); |
ok += (m_OwnerKey[cl2]); |
if (keyLen16) |
{ |
for (uint cl3 = 0; cl3 < 16; ++cl3) |
uk += (UserKey[cl3]); |
uk += (m_UserKey[cl3]); |
for (uint cl3r = 0; cl3r < 16; ++cl3r) |
uk += (KeyGen[cl3r]); |
uk += (m_KeyGen[cl3r]); |
} |
else |
{ |
for (uint cl = 0; cl < 32; ++cl) |
uk += (UserKey[cl]); |
uk += (m_UserKey[cl]); |
} |
EncryptObj = newObject(); |
562,7 → 562,7 |
if (in.length() > 0) |
{ |
QByteArray step1 = ComputeRC4Key(ObjNum); |
rc4_init(&rc4, reinterpret_cast<uchar*>(step1.data()), qMin(KeyLen+5, 16)); |
rc4_init(&rc4, reinterpret_cast<uchar*>(step1.data()), qMin(m_KeyLen+5, 16)); |
rc4_encrypt(&rc4, reinterpret_cast<const uchar*>(in.data()), reinterpret_cast<uchar*>(result.data()), in.length()); |
} |
return result; |
572,11 → 572,11 |
{ |
int dlen = 0; |
QByteArray data(10, ' '); |
if (KeyLen > 5) |
if (m_KeyLen > 5) |
data.resize(21); |
for (int cd = 0; cd < KeyLen; ++cd) |
for (int cd = 0; cd < m_KeyLen; ++cd) |
{ |
data[cd] = EncryKey[cd]; |
data[cd] = m_EncryKey[cd]; |
dlen++; |
} |
data[dlen++] = ObjNum; |
586,7 → 586,7 |
data[dlen++] = 0; |
QByteArray rc4Key(16, ' '); |
rc4Key = QCryptographicHash::hash(data, QCryptographicHash::Md5); |
rc4Key.resize(qMin(KeyLen+5, 16)); |
rc4Key.resize(qMin(m_KeyLen+5, 16)); |
return rc4Key; |
} |
598,7 → 598,7 |
{ |
uint l = pw.length(); |
for (uint a = 0; a < 32 - l; ++a) |
pw += (KeyGen[a]); |
pw += (m_KeyGen[a]); |
} |
else |
pw = pw.left(32); |
612,7 → 612,7 |
QByteArray pw2(FitKey(Owner.isEmpty() ? User : Owner)); |
QByteArray step1(16, ' '); |
step1 = QCryptographicHash::hash(pw2, QCryptographicHash::Md5); |
if (KeyLen > 5) |
if (m_KeyLen > 5) |
{ |
for (int kl = 0; kl < 50; ++kl) |
step1 = QCryptographicHash::hash(step1, QCryptographicHash::Md5); |
619,17 → 619,17 |
} |
QByteArray us(32, ' '); |
QByteArray enk(16, ' '); |
if (KeyLen > 5) |
if (m_KeyLen > 5) |
{ |
for (uint a2 = 0; a2 < 32; ++a2) |
OwnerKey[a2] = QChar(pw.at(a2)).cell(); |
m_OwnerKey[a2] = QChar(pw.at(a2)).cell(); |
for (int rl = 0; rl < 20; rl++) |
{ |
for (int j = 0; j < 16; j ++) |
enk[j] = step1[j] ^ rl; |
rc4_init(&rc4, reinterpret_cast<uchar*>(enk.data()), 16); |
rc4_encrypt(&rc4, reinterpret_cast<uchar*>(OwnerKey.data()), |
reinterpret_cast<uchar*>(OwnerKey.data()), 32); |
rc4_encrypt(&rc4, reinterpret_cast<uchar*>(m_OwnerKey.data()), |
reinterpret_cast<uchar*>(m_OwnerKey.data()), 32); |
} |
} |
else |
638,7 → 638,7 |
us[a] = static_cast<uchar>(QChar(pw.at(a)).cell()); |
rc4_init(&rc4, reinterpret_cast<uchar*>(step1.data()), 5); |
rc4_encrypt(&rc4, reinterpret_cast<uchar*>(us.data()), |
reinterpret_cast<uchar*>(OwnerKey.data()), 32); |
reinterpret_cast<uchar*>(m_OwnerKey.data()), 32); |
} |
} |
654,43 → 654,43 |
perm[2] = perm_value >> 16; |
perm[3] = perm_value >> 24; |
for (uint a = 0; a < 32; ++a) |
pw += (OwnerKey[a]); |
pw += (m_OwnerKey[a]); |
for (uint a1 = 0; a1 < 4; ++a1) |
pw += (perm[a1]); |
for (uint a3 = 0; a3 < 16; ++a3) |
pw += (FileID[a3]); |
pw += (m_FileID[a3]); |
step1 = QCryptographicHash::hash(pw, QCryptographicHash::Md5); |
if (KeyLen > 5) |
if (m_KeyLen > 5) |
{ |
for (int kl = 0; kl < 50; ++kl) |
step1 = QCryptographicHash::hash(step1, QCryptographicHash::Md5); |
EncryKey.resize(16); |
m_EncryKey.resize(16); |
} |
for (int a2 = 0; a2 < KeyLen; ++a2) |
EncryKey[a2] = step1[a2]; |
if (KeyLen > 5) |
for (int a2 = 0; a2 < m_KeyLen; ++a2) |
m_EncryKey[a2] = step1[a2]; |
if (m_KeyLen > 5) |
{ |
QByteArray pr2(""); |
for (int kl3 = 0; kl3 < 32; ++kl3) |
pr2 += (KeyGen[kl3]); |
pr2 += (m_KeyGen[kl3]); |
for (uint a4 = 0; a4 < 16; ++a4) |
pr2 += (FileID[a4]); |
pr2 += (m_FileID[a4]); |
step1 = QCryptographicHash::hash(pr2, QCryptographicHash::Md5); |
QByteArray enk(16, ' '); |
for (uint a3 = 0; a3 < 16; ++a3) |
UserKey[a3] = step1[a3]; |
m_UserKey[a3] = step1[a3]; |
for (int rl = 0; rl < 20; rl++) |
{ |
for (int j = 0; j < 16; j ++) |
enk[j] = EncryKey[j] ^ rl; |
enk[j] = m_EncryKey[j] ^ rl; |
rc4_init(&rc4, reinterpret_cast<uchar*>(enk.data()), 16); |
rc4_encrypt(&rc4, reinterpret_cast<uchar*>(UserKey.data()), reinterpret_cast<uchar*>(UserKey.data()), 16); |
rc4_encrypt(&rc4, reinterpret_cast<uchar*>(m_UserKey.data()), reinterpret_cast<uchar*>(m_UserKey.data()), 16); |
} |
} |
else |
{ |
rc4_init(&rc4, reinterpret_cast<uchar*>(step1.data()), 5); |
rc4_encrypt(&rc4, reinterpret_cast<uchar*>(KeyGen.data()), reinterpret_cast<uchar*>(UserKey.data()), 32); |
rc4_encrypt(&rc4, reinterpret_cast<uchar*>(m_KeyGen.data()), reinterpret_cast<uchar*>(m_UserKey.data()), 32); |
} |
} |
729,13 → 729,13 |
QByteArray tmp; |
uint StX = bytesWritten(); |
write("xref\n"); |
write("0 "+Pdf::toPdf(ObjCounter)+"\n"); |
write("0 "+Pdf::toPdf(m_ObjCounter)+"\n"); |
//write("0000000000 65535 f \n"); |
for (int a = 0; a < XRef.count(); ++a) |
for (int a = 0; a < m_XRef.count(); ++a) |
{ |
if (XRef[a] > 0) |
if (m_XRef[a] > 0) |
{ |
tmp.setNum(XRef[a]); |
tmp.setNum(m_XRef[a]); |
while (tmp.length()< 10) |
{ |
tmp.prepend('0'); |
749,10 → 749,10 |
write("0000000000 65535 f \n"); |
} |
} |
write("trailer\n<<\n/Size "+Pdf::toPdf(XRef.count())+"\n"); |
write("trailer\n<<\n/Size "+Pdf::toPdf(m_XRef.count())+"\n"); |
QByteArray IDs =""; |
for (uint cl = 0; cl < 16; ++cl) |
IDs += (FileID[cl]); |
IDs += (m_FileID[cl]); |
QByteArray IDbytes = Pdf::toHexString(IDs); |
write("/Root 1 0 R\n/Info 2 0 R\n/ID ["+IDbytes+IDbytes+"]\n"); |
if (EncryptObj > 0) |
764,7 → 764,7 |
void Writer::write(const QByteArray& bytes) |
{ |
outStream.writeRawData(bytes, bytes.size()); |
m_outStream.writeRawData(bytes, bytes.size()); |
} |
void Writer::write(const ResourceDictionary& dict) |
834,18 → 834,18 |
PdfId Writer::reserveObjects(unsigned int n) |
{ |
assert( n < (1<<30) ); // should only be triggered by reserveObjects(-1) or similar |
PdfId result = ObjCounter; |
ObjCounter += n; |
PdfId result = m_ObjCounter; |
m_ObjCounter += n; |
return result; |
} |
void Writer::startObj(PdfId id) |
{ |
assert( CurrentObj == 0); |
CurrentObj = id; |
while (static_cast<uint>(XRef.length()) <= id) |
XRef.append(0); |
XRef[id] = bytesWritten(); |
assert( m_CurrentObj == 0); |
m_CurrentObj = id; |
while (static_cast<uint>(m_XRef.length()) <= id) |
m_XRef.append(0); |
m_XRef[id] = bytesWritten(); |
write(toPdf(id)); |
write(" 0 obj\n"); |
} |
852,14 → 852,14 |
void Writer::endObj(PdfId id) |
{ |
assert( CurrentObj == id); |
CurrentObj = 0; |
assert( m_CurrentObj == id); |
m_CurrentObj = 0; |
write("\nendobj\n"); |
} |
void Writer::endObjectWithStream(bool encrypted, PdfId id, const QByteArray& streamContent) |
{ |
assert( CurrentObj == id); |
assert( m_CurrentObj == id); |
write("\nstream\n"); |
write(encrypted? encryptBytes(streamContent, id): streamContent); |
write("\nendstream"); |
/trunk/Scribus/scribus/pdfwriter.h |
---|
150,9 → 150,9 |
// file handling |
bool open (const QString& filename); |
QDataStream& getOutStream() { return outStream; } |
QDataStream& getOutStream() { return m_outStream; } |
bool close(bool aborted); |
qint64 bytesWritten() { return Spool.pos(); } |
qint64 bytesWritten() { return m_Spool.pos(); } |
// encryption |
void setFileId(const QByteArray& id); |
205,20 → 205,20 |
PdfId ResourcesObj; |
private: |
PdfId ObjCounter; |
PdfId CurrentObj; |
PdfId m_ObjCounter; |
PdfId m_CurrentObj; |
QFile Spool; |
QDataStream outStream; |
QFile m_Spool; |
QDataStream m_outStream; |
QList<qint64> XRef; |
QList<qint64> m_XRef; |
QByteArray KeyGen; |
QByteArray OwnerKey; |
QByteArray UserKey; |
QByteArray FileID; |
QByteArray EncryKey; |
int KeyLen; |
QByteArray m_KeyGen; |
QByteArray m_OwnerKey; |
QByteArray m_UserKey; |
QByteArray m_FileID; |
QByteArray m_EncryKey; |
int m_KeyLen; |
}; |
/trunk/Scribus/scribus/prefscontext.cpp |
---|
29,31 → 29,31 |
PrefsContext::PrefsContext() |
{ |
name = ""; |
ispersistent = false; |
isplugin = false; |
m_name = ""; |
m_ispersistent = false; |
m_isplugin = false; |
} |
PrefsContext::PrefsContext(QString contextName, bool persistent, bool plugin) |
{ |
name = contextName; |
ispersistent = persistent; |
isplugin = plugin; |
m_name = contextName; |
m_ispersistent = persistent; |
m_isplugin = plugin; |
} |
QString PrefsContext::getName() |
{ |
return name; |
return m_name; |
} |
bool PrefsContext::isPersistent() |
{ |
return ispersistent; |
return m_ispersistent; |
} |
bool PrefsContext::isPlugin() |
{ |
return isplugin; |
return m_isplugin; |
} |
bool PrefsContext::isEmpty() |
/trunk/Scribus/scribus/prefscontext.h |
---|
40,9 → 40,9 |
class SCRIBUS_API PrefsContext |
{ |
private: |
QString name; |
bool isplugin; |
bool ispersistent; |
QString m_name; |
bool m_isplugin; |
bool m_ispersistent; |
public: |
AttributeMap values; |
TableMap tables; |
67,8 → 67,8 |
void set(const QString& key, double value); |
bool getBool(const QString& key, bool defValue = false); |
void set(const QString& key, bool value); |
PrefsTable* getTable(const QString& name); |
void removeTable(const QString& name); |
PrefsTable* getTable(const QString& m_name); |
void removeTable(const QString& m_name); |
}; |
#endif // PREFSCONTEXTS_H |
/trunk/Scribus/scribus/prefsfile.cpp |
---|
34,15 → 34,15 |
PrefsFile::PrefsFile() |
{ |
prefsFilePath = ""; |
ioEnabled = false; |
m_prefsFilePath = ""; |
m_ioEnabled = false; |
} |
PrefsFile::PrefsFile(const QString& pFilePath, bool write) |
{ |
prefsFilePath = pFilePath; |
ioEnabled = write; |
if (ioEnabled) |
m_prefsFilePath = pFilePath; |
m_ioEnabled = write; |
if (m_ioEnabled) |
canWrite(); |
load(); |
} |
49,34 → 49,34 |
bool PrefsFile::hasContext(const QString& contextName) const |
{ |
return contexts.contains(contextName); |
return m_contexts.contains(contextName); |
} |
PrefsContext* PrefsFile::getContext(const QString& contextName, bool persistent) |
{ |
if (!contexts.contains(contextName)) |
contexts[contextName] = new PrefsContext(contextName, persistent); |
return contexts[contextName]; |
if (!m_contexts.contains(contextName)) |
m_contexts[contextName] = new PrefsContext(contextName, persistent); |
return m_contexts[contextName]; |
} |
PrefsContext* PrefsFile::getPluginContext(const QString& contextName, bool persistent) |
{ |
if (!pluginContexts.contains(contextName)) |
pluginContexts[contextName] = new PrefsContext(contextName, persistent); |
return pluginContexts[contextName]; |
if (!m_pluginContexts.contains(contextName)) |
m_pluginContexts[contextName] = new PrefsContext(contextName, persistent); |
return m_pluginContexts[contextName]; |
} |
PrefsContext* PrefsFile::getUserPrefsContext(const QString& contextName, bool persistent) |
{ |
if (!userprefsContexts.contains(contextName)) |
userprefsContexts[contextName] = new PrefsContext(contextName, persistent); |
return userprefsContexts[contextName]; |
if (!m_userprefsContexts.contains(contextName)) |
m_userprefsContexts[contextName] = new PrefsContext(contextName, persistent); |
return m_userprefsContexts[contextName]; |
} |
void PrefsFile::load() |
{ |
PrefsReader handler(&contexts, &pluginContexts); |
QFile rc(prefsFilePath); |
PrefsReader handler(&m_contexts, &m_pluginContexts); |
QFile rc(m_prefsFilePath); |
QXmlInputSource source(&rc); |
QXmlSimpleReader reader; |
reader.setContentHandler(&handler); |
85,9 → 85,9 |
void PrefsFile::write() |
{ |
if ((!ioEnabled) || ((contexts.size() == 0) && (pluginContexts.size() == 0))) |
if ((!m_ioEnabled) || ((m_contexts.size() == 0) && (m_pluginContexts.size() == 0))) |
return; // No prefs file path set -> can't write or no prefs to write |
QFile* prefsXML = new QFile(prefsFilePath); |
QFile* prefsXML = new QFile(m_prefsFilePath); |
if (prefsXML->open(QIODevice::WriteOnly)) |
{ |
QTextStream stream(prefsXML); |
94,22 → 94,22 |
stream.setCodec("UTF-8"); |
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; |
stream << "<preferences>\n"; |
if (contexts.size() > 0) |
if (m_contexts.size() > 0) |
{ |
stream << "\t<level name=\"application\">\n"; |
writeContexts(&contexts, stream); |
writeContexts(&m_contexts, stream); |
stream << "\t</level>\n"; |
} |
if (userprefsContexts.size() > 0) |
if (m_userprefsContexts.size() > 0) |
{ |
stream << "\t<level name=\"plugin\">\n"; |
writeContexts(&userprefsContexts, stream); |
writeContexts(&m_userprefsContexts, stream); |
stream << "\t</level>\n"; |
} |
if (pluginContexts.size() > 0) |
if (m_pluginContexts.size() > 0) |
{ |
stream << "\t<level name=\"plugin\">\n"; |
writeContexts(&pluginContexts, stream); |
writeContexts(&m_pluginContexts, stream); |
stream << "\t</level>\n"; |
} |
stream << "</preferences>\n"; |
169,17 → 169,17 |
void PrefsFile::canWrite() |
{ |
if (ioEnabled) |
if (m_ioEnabled) |
{ |
QFile f(prefsFilePath); |
QFile f(m_prefsFilePath); |
QFileInfo fi(f); |
if (fi.exists()) |
ioEnabled = fi.isWritable(); |
m_ioEnabled = fi.isWritable(); |
else |
{ |
QFile f2(prefsFilePath.left(prefsFilePath.lastIndexOf("/"))); |
QFile f2(m_prefsFilePath.left(m_prefsFilePath.lastIndexOf("/"))); |
QFileInfo fi2(f2); |
ioEnabled = fi2.isWritable(); |
m_ioEnabled = fi2.isWritable(); |
} |
} |
} |
187,8 → 187,8 |
PrefsFile::~PrefsFile() |
{ |
ContextMap::Iterator it; |
for (it = contexts.begin(); it != contexts.end(); ++it) |
for (it = m_contexts.begin(); it != m_contexts.end(); ++it) |
delete it.value(); |
for (it = pluginContexts.begin(); it != pluginContexts.end(); ++it) |
for (it = m_pluginContexts.begin(); it != m_pluginContexts.end(); ++it) |
delete it.value(); |
} |
/trunk/Scribus/scribus/prefsfile.h |
---|
38,11 → 38,11 |
class SCRIBUS_API PrefsFile |
{ |
private: |
QString prefsFilePath; |
ContextMap contexts; |
ContextMap pluginContexts; |
ContextMap userprefsContexts; |
bool ioEnabled; |
QString m_prefsFilePath; |
ContextMap m_contexts; |
ContextMap m_pluginContexts; |
ContextMap m_userprefsContexts; |
bool m_ioEnabled; |
void load(); |
QString replaceIllegalChars(const QString& text); |
void writeContexts(ContextMap* contextMap, QTextStream& stream); |
/trunk/Scribus/scribus/prefsmanager.cpp |
---|
68,7 → 68,7 |
PrefsManager::PrefsManager(QObject *parent) |
: QObject(parent), |
firstTimeIgnoreOldPrefs(false) |
m_firstTimeIgnoreOldPrefs(false) |
{ |
} |
111,7 → 111,7 |
bool PrefsManager::importingFrom12x() |
{ |
return importingFrom12; |
return m_importingFrom12; |
} |
119,9 → 119,9 |
{ |
setupPreferencesLocation(); |
importingFrom12=copyOldPreferences(); |
prefsFile = new PrefsFile( prefsLocation + "/prefs150.xml" ); |
if (importingFrom12) |
m_importingFrom12=copyOldPreferences(); |
prefsFile = new PrefsFile( m_prefsLocation + "/prefs150.xml" ); |
if (m_importingFrom12) |
convert12Preferences(); |
//<<CB TODO Reset keyboard shortcuts of all 1.3 users as too many |
// have conflicts if they dont nuke their settings. |
768,7 → 768,7 |
QDir scrapDirectoryT = QDir(); |
scrapDirectoryT.mkdir(QDir::toNativeSeparators(scB+"/tmp")); |
} |
prefsLocation=PrefsPfad; |
m_prefsLocation=PrefsPfad; |
QFileInfo scSwatch = QFileInfo(ScPaths::getApplicationDataDir()+"swatches"); |
if (!scSwatch.exists()) |
{ |
781,7 → 781,7 |
const QString PrefsManager::preferencesLocation() |
{ |
return prefsLocation; |
return m_prefsLocation; |
} |
bool PrefsManager::copyOldPreferences() |
789,18 → 789,18 |
//Now make copies for 1.3 use and leave the old ones alone for <1.3.0 usage |
QString prefs135[4], prefs140[4], prefs150[4]; |
prefs135[0]=QDir::toNativeSeparators(prefsLocation+"/scribus135.rc"); |
prefs135[1]=QDir::toNativeSeparators(prefsLocation+"/scrap135.scs"); |
prefs135[2]=QDir::toNativeSeparators(prefsLocation+"/prefs135.xml"); |
prefs135[3]=QDir::toNativeSeparators(prefsLocation+"/scripter135.rc"); |
prefs140[0]=QDir::toNativeSeparators(prefsLocation+"/scribus140.rc"); |
prefs140[1]=QDir::toNativeSeparators(prefsLocation+"/scrap140.scs"); |
prefs140[2]=QDir::toNativeSeparators(prefsLocation+"/prefs140.xml"); |
prefs140[3]=QDir::toNativeSeparators(prefsLocation+"/scripter140.rc"); |
prefs150[0]=QDir::toNativeSeparators(prefsLocation+"/scribus150.rc"); |
prefs150[1]=QDir::toNativeSeparators(prefsLocation+"/scrap150.scs"); |
prefs150[2]=QDir::toNativeSeparators(prefsLocation+"/prefs150.xml"); |
prefs150[3]=QDir::toNativeSeparators(prefsLocation+"/scripter150.rc"); |
prefs135[0]=QDir::toNativeSeparators(m_prefsLocation+"/scribus135.rc"); |
prefs135[1]=QDir::toNativeSeparators(m_prefsLocation+"/scrap135.scs"); |
prefs135[2]=QDir::toNativeSeparators(m_prefsLocation+"/prefs135.xml"); |
prefs135[3]=QDir::toNativeSeparators(m_prefsLocation+"/scripter135.rc"); |
prefs140[0]=QDir::toNativeSeparators(m_prefsLocation+"/scribus140.rc"); |
prefs140[1]=QDir::toNativeSeparators(m_prefsLocation+"/scrap140.scs"); |
prefs140[2]=QDir::toNativeSeparators(m_prefsLocation+"/prefs140.xml"); |
prefs140[3]=QDir::toNativeSeparators(m_prefsLocation+"/scripter140.rc"); |
prefs150[0]=QDir::toNativeSeparators(m_prefsLocation+"/scribus150.rc"); |
prefs150[1]=QDir::toNativeSeparators(m_prefsLocation+"/scrap150.scs"); |
prefs150[2]=QDir::toNativeSeparators(m_prefsLocation+"/prefs150.xml"); |
prefs150[3]=QDir::toNativeSeparators(m_prefsLocation+"/scripter150.rc"); |
bool existsPrefs135[4], existsPrefs140[4], existsPrefs150[4]; |
for (uint i=0;i<4;++i) |
863,7 → 863,7 |
void PrefsManager::convert12Preferences() |
{ |
// Import 1.2 font search path prefs |
QFile fontPrefsFile12(QDir::toNativeSeparators(prefsLocation+"/scribusfont.rc")); |
QFile fontPrefsFile12(QDir::toNativeSeparators(m_prefsLocation+"/scribusfont.rc")); |
if (fontPrefsFile12.open(QIODevice::ReadOnly)) |
{ |
PrefsContext *pc = prefsFile->getContext("Fonts"); |
881,7 → 881,7 |
{ |
QString realFile; |
if (fname.isEmpty()) |
realFile = prefsLocation + "/scribus150.rc"; |
realFile = m_prefsLocation + "/scribus150.rc"; |
else |
realFile = fname; |
915,7 → 915,7 |
if (appPrefs.uiPrefs.mainWinSettings.maximized) |
mw->setWindowState((ScCore->primaryMainWindow()->windowState() & ~Qt::WindowMinimized) | Qt::WindowMaximized); |
//For 1.3.5, we dump prefs first time around. |
if (!firstTimeIgnoreOldPrefs) |
if (!m_firstTimeIgnoreOldPrefs) |
ReadPrefsXML(); |
if (appPrefs.verifierPrefs.checkerPrefsList.count() == 0) |
{ |
974,7 → 974,7 |
SavePrefsXML(); |
QString realFile; |
if (fname.isNull()) |
realFile = prefsLocation+"/scribus150.rc"; |
realFile = m_prefsLocation+"/scribus150.rc"; |
else |
realFile = fname; |
if (!WritePref(realFile)) |
1070,7 → 1070,7 |
//Changed to return false when we have no fonts |
bool PrefsManager::GetAllFonts(bool showFontInfo) |
{ |
appPrefs.fontPrefs.AvailFonts.GetFonts(prefsLocation, showFontInfo); |
appPrefs.fontPrefs.AvailFonts.GetFonts(m_prefsLocation, showFontInfo); |
return !appPrefs.fontPrefs.AvailFonts.isEmpty(); |
} |
1888,7 → 1888,7 |
if (elem.attribute("VERSION") == "1.5.0") |
prefs150FileFound=true; |
} |
firstTimeIgnoreOldPrefs=!prefs150FileFound; |
m_firstTimeIgnoreOldPrefs=!prefs150FileFound; |
if (!prefs150FileFound) |
return false; |
appPrefs.colorPrefs.DColors.clear(); |
2284,7 → 2284,7 |
appPrefs.colorPrefs.DCMSset.DefaultIntentColors = (eRenderIntent) dc.attribute("DefaultIntentColors", "1").toInt(); |
appPrefs.colorPrefs.DCMSset.DefaultIntentImages = (eRenderIntent) dc.attribute("DefaultIntentImages", "0").toInt(); |
} |
if (!importingFrom12 && dc.tagName()=="Shortcut") |
if (!m_importingFrom12 && dc.tagName()=="Shortcut") |
{ |
appPrefs.keyShortcutPrefs.KeyActions[dc.attribute("Action")].actionName = dc.attribute("Action"); |
QKeySequence newKeySequence = QKeySequence(dc.attribute("KeySequence")); |
/trunk/Scribus/scribus/prefsmanager.h |
---|
215,9 → 215,9 |
*/ |
static PrefsManager* _instance; |
QString prefsLocation; |
bool importingFrom12; |
bool firstTimeIgnoreOldPrefs; |
QString m_prefsLocation; |
bool m_importingFrom12; |
bool m_firstTimeIgnoreOldPrefs; |
/*! \brief The last error message generated by a method of this class. |
Do not write "success" messages to this. */ |
/trunk/Scribus/scribus/prefsreader.cpp |
---|
28,12 → 28,12 |
PrefsReader::PrefsReader(ContextMap *appContexts, ContextMap *pluginContexts) |
{ |
aContexts = appContexts; |
pContexts = pluginContexts; |
inApp = false; |
rowIndex = 0; |
colIndex = 0; |
inTable = false; |
m_aContexts = appContexts; |
m_pContexts = pluginContexts; |
m_inApp = false; |
m_rowIndex = 0; |
m_colIndex = 0; |
m_inTable = false; |
} |
bool PrefsReader::startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs) |
42,7 → 42,7 |
{ |
for (int i = 0; i < attrs.count(); ++i) |
if (attrs.localName(i) == "name") |
currentContext = new PrefsContext(attrs.value(i)); |
m_currentContext = new PrefsContext(attrs.value(i)); |
} |
else if (name == "level") |
{ |
50,7 → 50,7 |
for (int i = 0; i < attrs.count(); ++i) |
if ((attrs.localName(i) == "name") && (attrs.value(i) == "application")) |
found = true; |
inApp = found; |
m_inApp = found; |
} |
else if (name == "attribute") |
{ |
63,7 → 63,7 |
else if (attrs.localName(i) == "value") |
value = attrs.value(i); |
} |
currentContext->set(key, value); |
m_currentContext->set(key, value); |
} |
else if (name == "table") |
{ |
70,11 → 70,11 |
for (int i = 0; i < attrs.count(); ++i) |
{ |
if (attrs.localName(i) == "name") |
currentTable = currentContext->getTable(attrs.value(i)); |
m_currentTable = m_currentContext->getTable(attrs.value(i)); |
} |
} |
else if (name == "col") |
inTable = true; |
m_inTable = true; |
return true; |
} |
81,8 → 81,8 |
bool PrefsReader::characters (const QString& ch) |
{ |
if (inTable) |
currentTable->set(rowIndex, colIndex, ch); |
if (m_inTable) |
m_currentTable->set(m_rowIndex, m_colIndex, ch); |
return true; |
} |
90,25 → 90,25 |
{ |
if (name == "context") |
{ |
if (inApp) |
(*aContexts)[currentContext->getName()] = currentContext; |
if (m_inApp) |
(*m_aContexts)[m_currentContext->getName()] = m_currentContext; |
else |
(*pContexts)[currentContext->getName()] = currentContext; |
(*m_pContexts)[m_currentContext->getName()] = m_currentContext; |
} |
else if (name == "row") |
{ |
++rowIndex; |
colIndex = 0; |
++m_rowIndex; |
m_colIndex = 0; |
} |
else if (name == "col") |
{ |
++colIndex; |
inTable = false; |
++m_colIndex; |
m_inTable = false; |
} |
else if (name == "table") |
{ |
rowIndex = 0; |
colIndex = 0; |
m_rowIndex = 0; |
m_colIndex = 0; |
} |
return true; |
} |
/trunk/Scribus/scribus/prefsreader.h |
---|
40,14 → 40,14 |
class SCRIBUS_API PrefsReader : public QXmlDefaultHandler |
{ |
private: |
ContextMap* aContexts; |
ContextMap* pContexts; |
PrefsContext* currentContext; |
PrefsTable* currentTable; |
bool inApp; |
int rowIndex; |
int colIndex; |
bool inTable; |
ContextMap* m_aContexts; |
ContextMap* m_pContexts; |
PrefsContext* m_currentContext; |
PrefsTable* m_currentTable; |
bool m_inApp; |
int m_rowIndex; |
int m_colIndex; |
bool m_inTable; |
public: |
PrefsReader(ContextMap *appContexts, ContextMap *pluginContexts); |
~PrefsReader(); |
/trunk/Scribus/scribus/prefstable.cpp |
---|
28,43 → 28,43 |
PrefsTable::PrefsTable(QString tableName) |
{ |
name = tableName; |
rowCount = 0; |
colCount = 0; |
m_name = tableName; |
m_rowCount = 0; |
m_colCount = 0; |
} |
QString PrefsTable::getName() |
{ |
return name; |
return m_name; |
} |
int PrefsTable::height() |
{ |
return rowCount; |
return m_rowCount; |
} |
int PrefsTable::getRowCount() |
{ |
return rowCount; |
return m_rowCount; |
} |
int PrefsTable::width() |
{ |
return colCount; |
return m_colCount; |
} |
int PrefsTable::getColCount() |
{ |
return colCount; |
return m_colCount; |
} |
QString PrefsTable::get(int row, int col, const QString& defValue) |
{ |
checkSize(row, col, defValue); |
if (table[row][col] == "__NOT__SET__") |
table[row].insert(table[row].begin()+col, defValue); |
if (m_table[row][col] == "__NOT__SET__") |
m_table[row].insert(m_table[row].begin()+col, defValue); |
return (table[row][col]); |
return (m_table[row][col]); |
} |
void PrefsTable::set(int row, int col, const char* value) |
80,7 → 80,7 |
void PrefsTable::set(int row, int col, const QString& value) |
{ |
checkSize(row, col, "__NOT__SET__"); |
table[row].insert(table[row].begin()+col, value); |
m_table[row].insert(m_table[row].begin()+col, value); |
} |
int PrefsTable::getInt(int row, int col, int defValue) |
167,13 → 167,13 |
if ((colIndex < 0) || (colIndex >= width())) |
return; |
Table::iterator it = table.begin(); |
Table::iterator it = m_table.begin(); |
for (int i = 0; i < height(); ++i) |
{ |
if (get(i, colIndex, "__NOT__SET__") == what) |
{ |
it = table.erase(it); |
--rowCount; |
it = m_table.erase(it); |
--m_rowCount; |
} |
else { |
++it; |
189,34 → 189,34 |
void PrefsTable::checkHeight(int rowIndex) |
{ |
if (rowCount < (rowIndex + 1)) |
if (m_rowCount < (rowIndex + 1)) |
{ |
for (int i = 0; i < ((rowIndex + 1) - rowCount); ++i) |
table.push_back(QStringList()); |
rowCount = rowIndex + 1; |
for (int i = 0; i < ((rowIndex + 1) - m_rowCount); ++i) |
m_table.push_back(QStringList()); |
m_rowCount = rowIndex + 1; |
} |
} |
void PrefsTable::checkWidth(int rowIndex, int colIndex, QString defValue) |
{ |
if (static_cast<int>(table[rowIndex].size()) <= (colIndex + 1)) |
if (static_cast<int>(m_table[rowIndex].size()) <= (colIndex + 1)) |
{ |
for (int i = 0; i < ((colIndex + 1) - static_cast<int>(table[rowIndex].size())); ++i) |
for (int i = 0; i < ((colIndex + 1) - static_cast<int>(m_table[rowIndex].size())); ++i) |
{ |
if (i == colIndex - static_cast<int>(table[rowIndex].size())) |
table[rowIndex].push_back(defValue); |
if (i == colIndex - static_cast<int>(m_table[rowIndex].size())) |
m_table[rowIndex].push_back(defValue); |
else |
table[rowIndex].push_back("__NOT__SET__"); |
m_table[rowIndex].push_back("__NOT__SET__"); |
} |
colCount = colIndex + 1; |
m_colCount = colIndex + 1; |
} |
} |
void PrefsTable::clear() |
{ |
rowCount = 0; |
colCount = 0; |
table.clear(); |
m_rowCount = 0; |
m_colCount = 0; |
m_table.clear(); |
} |
PrefsTable::~PrefsTable() |
/trunk/Scribus/scribus/prefstable.h |
---|
40,10 → 40,10 |
class SCRIBUS_API PrefsTable |
{ |
private: |
QString name; |
Table table; |
int rowCount; |
int colCount; |
QString m_name; |
Table m_table; |
int m_rowCount; |
int m_colCount; |
void checkSize(int rowIndex, int colIndex, QString defValue = ""); |
void checkHeight(int rowIndex); |
void checkWidth(int rowIndex, int colIndex, QString defValue = ""); |
/trunk/Scribus/scribus/qtiocompressor.cpp |
---|
255,7 → 255,7 |
deompression at the expense of memory usage. |
*/ |
QtIOCompressor::QtIOCompressor(QIODevice *device, int compressionLevel, int bufferSize) |
:d_ptr(new QtIOCompressorPrivate(this, device, compressionLevel, bufferSize)) |
:m_ptr(new QtIOCompressorPrivate(this, device, compressionLevel, bufferSize)) |
{} |
/*! |
/trunk/Scribus/scribus/qtiocompressor.h |
---|
71,7 → 71,7 |
qint64 writeData(const char * data, qint64 maxSize); |
private: |
static bool checkGzipSupport(const char * const versionString); |
QtIOCompressorPrivate *d_ptr; |
QtIOCompressorPrivate *m_ptr; |
Q_DECLARE_PRIVATE(QtIOCompressor) |
Q_DISABLE_COPY(QtIOCompressor) |
}; |
/trunk/Scribus/scribus/sampleitem.cpp |
---|
32,40 → 32,40 |
m_Doc->PageColors.insert("__blackforpreview__", ScColor(0, 0, 0, 255)); |
m_Doc->PageColors.insert("__whiteforpreview__", ScColor(0, 0, 0, 0)); |
m_Doc->PageColors.insert("__whiteforpreviewbg__", ScColor(0, 0, 0, 0)); |
bgShade = 100; |
tmpStyle.setName("(preview temporary)"); |
tmpStyle.setLineSpacingMode(ParagraphStyle::FixedLineSpacing); |
tmpStyle.setLineSpacing((m_Doc->itemToolPrefs().textSize / 10.0) * (static_cast<double>(m_Doc->typographicPrefs().autoLineSpacing) / 100)); |
tmpStyle.setAlignment(ParagraphStyle::Leftaligned); |
tmpStyle.setLeftMargin(0); |
tmpStyle.setFirstIndent(0); |
tmpStyle.setRightMargin(0); |
tmpStyle.setGapBefore(0); |
tmpStyle.setGapAfter(0); |
tmpStyle.charStyle().setFont(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts[m_Doc->itemToolPrefs().textFont]); |
tmpStyle.charStyle().setFontSize(m_Doc->itemToolPrefs().textSize); |
m_bgShade = 100; |
m_tmpStyle.setName("(preview temporary)"); |
m_tmpStyle.setLineSpacingMode(ParagraphStyle::FixedLineSpacing); |
m_tmpStyle.setLineSpacing((m_Doc->itemToolPrefs().textSize / 10.0) * (static_cast<double>(m_Doc->typographicPrefs().autoLineSpacing) / 100)); |
m_tmpStyle.setAlignment(ParagraphStyle::Leftaligned); |
m_tmpStyle.setLeftMargin(0); |
m_tmpStyle.setFirstIndent(0); |
m_tmpStyle.setRightMargin(0); |
m_tmpStyle.setGapBefore(0); |
m_tmpStyle.setGapAfter(0); |
m_tmpStyle.charStyle().setFont(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts[m_Doc->itemToolPrefs().textFont]); |
m_tmpStyle.charStyle().setFontSize(m_Doc->itemToolPrefs().textSize); |
// tmpStyle.tabValues().clear(); |
tmpStyle.setHasDropCap(false); |
tmpStyle.setHasBullet(false); |
tmpStyle.setHasNum(false); |
tmpStyle.setDropCapLines(0);//2; |
tmpStyle.setParEffectOffset(0); |
tmpStyle.charStyle().setFeatures(QStringList(CharStyle::INHERIT)); |
tmpStyle.charStyle().setFillColor("__blackforpreview__"); |
tmpStyle.charStyle().setFillShade(100); //m_Doc->toolSettings.dShade; |
tmpStyle.charStyle().setStrokeColor("__whiteforpreview__"); |
tmpStyle.charStyle().setStrokeShade(100); //m_Doc->toolSettings.dShade2; |
tmpStyle.charStyle().setShadowXOffset(50); |
tmpStyle.charStyle().setShadowYOffset(-50); |
tmpStyle.charStyle().setOutlineWidth(10); |
tmpStyle.charStyle().setUnderlineOffset(0); //m_Doc->typographicSettings.valueUnderlinePos; |
tmpStyle.charStyle().setUnderlineWidth(0); //m_Doc->typographicSettings.valueUnderlineWidth; |
tmpStyle.charStyle().setStrikethruOffset(0); //m_Doc->typographicSettings.valueStrikeThruPos; |
tmpStyle.charStyle().setStrikethruWidth(0); //m_Doc->typographicSettings.valueStrikeThruPos; |
tmpStyle.charStyle().setScaleH(1000); |
tmpStyle.charStyle().setScaleV(1000); |
tmpStyle.charStyle().setBaselineOffset(0); |
tmpStyle.charStyle().setTracking(0); |
m_tmpStyle.setHasDropCap(false); |
m_tmpStyle.setHasBullet(false); |
m_tmpStyle.setHasNum(false); |
m_tmpStyle.setDropCapLines(0);//2; |
m_tmpStyle.setParEffectOffset(0); |
m_tmpStyle.charStyle().setFeatures(QStringList(CharStyle::INHERIT)); |
m_tmpStyle.charStyle().setFillColor("__blackforpreview__"); |
m_tmpStyle.charStyle().setFillShade(100); //m_Doc->toolSettings.dShade; |
m_tmpStyle.charStyle().setStrokeColor("__whiteforpreview__"); |
m_tmpStyle.charStyle().setStrokeShade(100); //m_Doc->toolSettings.dShade2; |
m_tmpStyle.charStyle().setShadowXOffset(50); |
m_tmpStyle.charStyle().setShadowYOffset(-50); |
m_tmpStyle.charStyle().setOutlineWidth(10); |
m_tmpStyle.charStyle().setUnderlineOffset(0); //m_Doc->typographicSettings.valueUnderlinePos; |
m_tmpStyle.charStyle().setUnderlineWidth(0); //m_Doc->typographicSettings.valueUnderlineWidth; |
m_tmpStyle.charStyle().setStrikethruOffset(0); //m_Doc->typographicSettings.valueStrikeThruPos; |
m_tmpStyle.charStyle().setStrikethruWidth(0); //m_Doc->typographicSettings.valueStrikeThruPos; |
m_tmpStyle.charStyle().setScaleH(1000); |
m_tmpStyle.charStyle().setScaleV(1000); |
m_tmpStyle.charStyle().setBaselineOffset(0); |
m_tmpStyle.charStyle().setTracking(0); |
} |
SampleItem::~SampleItem() |
75,13 → 75,13 |
void SampleItem::setText(QString aText) |
{ |
text = aText; |
m_text = aText; |
} |
void SampleItem::setLoremIpsum(int para) |
{ |
LoremParser *m = new LoremParser("loremipsum.xml"); |
text = m->createLorem(para); |
m_text = m->createLorem(para); |
// really needed ?? |
// text = QString::fromUtf8(text); |
delete m; |
89,7 → 89,7 |
void SampleItem::setStyle(const ParagraphStyle& aStyle) |
{ |
tmpStyle = aStyle; |
m_tmpStyle = aStyle; |
} |
void SampleItem::setBgColor(QColor c) |
99,7 → 99,7 |
void SampleItem::setBgShade(int c) |
{ |
bgShade = c; |
m_bgShade = c; |
} |
void SampleItem::setBgColorMgmt(bool enable) |
114,54 → 114,54 |
void SampleItem::setTxShade(int c) |
{ |
tmpStyle.charStyle().setFillShade(c); |
m_tmpStyle.charStyle().setFillShade(c); |
} |
void SampleItem::setLineSpaMode(int lineSpaMode) |
{ |
tmpStyle.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(lineSpaMode)); |
m_tmpStyle.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(lineSpaMode)); |
} |
void SampleItem::setLineSpa(double lineSpa) |
{ |
tmpStyle.setLineSpacing(lineSpa); |
m_tmpStyle.setLineSpacing(lineSpa); |
} |
void SampleItem::setTextAlignment(int textAlignment) |
{ |
tmpStyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(textAlignment)); |
m_tmpStyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(textAlignment)); |
} |
void SampleItem::setIndent(double indent) |
{ |
tmpStyle.setLeftMargin(indent); |
m_tmpStyle.setLeftMargin(indent); |
} |
void SampleItem::setFirst(double first) |
{ |
tmpStyle.setFirstIndent(first); |
m_tmpStyle.setFirstIndent(first); |
} |
void SampleItem::setGapBefore(double gapBefore) |
{ |
tmpStyle.setGapBefore(gapBefore); |
m_tmpStyle.setGapBefore(gapBefore); |
} |
void SampleItem::setGapAfter(double gapAfter) |
{ |
tmpStyle.setGapAfter(gapAfter); |
m_tmpStyle.setGapAfter(gapAfter); |
} |
void SampleItem::setFont(QString font) |
{ |
tmpStyle.charStyle().setFont(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts[font]); |
m_tmpStyle.charStyle().setFont(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts[font]); |
} |
void SampleItem::setFontSize(int fontSize, bool autoLineSpa) |
{ |
tmpStyle.charStyle().setFontSize(fontSize); |
m_tmpStyle.charStyle().setFontSize(fontSize); |
if (autoLineSpa) |
tmpStyle.setLineSpacing((fontSize / 10) * (m_Doc->typographicPrefs().autoLineSpacing / 100.0)); |
m_tmpStyle.setLineSpacing((fontSize / 10) * (m_Doc->typographicPrefs().autoLineSpacing / 100.0)); |
} |
/*void SampleItem::setTabValues(QValueList<PageItem::TabRecord> tabValues) |
171,112 → 171,112 |
void SampleItem::setDrop(bool drop) |
{ |
tmpStyle.setHasDropCap(drop); |
m_tmpStyle.setHasDropCap(drop); |
} |
void SampleItem::setDropLin(int dropLin) |
{ |
tmpStyle.setDropCapLines(dropLin); |
m_tmpStyle.setDropCapLines(dropLin); |
} |
void SampleItem::setParEffectDist(double dist) |
{ |
tmpStyle.setParEffectOffset(dist); |
m_tmpStyle.setParEffectOffset(dist); |
} |
void SampleItem::setBullet(bool bul) |
{ |
tmpStyle.setHasBullet(bul); |
m_tmpStyle.setHasBullet(bul); |
} |
void SampleItem::setNum(bool num) |
{ |
tmpStyle.setHasNum(num); |
m_tmpStyle.setHasNum(num); |
} |
void SampleItem::setFontEffect(int fontEffect) |
{ |
tmpStyle.charStyle().setFeatures(static_cast<StyleFlag>(fontEffect).featureList()); |
m_tmpStyle.charStyle().setFeatures(static_cast<StyleFlag>(fontEffect).featureList()); |
} |
void SampleItem::setFColor(QString fColor) |
{ |
tmpStyle.charStyle().setFillColor(fColor); |
m_tmpStyle.charStyle().setFillColor(fColor); |
} |
void SampleItem::setFShade(int fShade) |
{ |
tmpStyle.charStyle().setFillShade(fShade); |
m_tmpStyle.charStyle().setFillShade(fShade); |
} |
void SampleItem::setSColor(QString sColor) |
{ |
tmpStyle.charStyle().setStrokeColor(sColor); |
m_tmpStyle.charStyle().setStrokeColor(sColor); |
} |
void SampleItem::setSShade(int sShade) |
{ |
tmpStyle.charStyle().setStrokeShade(sShade); |
m_tmpStyle.charStyle().setStrokeShade(sShade); |
} |
void SampleItem::setBaseAdj(bool baseAdj) |
{ |
tmpStyle.setLineSpacingMode(baseAdj ? ParagraphStyle::BaselineGridLineSpacing : ParagraphStyle::FixedLineSpacing); |
m_tmpStyle.setLineSpacingMode(baseAdj ? ParagraphStyle::BaselineGridLineSpacing : ParagraphStyle::FixedLineSpacing); |
} |
void SampleItem::setTxtShadowX(int txtShadowX) |
{ |
tmpStyle.charStyle().setShadowXOffset(txtShadowX); |
m_tmpStyle.charStyle().setShadowXOffset(txtShadowX); |
} |
void SampleItem::setTxtShadowY(int txtShadowY) |
{ |
tmpStyle.charStyle().setShadowYOffset(txtShadowY); |
m_tmpStyle.charStyle().setShadowYOffset(txtShadowY); |
} |
void SampleItem::setTxtOutline(int txtOutline) |
{ |
tmpStyle.charStyle().setOutlineWidth(txtOutline); |
m_tmpStyle.charStyle().setOutlineWidth(txtOutline); |
} |
void SampleItem::setTxtUnderPos(int txtUnderPos) |
{ |
tmpStyle.charStyle().setUnderlineOffset(txtUnderPos); |
m_tmpStyle.charStyle().setUnderlineOffset(txtUnderPos); |
} |
void SampleItem::setTxtUnderWidth(int txtUnderWidth) |
{ |
tmpStyle.charStyle().setUnderlineWidth(txtUnderWidth); |
m_tmpStyle.charStyle().setUnderlineWidth(txtUnderWidth); |
} |
void SampleItem::setTxtStrikePos(int txtStrikePos) |
{ |
tmpStyle.charStyle().setStrikethruOffset(txtStrikePos); |
m_tmpStyle.charStyle().setStrikethruOffset(txtStrikePos); |
} |
void SampleItem::setTxtStrikeWidth(int txtStrikeWidth) |
{ |
tmpStyle.charStyle().setStrikethruWidth(txtStrikeWidth); |
m_tmpStyle.charStyle().setStrikethruWidth(txtStrikeWidth); |
} |
void SampleItem::setScaleH(int scaleH) |
{ |
tmpStyle.charStyle().setScaleH(scaleH); |
m_tmpStyle.charStyle().setScaleH(scaleH); |
} |
void SampleItem::setScaleV(int scaleV) |
{ |
tmpStyle.charStyle().setScaleV(scaleV); |
m_tmpStyle.charStyle().setScaleV(scaleV); |
} |
void SampleItem::setBaseOff(int baseOff) |
{ |
tmpStyle.charStyle().setBaselineOffset(baseOff); |
m_tmpStyle.charStyle().setBaselineOffset(baseOff); |
} |
void SampleItem::setKernVal(int kernVal) |
{ |
tmpStyle.charStyle().setTracking(kernVal); |
m_tmpStyle.charStyle().setTracking(kernVal); |
} |
QPixmap SampleItem::getSample(int width, int height) |
285,7 → 285,7 |
// after sample creating |
bool previouslyUsedFont = false; |
if (tmpStyle.charStyle().font().isNone()) |
if (m_tmpStyle.charStyle().font().isNone()) |
return QPixmap(); |
UndoManager::instance()->setUndoEnabled(false); // disable undo |
295,20 → 295,20 |
ScPainter *painter = new ScPainter(&pm, width, height, 1.0, 0); |
painter->setZoomFactor(PrefsManager::instance()->appPrefs.displayPrefs.displayScale); |
if (m_Doc->UsedFonts.contains(tmpStyle.charStyle().font().scName())) |
if (m_Doc->UsedFonts.contains(m_tmpStyle.charStyle().font().scName())) |
previouslyUsedFont = true; |
m_Doc->AddFont(tmpStyle.charStyle().font().scName(), qRound(m_Doc->itemToolPrefs().textSize / 10.0)); |
m_Doc->AddFont(m_tmpStyle.charStyle().font().scName(), qRound(m_Doc->itemToolPrefs().textSize / 10.0)); |
previewItem->FrameType = PageItem::TextFrame; |
previewItem->itemText.clear(); |
// previewItem->setFont(tmpStyle.charStyle().font()->scName()); |
previewItem->Cols = 1; |
text.replace(QChar(10),QChar(13)).replace(QChar(5),QChar(13)); |
previewItem->itemText.insertChars(0, text); |
previewItem->itemText.setDefaultStyle(tmpStyle); |
m_text.replace(QChar(10),QChar(13)).replace(QChar(5),QChar(13)); |
previewItem->itemText.insertChars(0, m_text); |
previewItem->itemText.setDefaultStyle(m_tmpStyle); |
previewItem->setFillColor("__whiteforpreviewbg__"); |
previewItem->setFillShade(bgShade); |
previewItem->setFillShade(m_bgShade); |
previewItem->SetRectFrame(); |
previewItem->setSampleItem(true); |
previewItem->DrawObj(painter, QRect(0, 0, width, height)); |
319,7 → 319,7 |
// cleanups and resets |
if (!previouslyUsedFont) |
{ |
QString fontName = tmpStyle.charStyle().font().scName(); |
QString fontName = m_tmpStyle.charStyle().font().scName(); |
(*m_Doc->AllFonts)[fontName].decreaseUsage(); // was increased by AddFont() |
m_Doc->UsedFonts.remove(fontName); |
} |
/trunk/Scribus/scribus/sampleitem.h |
---|
98,14 → 98,14 |
private: |
//! \brief Text to be rendered |
QString text; |
QString m_text; |
//! \brief Internal temporary paragraph style |
ParagraphStyle tmpStyle; |
ParagraphStyle m_tmpStyle; |
/*! \brief Reference to a document. |
Existing or created one */ |
ScribusDoc *m_Doc; |
//! \brief Is the doc created used only? true = used |
int bgShade; |
int m_bgShade; |
}; |
#endif |
/trunk/Scribus/scribus/sccolor.cpp |
---|
34,54 → 34,54 |
{ |
// Model = colorModelCMYK; |
// CR = MG = YB = K = 0; |
Model = colorModelRGB; |
CR = 150; |
MG = 100; |
YB = 50; |
K = 0; |
Spot = false; |
Regist = false; |
m_Model = colorModelRGB; |
m_CR = 150; |
m_MG = 100; |
m_YB = 50; |
m_K = 0; |
m_Spot = false; |
m_Regist = false; |
} |
ScColor::ScColor(int c, int m, int y, int k) |
{ |
Spot = false; |
Regist = false; |
m_Spot = false; |
m_Regist = false; |
setColor(c, m, y, k); |
} |
ScColor::ScColor(int r, int g, int b) |
{ |
Spot = false; |
Regist = false; |
m_Spot = false; |
m_Regist = false; |
setColorRGB(r, g, b); |
} |
ScColor::ScColor(double l, double a, double b) |
{ |
Spot = false; |
Regist = false; |
Model = colorModelLab; |
L_val = l; |
a_val = a; |
b_val = b; |
m_Spot = false; |
m_Regist = false; |
m_Model = colorModelLab; |
m_L_val = l; |
m_a_val = a; |
m_b_val = b; |
} |
bool ScColor::operator==(const ScColor& other) const |
{ |
if (Model != other.Model) |
if (m_Model != other.m_Model) |
return false; |
if (Spot != other.Spot) |
if (m_Spot != other.m_Spot) |
return false; |
if (Regist != other.Regist) |
if (m_Regist != other.m_Regist) |
return false; |
if (Model == colorModelRGB) |
if (m_Model == colorModelRGB) |
{ |
return ((CR == other.CR) && (MG == other.MG) && (YB == other.YB)); |
return ((m_CR == other.m_CR) && (m_MG == other.m_MG) && (m_YB == other.m_YB)); |
} |
if (Model == colorModelCMYK) |
if (m_Model == colorModelCMYK) |
{ |
return ((CR == other.CR) && (MG == other.MG) && (YB == other.YB) && (K == other.K)); |
return ((m_CR == other.m_CR) && (m_MG == other.m_MG) && (m_YB == other.m_YB) && (m_K == other.m_K)); |
} |
return false; |
} |
88,32 → 88,32 |
void ScColor::setColor(int c, int m, int y, int k) |
{ |
CR = c; |
MG = m; |
YB = y; |
K = k; |
Model = colorModelCMYK; |
m_CR = c; |
m_MG = m; |
m_YB = y; |
m_K = k; |
m_Model = colorModelCMYK; |
} |
void ScColor::setColor(double l, double a, double b) |
{ |
Model = colorModelLab; |
L_val = l; |
a_val = a; |
b_val = b; |
m_Model = colorModelLab; |
m_L_val = l; |
m_a_val = a; |
m_b_val = b; |
} |
void ScColor::setColorRGB(int r, int g, int b) |
{ |
CR = r; |
MG = g; |
YB = b; |
Model = colorModelRGB; |
m_CR = r; |
m_MG = g; |
m_YB = b; |
m_Model = colorModelRGB; |
} |
colorModel ScColor::getColorModel () const |
{ |
return Model; |
return m_Model; |
} |
void ScColor::fromQColor(QColor color) |
134,88 → 134,88 |
void ScColor::getRawRGBColor(int *r, int *g, int *b) const |
{ |
if (Model == colorModelRGB) |
if (m_Model == colorModelRGB) |
{ |
*r = CR; |
*g = MG; |
*b = YB; |
*r = m_CR; |
*g = m_MG; |
*b = m_YB; |
} |
else |
{ |
*r = 255-qMin(255, CR + K); |
*g = 255-qMin(255, MG + K); |
*b = 255-qMin(255, YB + K); |
*r = 255-qMin(255, m_CR + m_K); |
*g = 255-qMin(255, m_MG + m_K); |
*b = 255-qMin(255, m_YB + m_K); |
} |
} |
QColor ScColor::getRawRGBColor() const |
{ |
if (Model == colorModelRGB) |
return QColor(CR, MG, YB); |
return QColor(255-qMin(255, CR + K), 255-qMin(255, MG + K), 255 - qMin(255, YB + K)); |
if (m_Model == colorModelRGB) |
return QColor(m_CR, m_MG, m_YB); |
return QColor(255-qMin(255, m_CR + m_K), 255-qMin(255, m_MG + m_K), 255 - qMin(255, m_YB + m_K)); |
} |
void ScColor::getRGB(int *r, int *g, int *b) const |
{ |
if (Model != colorModelRGB) |
if (m_Model != colorModelRGB) |
qDebug("calling getRGB with a cmyk color"); |
*r = CR; |
*g = MG; |
*b = YB; |
*r = m_CR; |
*g = m_MG; |
*b = m_YB; |
} |
void ScColor::getCMYK(int *c, int *m, int *y, int *k) const |
{ |
if (Model != colorModelCMYK) |
if (m_Model != colorModelCMYK) |
qDebug("calling getCMYK with a rgb color"); |
*c = CR; |
*m = MG; |
*y = YB; |
*k = K; |
*c = m_CR; |
*m = m_MG; |
*y = m_YB; |
*k = m_K; |
} |
void ScColor::getLab(double *L, double *a, double *b) const |
{ |
if (Model != colorModelLab) |
if (m_Model != colorModelLab) |
qDebug("calling getLab with a non Lab color"); |
*L = L_val; |
*a = a_val; |
*b = b_val; |
*L = m_L_val; |
*a = m_a_val; |
*b = m_b_val; |
} |
QString ScColor::name() |
{ |
QString tmp, name="#"; |
switch (Model) |
switch (m_Model) |
{ |
case colorModelCMYK: |
tmp.setNum(CR, 16); |
tmp.setNum(m_CR, 16); |
if (tmp.length() < 2) |
tmp.insert(0, "0"); |
name += tmp; |
tmp.setNum(MG, 16); |
tmp.setNum(m_MG, 16); |
if (tmp.length() < 2) |
tmp.insert(0, "0"); |
name += tmp; |
tmp.setNum(YB, 16); |
tmp.setNum(m_YB, 16); |
if (tmp.length() < 2) |
tmp.insert(0, "0"); |
name += tmp; |
tmp.setNum(K, 16); |
tmp.setNum(m_K, 16); |
if (tmp.length() < 2) |
tmp.insert(0, "0"); |
name += tmp; |
break; |
case colorModelRGB: |
tmp.setNum(CR, 16); |
tmp.setNum(m_CR, 16); |
if (tmp.length() < 2) |
tmp.insert(0, "0"); |
name += tmp; |
tmp.setNum(MG, 16); |
tmp.setNum(m_MG, 16); |
if (tmp.length() < 2) |
tmp.insert(0, "0"); |
name += tmp; |
tmp.setNum(YB, 16); |
tmp.setNum(m_YB, 16); |
if (tmp.length() < 2) |
tmp.insert(0, "0"); |
name += tmp; |
228,7 → 228,7 |
QString ScColor::nameCMYK(const ScribusDoc* doc) |
{ |
if ((Model != colorModelCMYK) && (!doc)) |
if ((m_Model != colorModelCMYK) && (!doc)) |
qDebug("calling nameCMYK with a rgb color"); |
CMYKColor cmyk; |
int c, m, y, k; |
257,7 → 257,7 |
QString ScColor::nameRGB(const ScribusDoc* doc) |
{ |
if ((Model != colorModelRGB) && (!doc)) |
if ((m_Model != colorModelRGB) && (!doc)) |
qDebug("calling nameRGB with a cmyk color"); |
int r, g, b; |
RGBColor rgb; |
302,22 → 302,22 |
bool ScColor::isRegistrationColor() const |
{ |
return Regist; |
return m_Regist; |
} |
void ScColor::setRegistrationColor(bool s) |
{ |
Regist = s; |
m_Regist = s; |
} |
bool ScColor::isSpotColor() const |
{ |
return Spot; |
return m_Spot; |
} |
void ScColor::setSpotColor(bool s) |
{ |
Spot = s; |
m_Spot = s; |
} |
ColorList::ColorList(ScribusDoc* doc, bool retainDoc) : QMap<QString,ScColor>() |
/trunk/Scribus/scribus/sccolor.h |
---|
130,26 → 130,26 |
private: |
/** \brief Cyan or Red Component of Color (depends of color model)*/ |
int CR; |
int m_CR; |
/** \brief Magenta or Green Component of Color (depends of color model)*/ |
int MG; |
int m_MG; |
/** \brief Yellow or Blue Component of Color (depends of color model)*/ |
int YB; |
int m_YB; |
/** \brief Black-Component of Color */ |
int K; |
int m_K; |
/** \brief L component of Color */ |
double L_val; |
double m_L_val; |
/** \brief a component of Color */ |
double a_val; |
double m_a_val; |
/** \brief b component of Color */ |
double b_val; |
double m_b_val; |
/** \brief Flag, true if the Color is a Spotcolor */ |
bool Spot; |
bool m_Spot; |
/** \brief Flag, true if the Color is a Registration color */ |
bool Regist; |
bool m_Regist; |
/** \brief Color model of the current color */ |
colorModel Model; |
colorModel m_Model; |
}; |
class SCRIBUS_API ColorList : public QMap<QString,ScColor> |
/trunk/Scribus/scribus/sccolorengine.cpp |
---|
62,9 → 62,9 |
ScColorTransform trans = engine.createTransform(profRGB, Format_RGB_16, profLab, Format_Lab_Dbl, Intent_Perceptual, 0); |
double outC[3]; |
unsigned short inC[3]; |
inC[0] = color.CR * 257; |
inC[1] = color.MG * 257; |
inC[2] = color.YB * 257; |
inC[0] = color.m_CR * 257; |
inC[1] = color.m_MG * 257; |
inC[2] = color.m_YB * 257; |
trans.apply(inC, outC, 1); |
newCol.setColor(outC[0], outC[1], outC[2]); |
} |
75,10 → 75,10 |
ScColorTransform trans = engine.createTransform(profRGB, Format_CMYK_16, profLab, Format_Lab_Dbl, Intent_Perceptual, 0); |
double outC[3]; |
unsigned short inC[4]; |
inC[0] = color.CR * 257; |
inC[1] = color.MG * 257; |
inC[2] = color.YB * 257; |
inC[3] = color.K * 257; |
inC[0] = color.m_CR * 257; |
inC[1] = color.m_MG * 257; |
inC[2] = color.m_YB * 257; |
inC[3] = color.m_K * 257; |
trans.apply(inC, outC, 1); |
newCol.setColor(outC[0], outC[1], outC[2]); |
} |
94,18 → 94,18 |
{ |
if (model == colorModelRGB) |
{ |
rgb.r = color.CR; |
rgb.g = color.MG; |
rgb.b = color.YB; |
rgb.r = color.m_CR; |
rgb.g = color.m_MG; |
rgb.b = color.m_YB; |
} |
else if (model == colorModelCMYK) |
{ |
unsigned short inC[4]; |
unsigned short outC[4]; |
inC[0] = color.CR * 257; |
inC[1] = color.MG * 257; |
inC[2] = color.YB * 257; |
inC[3] = color.K * 257; |
inC[0] = color.m_CR * 257; |
inC[1] = color.m_MG * 257; |
inC[2] = color.m_YB * 257; |
inC[3] = color.m_K * 257; |
transRGB.apply(inC, outC, 1); |
rgb.r = outC[0] / 257; |
rgb.g = outC[1] / 257; |
115,9 → 115,9 |
{ |
ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans; |
double inC[3]; |
inC[0] = color.L_val; |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val; |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
quint16 outC[3]; |
trans.apply(inC, outC, 1); |
rgb.r = outC[0] / 257; |
127,22 → 127,22 |
} |
else if (model == colorModelCMYK) |
{ |
rgb.r = 255 - qMin(255, color.CR + color.K); |
rgb.g = 255 - qMin(255, color.MG + color.K); |
rgb.b = 255 - qMin(255, color.YB + color.K); |
rgb.r = 255 - qMin(255, color.m_CR + color.m_K); |
rgb.g = 255 - qMin(255, color.m_MG + color.m_K); |
rgb.b = 255 - qMin(255, color.m_YB + color.m_K); |
} |
else if (model == colorModelRGB) |
{ |
rgb.r = color.CR; |
rgb.g = color.MG; |
rgb.b = color.YB; |
rgb.r = color.m_CR; |
rgb.g = color.m_MG; |
rgb.b = color.m_YB; |
} |
else if (model == colorModelLab) |
{ |
// First step: Lab -> XYZ |
double var_Y = (color.L_val + 16) / 116.0; |
double var_X = color.a_val / 500.0 + var_Y; |
double var_Z = var_Y - color.b_val / 200.0; |
double var_Y = (color.m_L_val + 16) / 116.0; |
double var_X = color.m_a_val / 500.0 + var_Y; |
double var_Z = var_Y - color.m_b_val / 200.0; |
if (pow(var_Y, 3) > 0.008856) |
var_Y = pow(var_Y, 3); |
else |
202,16 → 202,16 |
if (model == colorModelRGB) |
{ |
// allow RGB greys to go got to CMYK greys without transform |
if (color.CR == color.MG && color.MG == color.YB) |
if (color.m_CR == color.m_MG && color.m_MG == color.m_YB) |
{ |
cmyk.c = cmyk.m = cmyk.y = 0; |
cmyk.k = 255 - color.CR; |
cmyk.k = 255 - color.m_CR; |
} |
else |
{ |
inC[0] = color.CR * 257; |
inC[1] = color.MG * 257; |
inC[2] = color.YB * 257; |
inC[0] = color.m_CR * 257; |
inC[1] = color.m_MG * 257; |
inC[2] = color.m_YB * 257; |
transCMYK.apply(inC, outC, 1); |
cmyk.c = outC[0] / 257; |
cmyk.m = outC[1] / 257; |
221,18 → 221,18 |
} |
else if (model == colorModelCMYK) |
{ |
cmyk.c = color.CR; |
cmyk.m = color.MG; |
cmyk.y = color.YB; |
cmyk.k = color.K; |
cmyk.c = color.m_CR; |
cmyk.m = color.m_MG; |
cmyk.y = color.m_YB; |
cmyk.k = color.m_K; |
} |
else if (model == colorModelLab) |
{ |
ScColorTransform trans = doc ? doc->stdLabToCMYKTrans : ScCore->defaultLabToCMYKTrans; |
double inC[3]; |
inC[0] = color.L_val; |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val; |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
quint16 outC[4]; |
trans.apply(inC, outC, 1); |
cmyk.c = outC[0] / 257; |
243,25 → 243,25 |
} |
else if (model == colorModelRGB) |
{ |
cmyk.k = qMin(qMin(255 - color.CR, 255 - color.MG), 255 - color.YB); |
cmyk.c = 255 - color.CR - cmyk.k; |
cmyk.m = 255 - color.MG - cmyk.k; |
cmyk.y = 255 - color.YB - cmyk.k; |
cmyk.k = qMin(qMin(255 - color.m_CR, 255 - color.m_MG), 255 - color.m_YB); |
cmyk.c = 255 - color.m_CR - cmyk.k; |
cmyk.m = 255 - color.m_MG - cmyk.k; |
cmyk.y = 255 - color.m_YB - cmyk.k; |
} |
else if (model == colorModelCMYK) |
{ |
cmyk.c = color.CR; |
cmyk.m = color.MG; |
cmyk.y = color.YB; |
cmyk.k = color.K; |
cmyk.c = color.m_CR; |
cmyk.m = color.m_MG; |
cmyk.y = color.m_YB; |
cmyk.k = color.m_K; |
} |
else if (model == colorModelLab) |
{ |
ScColorTransform trans = doc ? doc->stdLabToCMYKTrans : ScCore->defaultLabToCMYKTrans; |
double inC[3]; |
inC[0] = color.L_val; |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val; |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
quint16 outC[4]; |
trans.apply(inC, outC, 1); |
cmyk.c = outC[0] / 257; |
283,18 → 283,18 |
} |
else if (color.getColorModel() == colorModelCMYK) |
{ |
cmyk.c = qRound(color.CR * level / 100.0); |
cmyk.m = qRound(color.MG * level / 100.0); |
cmyk.y = qRound(color.YB * level / 100.0); |
cmyk.k = qRound(color.K * level / 100.0); |
cmyk.c = qRound(color.m_CR * level / 100.0); |
cmyk.m = qRound(color.m_MG * level / 100.0); |
cmyk.y = qRound(color.m_YB * level / 100.0); |
cmyk.k = qRound(color.m_K * level / 100.0); |
} |
else if (color.getColorModel() == colorModelLab) |
{ |
ScColorTransform trans = doc ? doc->stdLabToCMYKTrans : ScCore->defaultLabToCMYKTrans; |
double inC[3]; |
inC[0] = color.L_val * (level / 100.0); |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val * (level / 100.0); |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
quint16 outC[4]; |
trans.apply(inC, outC, 1); |
cmyk.c = outC[0] / 257; |
316,7 → 316,7 |
else if (color.getColorModel() == colorModelRGB) |
{ |
int h, s, v, snew, vnew; |
QColor tmpR(color.CR, color.MG, color.YB); |
QColor tmpR(color.m_CR, color.m_MG, color.m_YB); |
tmpR.getHsv(&h, &s, &v); |
snew = qRound(s * level / 100.0); |
vnew = 255 - qRound(((255 - v) * level / 100.0)); |
331,9 → 331,9 |
{ |
ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans; |
double inC[3]; |
inC[0] = color.L_val * (level / 100.0); |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val * (level / 100.0); |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
quint16 outC[3]; |
trans.apply(inC, outC, 1); |
rgb.r = outC[0] / 257; |
348,18 → 348,18 |
if (color.getColorModel() == colorModelRGB) |
{ |
RGBColor rgb; |
rgb.r = color.CR; |
rgb.g = color.MG; |
rgb.b = color.YB; |
rgb.r = color.m_CR; |
rgb.g = color.m_MG; |
rgb.b = color.m_YB; |
tmp = getDisplayColor(rgb, doc, color.isSpotColor()); |
} |
else if (color.getColorModel() == colorModelCMYK) |
{ |
CMYKColor cmyk; |
cmyk.c = color.CR; |
cmyk.m = color.MG; |
cmyk.y = color.YB; |
cmyk.k = color.K; |
cmyk.c = color.m_CR; |
cmyk.m = color.m_MG; |
cmyk.y = color.m_YB; |
cmyk.k = color.m_K; |
tmp = getDisplayColor(cmyk, doc, color.isSpotColor()); |
} |
else if (color.getColorModel() == colorModelLab) |
369,9 → 369,9 |
if (cmsUse && trans) |
{ |
double inC[3]; |
inC[0] = color.L_val; |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val; |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
quint16 outC[3]; |
trans.apply(inC, outC, 1); |
tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257); |
379,9 → 379,9 |
else |
{ |
// First step: Lab -> XYZ |
double var_Y = (color.L_val + 16) / 116.0; |
double var_X = color.a_val / 500.0 + var_Y; |
double var_Z = var_Y - color.b_val / 200.0; |
double var_Y = (color.m_L_val + 16) / 116.0; |
double var_X = color.m_a_val / 500.0 + var_Y; |
double var_Z = var_Y - color.m_b_val / 200.0; |
if (pow(var_Y, 3) > 0.008856) |
var_Y = pow(var_Y, 3); |
else |
430,9 → 430,9 |
if (color.getColorModel() == colorModelRGB) |
{ |
RGBColor rgb; |
rgb.r = color.CR; |
rgb.g = color.MG; |
rgb.b = color.YB; |
rgb.r = color.m_CR; |
rgb.g = color.m_MG; |
rgb.b = color.m_YB; |
getShadeColorRGB(color, doc, rgb, level); |
tmp = getDisplayColor(rgb, doc, color.isSpotColor()); |
} |
439,10 → 439,10 |
else if (color.getColorModel() == colorModelCMYK) |
{ |
CMYKColor cmyk; |
cmyk.c = color.CR; |
cmyk.m = color.MG; |
cmyk.y = color.YB; |
cmyk.k = color.K; |
cmyk.c = color.m_CR; |
cmyk.m = color.m_MG; |
cmyk.y = color.m_YB; |
cmyk.k = color.m_K; |
getShadeColorCMYK(color, doc, cmyk, level); |
tmp = getDisplayColor(cmyk, doc, color.isSpotColor()); |
} |
450,9 → 450,9 |
{ |
ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans; |
double inC[3]; |
inC[0] = color.L_val * (level / 100.0); |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val * (level / 100.0); |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
quint16 outC[3]; |
trans.apply(inC, outC, 1); |
tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257); |
485,21 → 485,21 |
if (color.getColorModel() == colorModelRGB) |
{ |
// Match 133x behavior (RGB greys map to cmyk greys) until we are able to make rgb profiled output |
if ( color.CR == color.MG && color.MG == color.YB ) |
if ( color.m_CR == color.m_MG && color.m_MG == color.m_YB ) |
gamutChkEnabled = false; |
RGBColor rgb; |
rgb.r = color.CR; |
rgb.g = color.MG; |
rgb.b = color.YB; |
rgb.r = color.m_CR; |
rgb.g = color.m_MG; |
rgb.b = color.m_YB; |
tmp = getColorProof(rgb, doc, spot, gamutCheck & gamutChkEnabled); |
} |
else |
{ |
CMYKColor cmyk; |
cmyk.c = color.CR; |
cmyk.m = color.MG; |
cmyk.y = color.YB; |
cmyk.k = color.K; |
cmyk.c = color.m_CR; |
cmyk.m = color.m_MG; |
cmyk.y = color.m_YB; |
cmyk.k = color.m_K; |
tmp = getColorProof(cmyk, doc, spot, gamutCheck & gamutChkEnabled); |
} |
return tmp; |
508,9 → 508,9 |
QColor ScColorEngine::getShadeColor(const ScColor& color, const ScribusDoc* doc, double level) |
{ |
RGBColor rgb; |
rgb.r = color.CR; |
rgb.g = color.MG; |
rgb.b = color.YB; |
rgb.r = color.m_CR; |
rgb.g = color.m_MG; |
rgb.b = color.m_YB; |
getShadeColorRGB(color, doc, rgb, level); |
return QColor(rgb.r, rgb.g, rgb.b); |
} |
525,9 → 525,9 |
if (color.getColorModel() == colorModelRGB) |
{ |
RGBColor rgb; |
rgb.r = color.CR; |
rgb.g = color.MG; |
rgb.b = color.YB; |
rgb.r = color.m_CR; |
rgb.g = color.m_MG; |
rgb.b = color.m_YB; |
getShadeColorRGB(color, doc, rgb, level); |
// Match 133x behavior for rgb grey until we are able to make rgb profiled output |
// (RGB greys map to cmyk greys) |
545,10 → 545,10 |
else if (color.getColorModel() == colorModelCMYK) |
{ |
CMYKColor cmyk; |
cmyk.c = color.CR; |
cmyk.m = color.MG; |
cmyk.y = color.YB; |
cmyk.k = color.K; |
cmyk.c = color.m_CR; |
cmyk.m = color.m_MG; |
cmyk.y = color.m_YB; |
cmyk.k = color.m_K; |
getShadeColorCMYK(color, doc, cmyk, level); |
tmp = getColorProof(cmyk, doc, color.isSpotColor(), doGC); |
} |
555,9 → 555,9 |
else if (color.getColorModel() == colorModelLab) |
{ |
double inC[3]; |
inC[0] = color.L_val * (level / 100.0); |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val * (level / 100.0); |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
quint16 outC[3]; |
ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans; |
ScColorTransform transProof = doc ? doc->stdProofLab : ScCore->defaultLabToRGBTrans; |
714,35 → 714,35 |
ScColorTransform xformProof; |
if (color.getColorModel() == colorModelRGB) |
{ |
inC[0] = color.CR * 257; |
inC[1] = color.MG * 257; |
inC[2] = color.YB * 257; |
inC[0] = color.m_CR * 257; |
inC[1] = color.m_MG * 257; |
inC[2] = color.m_YB * 257; |
xformProof = doc->stdProofGC; |
if ((color.CR == 0) && (color.YB == 0) && (color.MG == 255)) |
if ((color.m_CR == 0) && (color.m_YB == 0) && (color.m_MG == 255)) |
alert = false; |
if ((color.CR == color.MG && color.MG == color.YB)) |
if ((color.m_CR == color.m_MG && color.m_MG == color.m_YB)) |
alert = false; |
} |
else if (color.getColorModel() == colorModelCMYK) |
{ |
inC[0] = color.CR * 257; |
inC[1] = color.MG * 257; |
inC[2] = color.YB * 257; |
inC[3] = color.K * 257; |
inC[0] = color.m_CR * 257; |
inC[1] = color.m_MG * 257; |
inC[2] = color.m_YB * 257; |
inC[3] = color.m_K * 257; |
xformProof = doc->stdProofCMYKGC; |
if ((color.MG == 0) && (color.K == 0) && (color.CR == 255) && (color.YB == 255)) |
if ((color.m_MG == 0) && (color.m_K == 0) && (color.m_CR == 255) && (color.m_YB == 255)) |
alert = false; |
if ((color.MG == 0) && (color.CR == 0) && (color.YB == 0)) |
if ((color.m_MG == 0) && (color.m_CR == 0) && (color.m_YB == 0)) |
alert = false; |
if ((color.MG == color.CR) && (color.CR == color.YB) && (color.YB == color.K)) |
if ((color.m_MG == color.m_CR) && (color.m_CR == color.m_YB) && (color.m_YB == color.m_K)) |
alert = false; |
} |
else if (color.getColorModel() == colorModelLab) |
{ |
double inC[3]; |
inC[0] = color.L_val; |
inC[1] = color.a_val; |
inC[2] = color.b_val; |
inC[0] = color.m_L_val; |
inC[1] = color.m_a_val; |
inC[2] = color.m_b_val; |
xformProof = doc->stdProofLabGC; |
xformProof.apply(inC, outC, 1); |
if ((outC[0]/257 == 0) && (outC[1]/257 == 255) && (outC[2]/257 == 0)) |
767,9 → 767,9 |
CMYKColor cmyk; |
getCMYKValues(color, doc, cmyk); |
int k = qMin(qMin(cmyk.c, cmyk.m), cmyk.y); |
color.CR = cmyk.c - k; |
color.MG = cmyk.m - k; |
color.YB = cmyk.y - k; |
color.K = qMin((cmyk.k + k), 255); |
color.m_CR = cmyk.c - k; |
color.m_MG = cmyk.m - k; |
color.m_YB = cmyk.y - k; |
color.m_K = qMin((cmyk.k + k), 255); |
} |
} |
/trunk/Scribus/scribus/scfonts.cpp |
---|
408,7 → 408,7 |
case ScFace::TTCF: |
case ScFace::TYPE42: |
t = ScFace(new ScFace_ttf(fam, sty, "", ts, qpsName, filename, faceindex)); |
getSFontType(face, t.m->typeCode); |
getSFontType(face, t.m_m->typeCode); |
if (t.type() == ScFace::OTF) |
t.subset(true); |
else |
418,10 → 418,10 |
/* catching any types not handled above to silence compiler */ |
break; |
} |
t.m->hasGlyphNames = HasNames; |
t.m_m->hasGlyphNames = HasNames; |
t.embedPs(true); |
t.usable(true); |
t.m->status = ScFace::UNKNOWN; |
t.m_m->status = ScFace::UNKNOWN; |
if (face->num_glyphs > 2048) |
t.subset(true); |
} |
612,7 → 612,7 |
break; |
case ScFace::SFNT: |
t = ScFace(new ScFace_ttf(fam, sty, "", ts, qpsName, filename, faceindex)); |
getSFontType(face, t.m->typeCode); |
getSFontType(face, t.m_m->typeCode); |
if (t.type() == ScFace::OTF) |
{ |
t.subset(true); |
622,8 → 622,8 |
break; |
case ScFace::TTCF: |
t = ScFace(new ScFace_ttf(fam, sty, "", ts, qpsName, filename, faceindex)); |
t.m->formatCode = ScFace::TTCF; |
t.m->typeCode = ScFace::TTF; |
t.m_m->formatCode = ScFace::TTCF; |
t.m_m->typeCode = ScFace::TTF; |
//getSFontType(face, t.m->typeCode); |
if (t.type() == ScFace::OTF) |
{ |
634,7 → 634,7 |
break; |
case ScFace::TYPE42: |
t = ScFace(new ScFace_ttf(fam, sty, "", ts, qpsName, filename, faceindex)); |
getSFontType(face, t.m->typeCode); |
getSFontType(face, t.m_m->typeCode); |
if (t.type() == ScFace::OTF) |
{ |
t.subset(true); |
647,13 → 647,13 |
break; |
} |
insert(ts,t); |
t.m->hasGlyphNames = HasNames; |
t.m_m->hasGlyphNames = HasNames; |
t.embedPs(true); |
t.usable(true); |
t.m->status = ScFace::UNKNOWN; |
t.m_m->status = ScFace::UNKNOWN; |
if (face->num_glyphs > 2048) |
t.subset(true); |
t.m->forDocument = DocName; |
t.m_m->forDocument = DocName; |
//setBestEncoding(face); //AV |
if (showFontInformation) |
sDebug(QObject::tr("Font %1 loaded from %2(%3)").arg(t.psName()).arg(filename).arg(faceindex+1)); |
/trunk/Scribus/scribus/scfonts.h |
---|
80,15 → 80,15 |
struct SCFontsIterator |
{ |
SCFontsIterator(SCFonts& fonts): it(fonts.begin()), end_it(fonts.end()) |
SCFontsIterator(SCFonts& fonts): m_it(fonts.begin()), m_end_it(fonts.end()) |
{} |
ScFace& current() { return *it; } |
QString currentKey() const { return it.key(); } |
bool hasNext() const { return it != end_it; } |
ScFace& next() { ++it; return current(); } |
ScFace& current() { return *m_it; } |
QString currentKey() const { return m_it.key(); } |
bool hasNext() const { return m_it != m_end_it; } |
ScFace& next() { ++m_it; return current(); } |
private: |
QMap<QString,ScFace>::Iterator it, end_it; |
QMap<QString,ScFace>::Iterator m_it, m_end_it; |
}; |
#endif |
/trunk/Scribus/scribus/schelptreemodel.cpp |
---|
59,9 → 59,9 |
{ |
QList<QVariant> rootData; |
rootData << col1name << col2name; |
rootItem = new TreeItem(rootData); |
m_rootItem = new TreeItem(rootData); |
if (!dataFile.isEmpty()) |
setupModelData(dataFile, rootItem, indexToBuild); |
setupModelData(dataFile, m_rootItem, indexToBuild); |
} |
void ScHelpTreeModel::setupModelData(const QString &dataFile, TreeItem *parent, QMap<QString, QString>* indexToBuild) |
216,7 → 216,7 |
{ |
QList<TreeItem*> parents; |
QList<int> indentations; |
parents << rootItem; |
parents << m_rootItem; |
if (parents.last()->childCount() > 0) |
parents << parents.last()->child(parents.last()->childCount()-1); |
QList<QVariant> columnData; |
/trunk/Scribus/scribus/scpainter.cpp |
---|
22,13 → 22,13 |
m_height= h; |
m_stroke = QColor(0,0,0); |
m_strokeMode = 0; |
maskMode = 0; |
m_maskMode = 0; |
m_fill = QColor(0,0,0); |
fill_trans = 1.0; |
stroke_trans = 1.0; |
m_fill_trans = 1.0; |
m_stroke_trans = 1.0; |
m_fillRule = true; |
m_fillMode = 1; |
LineWidth = 1.0; |
m_LineWidth = 1.0; |
m_offset = 0; |
m_layerTransparency = transparency; |
m_blendMode = blendmode; |
45,12 → 45,12 |
stroke_gradient = VGradient(VGradient::linear); |
setHatchParameters(0, 2, 0, false, QColor(), QColor(), 0.0, 0.0); |
m_zoomFactor = 1; |
layeredMode = true; |
imageMode = true; |
svgMode = false; |
m_layeredMode = true; |
m_imageMode = true; |
m_svgMode = false; |
m_image = target; |
m_matrix = QTransform(); |
zoomStack.clear(); |
m_zoomStack.clear(); |
cairo_surface_t *img = cairo_image_surface_create_for_data(m_image->bits(), CAIRO_FORMAT_ARGB32, w, h, w*4); |
m_cr = cairo_create(img); |
cairo_save( m_cr ); |
74,18 → 74,18 |
m_blendMode = blendmode; |
la.pushed = false; |
la.groupClip.resize(0); |
la.maskMode = maskMode; |
la.mask_patternScaleX = mask_patternScaleX; |
la.mask_patternScaleY = mask_patternScaleY; |
la.mask_patternOffsetX = mask_patternOffsetX; |
la.mask_patternOffsetY = mask_patternOffsetY; |
la.mask_patternRotation = mask_patternRotation; |
la.mask_patternSkewX = mask_patternSkewX; |
la.mask_patternSkewY = mask_patternSkewY; |
la.mask_patternMirrorX = mask_patternMirrorX; |
la.mask_patternMirrorY = mask_patternMirrorY; |
la.mask_gradientScale = mask_gradientScale; |
la.mask_gradientSkew = mask_gradientSkew; |
la.maskMode = m_maskMode; |
la.mask_patternScaleX = m_mask_patternScaleX; |
la.mask_patternScaleY = m_mask_patternScaleY; |
la.mask_patternOffsetX = m_mask_patternOffsetX; |
la.mask_patternOffsetY = m_mask_patternOffsetY; |
la.mask_patternRotation = m_mask_patternRotation; |
la.mask_patternSkewX = m_mask_patternSkewX; |
la.mask_patternSkewY = m_mask_patternSkewY; |
la.mask_patternMirrorX = m_mask_patternMirrorX; |
la.mask_patternMirrorY = m_mask_patternMirrorY; |
la.mask_gradientScale = m_mask_gradientScale; |
la.mask_gradientSkew = m_mask_gradientSkew; |
la.mask_gradient = mask_gradient; |
la.maskPattern = m_maskPattern; |
if (clipArray != NULL) |
94,27 → 94,27 |
la.fillRule = m_fillRule; |
cairo_push_group(m_cr); |
la.pushed = true; |
Layers.push(la); |
m_Layers.push(la); |
} |
void ScPainter::endLayer() |
{ |
layerProp la; |
if (Layers.count() == 0) |
if (m_Layers.count() == 0) |
return; |
la = Layers.pop(); |
maskMode = la.maskMode; |
mask_patternScaleX = la.mask_patternScaleX; |
mask_patternScaleY = la.mask_patternScaleY; |
mask_patternOffsetX = la.mask_patternOffsetX; |
mask_patternOffsetY = la.mask_patternOffsetY; |
mask_patternRotation = la.mask_patternRotation; |
mask_patternSkewX = la.mask_patternSkewX; |
mask_patternSkewY = la.mask_patternSkewY; |
mask_patternMirrorX = la.mask_patternMirrorX; |
mask_patternMirrorY = la.mask_patternMirrorY; |
mask_gradientScale = la.mask_gradientScale; |
mask_gradientSkew = la.mask_gradientSkew; |
la = m_Layers.pop(); |
m_maskMode = la.maskMode; |
m_mask_patternScaleX = la.mask_patternScaleX; |
m_mask_patternScaleY = la.mask_patternScaleY; |
m_mask_patternOffsetX = la.mask_patternOffsetX; |
m_mask_patternOffsetY = la.mask_patternOffsetY; |
m_mask_patternRotation = la.mask_patternRotation; |
m_mask_patternSkewX = la.mask_patternSkewX; |
m_mask_patternSkewY = la.mask_patternSkewY; |
m_mask_patternMirrorX = la.mask_patternMirrorX; |
m_mask_patternMirrorY = la.mask_patternMirrorY; |
m_mask_gradientScale = la.mask_gradientScale; |
m_mask_gradientSkew = la.mask_gradientSkew; |
mask_gradient = la.mask_gradient; |
m_maskPattern = la.maskPattern; |
m_fillRule = la.fillRule; |
131,13 → 131,13 |
setClipPath(); |
} |
cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER); |
if (maskMode > 0) |
if (m_maskMode > 0) |
{ |
cairo_pattern_t *patM = getMaskPattern(); |
setRasterOp(m_blendMode); |
cairo_mask(m_cr, patM); |
if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6)) |
cairo_surface_destroy(imageMask); |
if ((m_maskMode == 2) || (m_maskMode == 4) || (m_maskMode == 5) || (m_maskMode == 6)) |
cairo_surface_destroy(m_imageMask); |
cairo_pattern_destroy(patM); |
} |
else |
149,7 → 149,7 |
} |
m_layerTransparency = la.tranparency; |
m_blendMode = la.blendmode; |
maskMode = 0; |
m_maskMode = 0; |
} |
void ScPainter::begin() |
158,9 → 158,9 |
void ScPainter::end() |
{ |
if (svgMode) |
if (m_svgMode) |
cairo_show_page (m_cr); |
if (layeredMode) |
if (m_layeredMode) |
{ |
cairo_surface_flush(cairo_get_target(m_cr)); |
cairo_restore( m_cr ); |
170,7 → 170,7 |
void ScPainter::clear() |
{ |
if (imageMode) |
if (m_imageMode) |
m_image->fill( qRgba(255, 255, 255, 255) ); |
} |
177,7 → 177,7 |
void ScPainter::clear( const QColor &c ) |
{ |
QRgb cs = c.rgb(); |
if (imageMode) |
if (m_imageMode) |
m_image->fill( qRgba(qRed(cs), qGreen(cs), qBlue(cs), qAlpha(cs)) ); |
} |
282,22 → 282,22 |
stroke_gradient.setOrigin(orig); |
stroke_gradient.setVector(vec); |
stroke_gradient.setFocalPoint(foc); |
gradientScale = scale; |
m_gradientScale = scale; |
if (skew == 90) |
gradientSkew = 1; |
m_gradientSkew = 1; |
else if (skew == 180) |
gradientSkew = 0; |
m_gradientSkew = 0; |
else if (skew == 270) |
gradientSkew = -1; |
m_gradientSkew = -1; |
else if (skew == 360) |
gradientSkew = 0; |
m_gradientSkew = 0; |
else |
gradientSkew = tan(M_PI / 180.0 * skew); |
m_gradientSkew = tan(M_PI / 180.0 * skew); |
} |
void ScPainter::setMaskMode(int mask) |
{ |
maskMode = mask; |
m_maskMode = mask; |
} |
void ScPainter::setGradientMask(VGradient::VGradientType mode, FPoint orig, FPoint vec, FPoint foc, double scale, double skew) |
306,31 → 306,31 |
mask_gradient.setOrigin(orig); |
mask_gradient.setVector(vec); |
mask_gradient.setFocalPoint(foc); |
mask_gradientScale = scale; |
m_mask_gradientScale = scale; |
if (skew == 90) |
mask_gradientSkew = 1; |
m_mask_gradientSkew = 1; |
else if (skew == 180) |
mask_gradientSkew = 0; |
m_mask_gradientSkew = 0; |
else if (skew == 270) |
mask_gradientSkew = -1; |
m_mask_gradientSkew = -1; |
else if (skew == 360) |
mask_gradientSkew = 0; |
m_mask_gradientSkew = 0; |
else |
mask_gradientSkew = tan(M_PI / 180.0 * skew); |
m_mask_gradientSkew = tan(M_PI / 180.0 * skew); |
} |
void ScPainter::setPatternMask(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY) |
{ |
m_maskPattern = pattern; |
mask_patternScaleX = scaleX / 100.0; |
mask_patternScaleY = scaleY / 100.0; |
mask_patternOffsetX = offsetX; |
mask_patternOffsetY = offsetY; |
mask_patternRotation = rotation; |
mask_patternSkewX = skewX; |
mask_patternSkewY = skewY; |
mask_patternMirrorX = mirrorX; |
mask_patternMirrorY = mirrorY; |
m_mask_patternScaleX = scaleX / 100.0; |
m_mask_patternScaleY = scaleY / 100.0; |
m_mask_patternOffsetX = offsetX; |
m_mask_patternOffsetY = offsetY; |
m_mask_patternRotation = rotation; |
m_mask_patternSkewX = skewX; |
m_mask_patternSkewY = skewY; |
m_mask_patternMirrorX = mirrorX; |
m_mask_patternMirrorY = mirrorY; |
} |
void ScPainter::set4ColorGeometry(FPoint p1, FPoint p2, FPoint p3, FPoint p4, FPoint c1, FPoint c2, FPoint c3, FPoint c4) |
390,14 → 390,14 |
void ScPainter::setHatchParameters(int mode, double distance, double angle, bool useBackground, QColor background, QColor foreground, double width, double height) |
{ |
hatchType = mode; |
hatchDistance = distance; |
hatchAngle = angle; |
hatchUseBackground = useBackground; |
hatchBackground = background; |
hatchForeground = foreground; |
hatchWidth = width; |
hatchHeight = height; |
m_hatchType = mode; |
m_hatchDistance = distance; |
m_hatchAngle = angle; |
m_hatchUseBackground = useBackground; |
m_hatchBackground = background; |
m_hatchForeground = foreground; |
m_hatchWidth = width; |
m_hatchHeight = height; |
} |
void ScPainter::fillPath() |
432,7 → 432,7 |
void ScPainter::setPen( const QColor &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo ) |
{ |
m_stroke = c; |
LineWidth = w; |
m_LineWidth = w; |
PLineEnd = ca; |
PLineJoin = jo; |
m_offset = 0; |
441,12 → 441,12 |
void ScPainter::setLineWidth( double w ) |
{ |
LineWidth = w; |
m_LineWidth = w; |
} |
void ScPainter::setPenOpacity( double op ) |
{ |
stroke_trans = op; |
m_stroke_trans = op; |
} |
463,13 → 463,13 |
void ScPainter::setBrushOpacity( double op ) |
{ |
fill_trans = op; |
m_fill_trans = op; |
} |
void ScPainter::setOpacity( double op ) |
{ |
fill_trans = op; |
stroke_trans = op; |
m_fill_trans = op; |
m_stroke_trans = op; |
} |
void ScPainter::setFont( const QFont &f) |
485,14 → 485,14 |
void ScPainter::save() |
{ |
cairo_save( m_cr ); |
zoomStack.push(m_zoomFactor); |
m_zoomStack.push(m_zoomFactor); |
} |
void ScPainter::restore() |
{ |
cairo_restore( m_cr ); |
if (!zoomStack.isEmpty()) |
m_zoomFactor = zoomStack.pop(); |
if (!m_zoomStack.isEmpty()) |
m_zoomFactor = m_zoomStack.pop(); |
} |
void ScPainter::setRasterOp(int blendMode) |
554,15 → 554,15 |
void ScPainter::setPattern(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY) |
{ |
m_pattern = pattern; |
patternScaleX = scaleX / 100.0; |
patternScaleY = scaleY / 100.0; |
patternOffsetX = offsetX; |
patternOffsetY = offsetY; |
patternRotation = rotation; |
patternSkewX = skewX; |
patternSkewY = skewY; |
patternMirrorX = mirrorX; |
patternMirrorY = mirrorY; |
m_patternScaleX = scaleX / 100.0; |
m_patternScaleY = scaleY / 100.0; |
m_patternOffsetX = offsetX; |
m_patternOffsetY = offsetY; |
m_patternRotation = rotation; |
m_patternSkewX = skewX; |
m_patternSkewY = skewY; |
m_patternMirrorX = mirrorX; |
m_patternMirrorY = mirrorY; |
} |
cairo_pattern_t * ScPainter::getMaskPattern() |
569,7 → 569,7 |
{ |
cairo_save( m_cr ); |
cairo_pattern_t *pat; |
if ((maskMode == 1) || (maskMode == 3)) |
if ((m_maskMode == 1) || (m_maskMode == 3)) |
{ |
double x1 = mask_gradient.origin().x(); |
double y1 = mask_gradient.origin().y(); |
589,7 → 589,7 |
double a = colorStops[offset]->opacity; |
double r, g, b; |
qStopColor.getRgbF(&r, &g, &b); |
if (maskMode == 3) |
if (m_maskMode == 3) |
a = /* 1.0 - */(0.3 * r + 0.59 * g + 0.11 * b); |
cairo_pattern_add_color_stop_rgba (pat, colorStops[ offset ]->rampPoint, r, g, b, a); |
} |
600,15 → 600,15 |
double rotEnd = xy2Deg(x2 - x1, y2 - y1); |
qmatrix.translate(x1, y1); |
qmatrix.rotate(rotEnd); |
qmatrix.shear(mask_gradientSkew, 0); |
qmatrix.translate(0, y1 * (1.0 - mask_gradientScale)); |
qmatrix.shear(m_mask_gradientSkew, 0); |
qmatrix.translate(0, y1 * (1.0 - m_mask_gradientScale)); |
qmatrix.translate(-x1, -y1); |
qmatrix.scale(1, mask_gradientScale); |
qmatrix.scale(1, m_mask_gradientScale); |
} |
else |
{ |
qmatrix.translate(x1, y1); |
qmatrix.shear(-mask_gradientSkew, 0); |
qmatrix.shear(-m_mask_gradientSkew, 0); |
qmatrix.translate(-x1, -y1); |
} |
cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy()); |
617,19 → 617,19 |
} |
else |
{ |
if ((maskMode == 4) || (maskMode == 5)) |
if ((m_maskMode == 4) || (m_maskMode == 5)) |
{ |
imageQ = m_maskPattern->pattern.copy(); |
if (maskMode == 5) |
imageQ.invertPixels(); |
int h = imageQ.height(); |
int w = imageQ.width(); |
m_imageQ = m_maskPattern->pattern.copy(); |
if (m_maskMode == 5) |
m_imageQ.invertPixels(); |
int h = m_imageQ.height(); |
int w = m_imageQ.width(); |
int k; |
QRgb *s; |
QRgb r; |
for( int yi=0; yi < h; ++yi ) |
{ |
s = (QRgb*)(imageQ.scanLine( yi )); |
s = (QRgb*)(m_imageQ.scanLine( yi )); |
for( int xi=0; xi < w; ++xi ) |
{ |
r = *s; |
641,28 → 641,28 |
s++; |
} |
} |
imageMask = cairo_image_surface_create_for_data ((uchar*)imageQ.bits(), CAIRO_FORMAT_ARGB32, w, h, w*4); |
m_imageMask = cairo_image_surface_create_for_data ((uchar*)m_imageQ.bits(), CAIRO_FORMAT_ARGB32, w, h, w*4); |
} |
else |
{ |
imageQ = m_maskPattern->pattern.copy(); |
if (maskMode == 6) |
imageQ.invertPixels(QImage::InvertRgba); |
imageMask = cairo_image_surface_create_for_data ((uchar*)imageQ.bits(), CAIRO_FORMAT_ARGB32, m_maskPattern->getPattern()->width(), m_maskPattern->getPattern()->height(), m_maskPattern->getPattern()->width()*4); |
m_imageQ = m_maskPattern->pattern.copy(); |
if (m_maskMode == 6) |
m_imageQ.invertPixels(QImage::InvertRgba); |
m_imageMask = cairo_image_surface_create_for_data ((uchar*)m_imageQ.bits(), CAIRO_FORMAT_ARGB32, m_maskPattern->getPattern()->width(), m_maskPattern->getPattern()->height(), m_maskPattern->getPattern()->width()*4); |
} |
pat = cairo_pattern_create_for_surface(imageMask); |
pat = cairo_pattern_create_for_surface(m_imageMask); |
cairo_pattern_set_extend(pat, CAIRO_EXTEND_REPEAT); |
cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD); |
cairo_matrix_t matrix; |
QTransform qmatrix; |
qmatrix.translate(mask_patternOffsetX, mask_patternOffsetY); |
qmatrix.rotate(mask_patternRotation); |
qmatrix.shear(-mask_patternSkewX, mask_patternSkewY); |
qmatrix.scale(mask_patternScaleX, mask_patternScaleY); |
qmatrix.translate(m_mask_patternOffsetX, m_mask_patternOffsetY); |
qmatrix.rotate(m_mask_patternRotation); |
qmatrix.shear(-m_mask_patternSkewX, m_mask_patternSkewY); |
qmatrix.scale(m_mask_patternScaleX, m_mask_patternScaleY); |
qmatrix.scale(m_maskPattern->width / static_cast<double>(m_maskPattern->getPattern()->width()), m_maskPattern->height / static_cast<double>(m_maskPattern->getPattern()->height())); |
if (mask_patternMirrorX) |
if (m_mask_patternMirrorX) |
qmatrix.scale(-1, 1); |
if (mask_patternMirrorY) |
if (m_mask_patternMirrorY) |
qmatrix.scale(1, -1); |
cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy()); |
cairo_matrix_invert(&matrix); |
684,7 → 684,7 |
{ |
double r, g, b; |
m_fill.getRgbF(&r, &g, &b); |
if (maskMode > 0) |
if (m_maskMode > 0) |
{ |
cairo_pattern_t *pat = getMaskPattern(); |
cairo_set_source_rgb( m_cr, r, g, b ); |
691,13 → 691,13 |
setRasterOp(m_blendModeFill); |
cairo_clip_preserve(m_cr); |
cairo_mask(m_cr, pat); |
if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6)) |
cairo_surface_destroy(imageMask); |
if ((m_maskMode == 2) || (m_maskMode == 4) || (m_maskMode == 5) || (m_maskMode == 6)) |
cairo_surface_destroy(m_imageMask); |
cairo_pattern_destroy(pat); |
} |
else |
{ |
cairo_set_source_rgba( m_cr, r, g, b, fill_trans ); |
cairo_set_source_rgba( m_cr, r, g, b, m_fill_trans ); |
setRasterOp(m_blendModeFill); |
cairo_fill_preserve(m_cr); |
} |
1387,15 → 1387,15 |
double rotEnd = xy2Deg(x2 - x1, y2 - y1); |
qmatrix.translate(x1, y1); |
qmatrix.rotate(rotEnd); |
qmatrix.shear(gradientSkew, 0); |
qmatrix.translate(0, y1 * (1.0 - gradientScale)); |
qmatrix.shear(m_gradientSkew, 0); |
qmatrix.translate(0, y1 * (1.0 - m_gradientScale)); |
qmatrix.translate(-x1, -y1); |
qmatrix.scale(1, gradientScale); |
qmatrix.scale(1, m_gradientScale); |
} |
else |
{ |
qmatrix.translate(x1, y1); |
qmatrix.shear(-gradientSkew, 0); |
qmatrix.shear(-m_gradientSkew, 0); |
qmatrix.translate(-x1, -y1); |
} |
cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy()); |
1404,19 → 1404,19 |
} |
cairo_set_source (m_cr, pat); |
cairo_clip_preserve (m_cr); |
if (maskMode > 0) |
if (m_maskMode > 0) |
{ |
cairo_pattern_t *patM = getMaskPattern(); |
setRasterOp(m_blendModeFill); |
cairo_mask(m_cr, patM); |
if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6)) |
cairo_surface_destroy(imageMask); |
if ((m_maskMode == 2) || (m_maskMode == 4) || (m_maskMode == 5) || (m_maskMode == 6)) |
cairo_surface_destroy(m_imageMask); |
cairo_pattern_destroy (patM); |
} |
else |
{ |
setRasterOp(m_blendModeFill); |
cairo_paint_with_alpha (m_cr, fill_trans); |
cairo_paint_with_alpha (m_cr, m_fill_trans); |
} |
cairo_pattern_destroy (pat); |
#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2)) |
1443,14 → 1443,14 |
cairo_pattern_set_filter(m_pat, CAIRO_FILTER_GOOD); |
cairo_matrix_t matrix; |
QTransform qmatrix; |
qmatrix.translate(patternOffsetX, patternOffsetY); |
qmatrix.rotate(patternRotation); |
qmatrix.shear(-patternSkewX, patternSkewY); |
qmatrix.scale(patternScaleX, patternScaleY); |
qmatrix.translate(m_patternOffsetX, m_patternOffsetY); |
qmatrix.rotate(m_patternRotation); |
qmatrix.shear(-m_patternSkewX, m_patternSkewY); |
qmatrix.scale(m_patternScaleX, m_patternScaleY); |
qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height())); |
if (patternMirrorX) |
if (m_patternMirrorX) |
qmatrix.scale(-1, 1); |
if (patternMirrorY) |
if (m_patternMirrorY) |
qmatrix.scale(1, -1); |
cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy()); |
cairo_matrix_invert(&matrix); |
1457,19 → 1457,19 |
cairo_pattern_set_matrix (m_pat, &matrix); |
cairo_set_source (m_cr, m_pat); |
cairo_clip_preserve (m_cr); |
if (maskMode > 0) |
if (m_maskMode > 0) |
{ |
cairo_pattern_t *patM = getMaskPattern(); |
setRasterOp(m_blendModeFill); |
cairo_mask(m_cr, patM); |
if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6)) |
cairo_surface_destroy(imageMask); |
if ((m_maskMode == 2) || (m_maskMode == 4) || (m_maskMode == 5) || (m_maskMode == 6)) |
cairo_surface_destroy(m_imageMask); |
cairo_pattern_destroy (patM); |
} |
else |
{ |
setRasterOp(m_blendModeFill); |
cairo_paint_with_alpha (m_cr, fill_trans); |
cairo_paint_with_alpha (m_cr, m_fill_trans); |
} |
cairo_pattern_destroy (m_pat); |
cairo_surface_destroy (image2); |
1480,25 → 1480,25 |
cairo_path_t *path; |
path = cairo_copy_path(m_cr); |
cairo_push_group(m_cr); |
if (hatchUseBackground && hatchBackground.isValid()) |
if (m_hatchUseBackground && m_hatchBackground.isValid()) |
{ |
double r2, g2, b2; |
hatchBackground.getRgbF(&r2, &g2, &b2); |
m_hatchBackground.getRgbF(&r2, &g2, &b2); |
cairo_set_source_rgb(m_cr, r2, g2, b2); |
cairo_fill_preserve(m_cr); |
} |
double r, g, b; |
hatchForeground.getRgbF(&r, &g, &b); |
m_hatchForeground.getRgbF(&r, &g, &b); |
cairo_clip_preserve (m_cr); |
cairo_set_line_width( m_cr, 1 ); |
cairo_set_source_rgb(m_cr, r, g, b); |
translate(hatchWidth / 2.0, hatchHeight / 2.0); |
double lineLen = sqrt((hatchWidth / 2.0) * (hatchWidth / 2.0) + (hatchHeight / 2.0) * (hatchHeight / 2.0)); |
translate(m_hatchWidth / 2.0, m_hatchHeight / 2.0); |
double lineLen = sqrt((m_hatchWidth / 2.0) * (m_hatchWidth / 2.0) + (m_hatchHeight / 2.0) * (m_hatchHeight / 2.0)); |
double dist = 0.0; |
while (dist < lineLen) |
{ |
cairo_save( m_cr ); |
rotate(-hatchAngle); |
rotate(-m_hatchAngle); |
newPath(); |
moveTo(-lineLen, dist); |
lineTo(lineLen, dist); |
1511,10 → 1511,10 |
cairo_stroke( m_cr ); |
} |
cairo_restore( m_cr ); |
if ((hatchType == 1) || (hatchType == 2)) |
if ((m_hatchType == 1) || (m_hatchType == 2)) |
{ |
cairo_save( m_cr ); |
rotate(-hatchAngle + 90); |
rotate(-m_hatchAngle + 90); |
newPath(); |
moveTo(-lineLen, dist); |
lineTo(lineLen, dist); |
1528,10 → 1528,10 |
} |
cairo_restore( m_cr ); |
} |
if (hatchType == 2) |
if (m_hatchType == 2) |
{ |
cairo_save( m_cr ); |
rotate(-hatchAngle + 45); |
rotate(-m_hatchAngle + 45); |
double dDist = dist * sqrt(2.0); |
newPath(); |
moveTo(-lineLen, dDist); |
1546,21 → 1546,21 |
} |
cairo_restore( m_cr ); |
} |
dist += hatchDistance; |
dist += m_hatchDistance; |
} |
cairo_pop_group_to_source (m_cr); |
setRasterOp(m_blendModeFill); |
if (maskMode > 0) |
if (m_maskMode > 0) |
{ |
cairo_pattern_t *patM = getMaskPattern(); |
cairo_pattern_set_filter(patM, CAIRO_FILTER_FAST); |
cairo_mask(m_cr, patM); |
if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6)) |
cairo_surface_destroy(imageMask); |
if ((m_maskMode == 2) || (m_maskMode == 4) || (m_maskMode == 5) || (m_maskMode == 6)) |
cairo_surface_destroy(m_imageMask); |
cairo_pattern_destroy(patM); |
} |
else |
cairo_paint_with_alpha (m_cr, fill_trans); |
cairo_paint_with_alpha (m_cr, m_fill_trans); |
newPath(); |
cairo_append_path(m_cr, path); |
cairo_path_destroy(path); |
1573,10 → 1573,10 |
{ |
cairo_save( m_cr ); |
cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER); |
if( LineWidth == 0 ) |
if( m_LineWidth == 0 ) |
cairo_set_line_width( m_cr, 1.0 / m_zoomFactor ); |
else |
cairo_set_line_width( m_cr, LineWidth ); |
cairo_set_line_width( m_cr, m_LineWidth ); |
if( m_array.count() > 0 ) |
cairo_set_dash( m_cr, m_array.data(), m_array.count(), m_offset); |
else |
1604,15 → 1604,15 |
cairo_pattern_set_filter(m_pat, CAIRO_FILTER_GOOD); |
cairo_matrix_t matrix; |
QTransform qmatrix; |
qmatrix.translate(-LineWidth / 2.0, -LineWidth / 2.0); |
qmatrix.translate(patternOffsetX, patternOffsetY); |
qmatrix.rotate(patternRotation); |
qmatrix.shear(-patternSkewX, patternSkewY); |
qmatrix.scale(patternScaleX, patternScaleY); |
qmatrix.translate(-m_LineWidth / 2.0, -m_LineWidth / 2.0); |
qmatrix.translate(m_patternOffsetX, m_patternOffsetY); |
qmatrix.rotate(m_patternRotation); |
qmatrix.shear(-m_patternSkewX, m_patternSkewY); |
qmatrix.scale(m_patternScaleX, m_patternScaleY); |
qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height())); |
if (patternMirrorX) |
if (m_patternMirrorX) |
qmatrix.scale(-1, 1); |
if (patternMirrorY) |
if (m_patternMirrorY) |
qmatrix.scale(1, -1); |
cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy()); |
cairo_matrix_invert(&matrix); |
1624,7 → 1624,7 |
cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_DEFAULT); |
cairo_pop_group_to_source (m_cr); |
setRasterOp(m_blendModeStroke); |
cairo_paint_with_alpha (m_cr, stroke_trans); |
cairo_paint_with_alpha (m_cr, m_stroke_trans); |
} |
else if (m_strokeMode == 2) |
{ |
1667,15 → 1667,15 |
double rotEnd = xy2Deg(x2 - x1, y2 - y1); |
qmatrix.translate(x1, y1); |
qmatrix.rotate(rotEnd); |
qmatrix.shear(gradientSkew, 0); |
qmatrix.translate(0, y1 * (1.0 - gradientScale)); |
qmatrix.shear(m_gradientSkew, 0); |
qmatrix.translate(0, y1 * (1.0 - m_gradientScale)); |
qmatrix.translate(-x1, -y1); |
qmatrix.scale(1, gradientScale); |
qmatrix.scale(1, m_gradientScale); |
} |
else |
{ |
qmatrix.translate(x1, y1); |
qmatrix.shear(-gradientSkew, 0); |
qmatrix.shear(-m_gradientSkew, 0); |
qmatrix.translate(-x1, -y1); |
} |
cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy()); |
1686,13 → 1686,13 |
cairo_pattern_destroy (pat); |
cairo_pop_group_to_source (m_cr); |
setRasterOp(m_blendModeStroke); |
cairo_paint_with_alpha (m_cr, stroke_trans); |
cairo_paint_with_alpha (m_cr, m_stroke_trans); |
} |
else |
{ |
double r, g, b; |
m_stroke.getRgbF(&r, &g, &b); |
cairo_set_source_rgba( m_cr, r, g, b, stroke_trans ); |
cairo_set_source_rgba( m_cr, r, g, b, m_stroke_trans ); |
setRasterOp(m_blendModeStroke); |
cairo_stroke_preserve( m_cr ); |
} |
1729,17 → 1729,17 |
cairo_pop_group_to_source (m_cr); |
cairo_pattern_set_filter(cairo_get_source(m_cr), CAIRO_FILTER_GOOD); |
setRasterOp(m_blendModeFill); |
if (maskMode > 0) |
if (m_maskMode > 0) |
{ |
cairo_pattern_t *patM = getMaskPattern(); |
cairo_pattern_set_filter(patM, CAIRO_FILTER_GOOD); |
cairo_mask(m_cr, patM); |
if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6)) |
cairo_surface_destroy(imageMask); |
if ((m_maskMode == 2) || (m_maskMode == 4) || (m_maskMode == 5) || (m_maskMode == 6)) |
cairo_surface_destroy(m_imageMask); |
cairo_pattern_destroy(patM); |
} |
else |
cairo_paint_with_alpha (m_cr, fill_trans); |
cairo_paint_with_alpha (m_cr, m_fill_trans); |
cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER); |
cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_DEFAULT); |
} |
1960,7 → 1960,7 |
if (filled) |
{ |
m_fill.getRgbF(&r, &g, &b); |
cairo_set_source_rgba( m_cr, r, g, b, fill_trans ); |
cairo_set_source_rgba( m_cr, r, g, b, m_fill_trans ); |
cairo_new_path( m_cr ); |
cairo_rectangle(m_cr, x, y, ww, hh); |
cairo_fill( m_cr ); |
1969,7 → 1969,7 |
y += extentsF.ascent; |
cairo_move_to (m_cr, x, y); |
m_stroke.getRgbF(&r, &g, &b); |
cairo_set_source_rgba( m_cr, r, g, b, stroke_trans ); |
cairo_set_source_rgba( m_cr, r, g, b, m_stroke_trans ); |
for (int a = 0; a < textList.count(); ++a) |
{ |
cairo_show_text (m_cr, textList[a].toUtf8()); |
/trunk/Scribus/scribus/scpainter.h |
---|
113,7 → 113,7 |
virtual void setPen( const QColor &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo ); |
virtual void setPenOpacity( double op ); |
virtual void setLineWidth( double w); |
virtual void setDash(const QVector<double>& array, double ofs); |
virtual void setDash(const QVector<double>& m_array, double ofs); |
virtual void setBrush( const QColor & ); |
virtual void setBrushOpacity( double op ); |
virtual void setOpacity( double op ); |
164,11 → 164,11 |
bool fillRule; |
}; |
cairo_pattern_t *getMaskPattern(); |
cairo_surface_t *imageMask; |
QImage imageQ; |
cairo_surface_t *m_imageMask; |
QImage m_imageQ; |
QStack<layerProp> Layers; |
QStack<double> zoomStack; |
QStack<layerProp> m_Layers; |
QStack<double> m_zoomStack; |
QImage *m_image; |
double m_layerTransparency; |
int m_blendMode; |
184,20 → 184,20 |
bool mf_outlined; |
/*! \brief Filling */ |
QColor m_fill; |
double fill_trans; |
double m_fill_trans; |
bool m_fillRule; |
int m_fillMode; // 0 = none, 1 = solid, 2 = gradient 3 = pattern 4 = hatch |
double patternScaleX; |
double patternScaleY; |
double patternOffsetX; |
double patternOffsetY; |
double patternRotation; |
double patternSkewX; |
double patternSkewY; |
bool patternMirrorX; |
bool patternMirrorY; |
double gradientScale; |
double gradientSkew; |
double m_patternScaleX; |
double m_patternScaleY; |
double m_patternOffsetX; |
double m_patternOffsetY; |
double m_patternRotation; |
double m_patternSkewX; |
double m_patternSkewY; |
bool m_patternMirrorX; |
bool m_patternMirrorY; |
double m_gradientScale; |
double m_gradientSkew; |
FPoint gradPatchP1; |
FPoint gradPatchP2; |
FPoint gradPatchP3; |
213,31 → 213,31 |
QColor gradPatchColor4; |
QList<QList<meshPoint> > meshGradientArray; |
QList<meshGradientPatch> meshGradientPatches; |
double hatchAngle; |
double hatchDistance; |
int hatchType; // 0 = single 1 = double 2 = triple |
bool hatchUseBackground; |
QColor hatchBackground; |
QColor hatchForeground; |
double hatchWidth; |
double hatchHeight; |
double m_hatchAngle; |
double m_hatchDistance; |
int m_hatchType; // 0 = single 1 = double 2 = triple |
bool m_hatchUseBackground; |
QColor m_hatchBackground; |
QColor m_hatchForeground; |
double m_hatchWidth; |
double m_hatchHeight; |
/*! \brief Stroking */ |
QColor m_stroke; |
double stroke_trans; |
double LineWidth; |
double m_stroke_trans; |
double m_LineWidth; |
int m_strokeMode; // 0 = none, 1 = solid, 2 = gradient 3 = pattern |
int maskMode; // 0 = none, 1 = gradient 2 = pattern |
double mask_patternScaleX; |
double mask_patternScaleY; |
double mask_patternOffsetX; |
double mask_patternOffsetY; |
double mask_patternRotation; |
double mask_patternSkewX; |
double mask_patternSkewY; |
bool mask_patternMirrorX; |
bool mask_patternMirrorY; |
double mask_gradientScale; |
double mask_gradientSkew; |
int m_maskMode; // 0 = none, 1 = gradient 2 = pattern |
double m_mask_patternScaleX; |
double m_mask_patternScaleY; |
double m_mask_patternOffsetX; |
double m_mask_patternOffsetY; |
double m_mask_patternRotation; |
double m_mask_patternSkewX; |
double m_mask_patternSkewY; |
bool m_mask_patternMirrorX; |
bool m_mask_patternMirrorY; |
double m_mask_gradientScale; |
double m_mask_gradientSkew; |
/*! \brief Line End Style */ |
Qt::PenCapStyle PLineEnd; |
248,9 → 248,9 |
double m_offset; |
/*! \brief Zoom Factor of the Painter */ |
double m_zoomFactor; |
bool imageMode; |
bool layeredMode; |
bool svgMode; |
bool m_imageMode; |
bool m_layeredMode; |
bool m_svgMode; |
}; |
#endif |
/trunk/Scribus/scribus/scraction.cpp |
---|
42,9 → 42,9 |
setShortcut(accel); |
initScrAction(); |
setData(d); |
_actionType=aType; |
m_actionType=aType; |
if (_actionType!=Normal) |
if (m_actionType!=Normal) |
connect (this, SIGNAL(triggered()), this, SLOT(triggeredToTriggeredData())); |
} |
54,9 → 54,9 |
initScrAction(); |
icon().addPixmap(icon22, QIcon::Normal, QIcon::On); |
_actionType=aType; |
m_actionType=aType; |
setData(d); |
if (_actionType!=Normal) |
if (m_actionType!=Normal) |
connect (this, SIGNAL(triggered()), this, SLOT(triggeredToTriggeredData())); |
} |
75,7 → 75,7 |
setShortcut(accel); |
initScrAction(); |
icon().addPixmap(QPixmap(), QIcon::Normal, QIcon::On); |
_actionType=UnicodeChar; |
m_actionType=UnicodeChar; |
setData(d); |
connect (this, SIGNAL(triggered()), this, SLOT(triggeredToTriggeredData())); |
} |
83,11 → 83,11 |
void ScrAction::initScrAction() |
{ |
_actionType=ScrAction::Normal; |
menuIndex=-1; |
savedKeySequence=QKeySequence(""); |
shortcutSaved=false; |
fakeToggle=false; |
m_actionType=ScrAction::Normal; |
m_menuIndex=-1; |
m_savedKeySequence=QKeySequence(""); |
m_shortcutSaved=false; |
m_fakeToggle=false; |
} |
ScrAction::~ScrAction() |
96,28 → 96,28 |
void ScrAction::triggeredToTriggeredData() |
{ |
if (_actionType==ScrAction::DataInt) |
if (m_actionType==ScrAction::DataInt) |
emit triggeredData(data().toInt()); |
if (_actionType==ScrAction::DataDouble) |
if (m_actionType==ScrAction::DataDouble) |
emit triggeredData(data().toDouble()); |
if (_actionType==ScrAction::DataQString) |
if (m_actionType==ScrAction::DataQString) |
emit triggeredData(data().toString()); |
if (_actionType==ScrAction::DLL) |
if (m_actionType==ScrAction::DLL) |
qDebug()<<"if (_actionType==ScrAction::DLL): please fix in ScrAction::triggeredToTriggeredData()"; |
// emit triggeredData(pluginID); |
if (_actionType==ScrAction::Window) |
if (m_actionType==ScrAction::Window) |
emit triggeredData(data().toInt()); |
if (_actionType==ScrAction::RecentFile) |
if (m_actionType==ScrAction::RecentFile) |
emit triggeredData(data().toString()); |
if (_actionType==ScrAction::RecentPaste) |
if (m_actionType==ScrAction::RecentPaste) |
emit triggeredData(data().toString()); |
if (_actionType==ScrAction::RecentScript) |
if (m_actionType==ScrAction::RecentScript) |
emit triggeredData(data().toString()); |
if (_actionType==ScrAction::UnicodeChar) |
if (m_actionType==ScrAction::UnicodeChar) |
emit triggeredUnicodeShortcut(data().toInt()); |
if (_actionType==ScrAction::Layer) |
if (m_actionType==ScrAction::Layer) |
emit triggeredData(data().toInt()); |
if (_actionType==ScrAction::ActionDLL) |
if (m_actionType==ScrAction::ActionDLL) |
emit triggeredData(((ScribusMainWindow*)parent())->doc); |
} |
125,24 → 125,24 |
{ |
if (isCheckable()) |
{ |
if (_actionType==ScrAction::DataInt) |
if (m_actionType==ScrAction::DataInt) |
emit toggledData(ison, data().toInt()); |
if (_actionType==ScrAction::DataDouble) |
if (m_actionType==ScrAction::DataDouble) |
emit toggledData(ison, data().toDouble()); |
if (_actionType==ScrAction::DataQString) |
if (m_actionType==ScrAction::DataQString) |
emit toggledData(ison, data().toString()); |
if (_actionType==ScrAction::DLL) |
if (m_actionType==ScrAction::DLL) |
qDebug()<<"if (_actionType==ScrAction::DLL): please fix in ScrAction::toggledToToggledData(bool ison)"; |
// emit toggledData(ison, pluginID); |
if (_actionType==ScrAction::Window) |
if (m_actionType==ScrAction::Window) |
emit toggledData(ison, data().toInt()); |
if (_actionType==ScrAction::RecentFile) |
if (m_actionType==ScrAction::RecentFile) |
emit toggledData(ison, data().toString()); |
if (_actionType==ScrAction::RecentPaste) |
if (m_actionType==ScrAction::RecentPaste) |
emit toggledData(ison, data().toString()); |
if (_actionType==ScrAction::RecentScript) |
if (m_actionType==ScrAction::RecentScript) |
emit toggledData(ison, text()); |
if (_actionType==ScrAction::Layer) |
if (m_actionType==ScrAction::Layer) |
emit toggledData(ison, data().toInt()); |
// no toggle for UnicodeChar |
} |
150,10 → 150,10 |
void ScrAction::addedTo ( int index, QMenu * menu ) |
{ |
if (menuIndex==-1) // Add the first time, not for secondary popups. |
if (m_menuIndex==-1) // Add the first time, not for secondary popups. |
{ |
menuIndex=index; |
popupMenuAddedTo=menu; |
m_menuIndex=index; |
m_popupMenuAddedTo=menu; |
} |
} |
182,17 → 182,17 |
int ScrAction::getMenuIndex() const |
{ |
return menuIndex; |
return m_menuIndex; |
} |
bool ScrAction::isDLLAction() const |
{ |
return _actionType==ScrAction::DLL; |
return m_actionType==ScrAction::DLL; |
} |
int ScrAction::dllID() const |
{ |
if (_actionType==ScrAction::DLL) |
if (m_actionType==ScrAction::DLL) |
return data().toInt(); |
return -1; |
} |
199,7 → 199,7 |
void ScrAction::setToggleAction(bool isToggle, bool isFakeToggle) |
{ |
if (_actionType!=Normal) |
if (m_actionType!=Normal) |
{ |
if (isToggle) |
connect(this, SIGNAL(toggled(bool)), this, SLOT(toggledToToggledData(bool))); |
208,7 → 208,7 |
} |
QAction::setCheckable(isToggle); |
setChecked(isToggle); // set default state of the action's checkbox - PV |
fakeToggle=isFakeToggle; |
m_fakeToggle=isFakeToggle; |
//if (fakeToggle) |
//connect(this, toggled(bool), this, triggered()); |
} |
215,27 → 215,27 |
void ScrAction::saveShortcut() |
{ |
if(!shortcutSaved) |
if(!m_shortcutSaved) |
{ |
savedKeySequence=shortcut(); |
m_savedKeySequence=shortcut(); |
setShortcut(QKeySequence("")); |
shortcutSaved=true; |
m_shortcutSaved=true; |
} |
} |
void ScrAction::restoreShortcut() |
{ |
if (shortcutSaved) |
if (m_shortcutSaved) |
{ |
setShortcut(savedKeySequence); |
savedKeySequence=QKeySequence(""); |
shortcutSaved=false; |
setShortcut(m_savedKeySequence); |
m_savedKeySequence=QKeySequence(""); |
m_shortcutSaved=false; |
} |
} |
ScrAction::ActionType ScrAction::actionType() |
{ |
return _actionType; |
return m_actionType; |
} |
int ScrAction::actionInt() const |
263,7 → 263,7 |
void ScrAction::toggle() |
{ |
QAction::toggle(); |
if (fakeToggle) |
if (m_fakeToggle) |
emit triggered(); |
} |
/trunk/Scribus/scribus/scraction.h |
---|
137,7 → 137,7 |
* but we connect activated() only, eg itemLock. This means they can be setOn() |
* to the status of an item's bool, eg isLocked(), without toggling anything. |
*/ |
void setToggleAction(bool isToggle, bool fakeToggle=false); |
void setToggleAction(bool isToggle, bool m_fakeToggle=false); |
/*! |
\author Craig Bradney |
187,12 → 187,12 |
protected: |
void initScrAction(); |
int menuIndex; |
ActionType _actionType; |
QMenu *popupMenuAddedTo; |
QKeySequence savedKeySequence; |
bool shortcutSaved; |
bool fakeToggle; |
int m_menuIndex; |
ActionType m_actionType; |
QMenu *m_popupMenuAddedTo; |
QKeySequence m_savedKeySequence; |
bool m_shortcutSaved; |
bool m_fakeToggle; |
QIcon m_icon; |
/*! |
/trunk/Scribus/scribus/scribus.cpp |
---|
293,13 → 293,13 |
actionManager=0; |
appModeHelper=0; |
scrMenuMgr=0; |
prefsManager=0; |
formatsManager=0; |
m_prefsManager=0; |
m_formatsManager=0; |
resourceManager=0; |
UrlLauncher::instance(); |
mainWindowStatusLabel=0; |
m_mainWindowStatusLabel=0; |
ExternalApp=0; |
ScriptRunning = 0; |
m_ScriptRunning = 0; |
#ifdef Q_OS_MAC |
//commenting this out until this is resolved :https://bugreports.qt.io/browse/QTBUG-44565 |
//ScQApp->setAttribute(Qt::AA_DontShowIconsInMenus); |
362,14 → 362,14 |
appModeHelper = new AppModeHelper(); |
appModeHelper->setup(actionManager, &scrActions, &scrRecentFileActions, &scrWindowsActions, &scrScrapActions, &scrLayersActions, &scrRecentPasteActions); |
scrMenuMgr = new ScMWMenuManager(menuBar(), actionManager); |
prefsManager = PrefsManager::instance(); |
formatsManager = FormatsManager::instance(); |
objectSpecificUndo = false; |
m_prefsManager = PrefsManager::instance(); |
m_formatsManager = FormatsManager::instance(); |
m_objectSpecificUndo = false; |
undoManager = UndoManager::instance(); |
PrefsContext *undoPrefs = prefsManager->prefsFile->getContext("undo"); |
undoManager->setUndoEnabled(undoPrefs->getBool("enabled", true)); |
tocGenerator = new TOCGenerator(); |
m_undoManager = UndoManager::instance(); |
PrefsContext *undoPrefs = m_prefsManager->prefsFile->getContext("undo"); |
m_undoManager->setUndoEnabled(undoPrefs->getBool("enabled", true)); |
m_tocGenerator = new TOCGenerator(); |
m_marksCount = 0; |
initDefaultValues(); |
393,7 → 393,7 |
if (primaryMainWindow) |
ScCore->setSplashStatus( tr("Applying User Shortcuts") ); |
prefsManager->applyLoadedShortCuts(); |
m_prefsManager->applyLoadedShortCuts(); |
initKeyboardShortcuts(); |
resize(610, 600); |
400,7 → 400,7 |
mdiArea = new QMdiArea(this); |
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
if (prefsManager->appPrefs.uiPrefs.useTabs) |
if (m_prefsManager->appPrefs.uiPrefs.useTabs) |
{ |
mdiArea->setViewMode(QMdiArea::TabbedView); |
mdiArea->setTabsClosable(true); |
415,30 → 415,30 |
connect( scrActions["windowsTile"], SIGNAL(triggered()) , mdiArea, SLOT(tileSubWindows()) ); |
initPalettes(); |
prefsManager->setupMainWindow(this); |
m_prefsManager->setupMainWindow(this); |
viewToolBar->previewQualitySwitcher->setCurrentIndex(prefsManager->appPrefs.itemToolPrefs.imageLowResType); |
viewToolBar->previewQualitySwitcher->setCurrentIndex(m_prefsManager->appPrefs.itemToolPrefs.imageLowResType); |
if (primaryMainWindow) |
ScCore->setSplashStatus( tr("Initializing Story Editor") ); |
storyEditor = new StoryEditor(this); |
DocDir = prefsManager->documentDir(); |
DocDir = m_prefsManager->documentDir(); |
if (primaryMainWindow) |
ScCore->setSplashStatus( tr("Initializing Languages") ); |
LanguageManager::instance(); |
QString preLang(prefsManager->appPrefs.hyphPrefs.Language); |
QString preLang(m_prefsManager->appPrefs.hyphPrefs.Language); |
initHyphenator(); |
if (!LanguageManager::instance()->getHyphFilename( preLang ).isEmpty() ) |
prefsManager->appPrefs.hyphPrefs.Language = preLang; |
m_prefsManager->appPrefs.hyphPrefs.Language = preLang; |
if (primaryMainWindow) |
ScCore->setSplashStatus( tr("Reading Scrapbook") ); |
initScrapbook(); |
scrActions["helpTooltips"]->setChecked(prefsManager->appPrefs.displayPrefs.showToolTips); |
scrActions["showMouseCoordinates"]->setChecked(prefsManager->appPrefs.displayPrefs.showMouseCoordinates); |
scrActions["stickyTools"]->setChecked(prefsManager->appPrefs.uiPrefs.stickyTools); |
scrActions["helpTooltips"]->setChecked(m_prefsManager->appPrefs.displayPrefs.showToolTips); |
scrActions["showMouseCoordinates"]->setChecked(m_prefsManager->appPrefs.displayPrefs.showMouseCoordinates); |
scrActions["stickyTools"]->setChecked(m_prefsManager->appPrefs.uiPrefs.stickyTools); |
ToggleTips(); |
ToggleMouseTips(); |
propertiesPalette->setFontSize(); |
457,18 → 457,18 |
QString Cpfad = QDir::toNativeSeparators(ScPaths::getApplicationDataDir())+"DefaultColors.xml"; |
QFile fc(Cpfad); |
if (fc.exists()) |
csm.loadPalette(Cpfad, m_doc, prefsManager->appPrefs.colorPrefs.DColors, prefsManager->appPrefs.defaultGradients, prefsManager->appPrefs.defaultPatterns, false); |
csm.loadPalette(Cpfad, m_doc, m_prefsManager->appPrefs.colorPrefs.DColors, m_prefsManager->appPrefs.defaultGradients, m_prefsManager->appPrefs.defaultPatterns, false); |
else |
{ |
if (prefsManager->appPrefs.colorPrefs.DColorSet != "Scribus Small") |
if (m_prefsManager->appPrefs.colorPrefs.DColorSet != "Scribus Small") |
{ |
QStringList CustomColorSets = csm.userPaletteNames(); |
if (CustomColorSets.contains(prefsManager->appPrefs.colorPrefs.DColorSet)) |
Cpfad = csm.userPaletteFileFromName(prefsManager->appPrefs.colorPrefs.DColorSet); |
if (CustomColorSets.contains(m_prefsManager->appPrefs.colorPrefs.DColorSet)) |
Cpfad = csm.userPaletteFileFromName(m_prefsManager->appPrefs.colorPrefs.DColorSet); |
else |
Cpfad = csm.paletteFileFromName(prefsManager->appPrefs.colorPrefs.DColorSet); |
Cpfad = csm.paletteFileFromName(m_prefsManager->appPrefs.colorPrefs.DColorSet); |
if (!Cpfad.isEmpty()) |
csm.loadPalette(Cpfad, m_doc, prefsManager->appPrefs.colorPrefs.DColors, prefsManager->appPrefs.defaultGradients, prefsManager->appPrefs.defaultPatterns, false); |
csm.loadPalette(Cpfad, m_doc, m_prefsManager->appPrefs.colorPrefs.DColors, m_prefsManager->appPrefs.defaultGradients, m_prefsManager->appPrefs.defaultPatterns, false); |
} |
} |
appModeHelper->setStartupActionsEnabled(false); |
500,7 → 500,7 |
fileToolBar = new FileToolBar(this); |
editToolBar = new EditToolBar(this); |
UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget"); |
undoManager->registerGui(uWidget); |
m_undoManager->registerGui(uWidget); |
modeToolBar = new ModeToolBar(this); |
pdfToolBar = new PDFToolBar(this); |
viewToolBar = new ViewToolBar(this); |
553,18 → 553,18 |
HaveDoc = false; |
view = NULL; |
doc = NULL; |
DocNr = 1; |
PrinterUsed = false; |
m_DocNr = 1; |
m_PrinterUsed = false; |
PDef.Pname = ""; |
PDef.Dname = ""; |
PDef.Command = ""; |
keyrep = false; |
_arrowKeyDown = false; |
m_keyrep = false; |
m__arrowKeyDown = false; |
ClipB = QApplication::clipboard(); |
for (int i=0; i<PS_MAX ; ++i) |
palettesStatus[i] = false; |
m_palettesStatus[i] = false; |
for (int i=0; i<GS_MAX ; ++i) |
guidesStatus[i] = false; |
m_guidesStatus[i] = false; |
#ifdef HAVE_OSG |
QStringList supportedExts; |
supportedExts << "osg" << "dxf" << "flt" << "ive" << "geo" << "sta" << "stl" << "logo" << "3ds" << "ac" << "obj"; |
606,7 → 606,7 |
if ((ScrAction*)(it.value())!=NULL) |
{ |
QString accelerator = it.value()->shortcut().toString(); |
prefsManager->setKeyEntry(it.key(), it.value()->cleanMenuText(), accelerator,0); |
m_prefsManager->setKeyEntry(it.key(), it.value()->cleanMenuText(), accelerator,0); |
} |
//else |
// qDebug() << it.key(); |
694,21 → 694,21 |
undoPalette = new UndoPalette(this, "undoPalette"); |
undoPalette->installEventFilter(this); |
undoManager->registerGui(undoPalette); |
m_undoManager->registerGui(undoPalette); |
connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); |
connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); |
// initializing style manager here too even it's not strictly a palette |
styleManager = new StyleManager(this, "styleManager"); |
m_styleManager = new StyleManager(this, "styleManager"); |
SMCharacterStyle *tmpCS = new SMCharacterStyle(); |
styleManager->addStyle(new SMParagraphStyle(tmpCS->tmpStyles())); |
styleManager->addStyle(tmpCS); |
styleManager->addStyle(new SMTableStyle()); |
styleManager->addStyle(new SMCellStyle()); |
styleManager->addStyle(new SMLineStyle()); |
connect( scrActions["editStyles"], SIGNAL(toggled(bool)), styleManager, SLOT(setPaletteShown(bool)) ); |
connect( styleManager, SIGNAL(paletteShown(bool)), scrActions["editStyles"], SLOT(setChecked(bool))); |
styleManager->installEventFilter(this); |
m_styleManager->addStyle(new SMParagraphStyle(tmpCS->tmpStyles())); |
m_styleManager->addStyle(tmpCS); |
m_styleManager->addStyle(new SMTableStyle()); |
m_styleManager->addStyle(new SMCellStyle()); |
m_styleManager->addStyle(new SMLineStyle()); |
connect( scrActions["editStyles"], SIGNAL(toggled(bool)), m_styleManager, SLOT(setPaletteShown(bool)) ); |
connect( m_styleManager, SIGNAL(paletteShown(bool)), scrActions["editStyles"], SLOT(setChecked(bool))); |
m_styleManager->installEventFilter(this); |
// initializing mark`s manager |
marksManager = new MarksManager(this, "marksManager"); |
751,25 → 751,25 |
void ScribusMainWindow::initScrapbook() |
{ |
QString scrapbookFileO = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrap13.scs"); |
QString scrapbookFileO = QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrap13.scs"); |
QFileInfo scrapbookFileInfoO = QFileInfo(scrapbookFileO); |
if (scrapbookFileInfoO.exists()) |
{ |
scrapbookPalette->readOldContents(scrapbookFileO, QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/main")); |
scrapbookPalette->readOldContents(scrapbookFileO, QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrapbook/main")); |
QDir d = QDir(); |
d.rename(scrapbookFileO, QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrap13.backup")); |
d.rename(scrapbookFileO, QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrap13.backup")); |
} |
QString scrapbookTemp = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/tmp"); |
QString scrapbookTemp = QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrapbook/tmp"); |
QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp); |
if (scrapbookTempInfo.exists()) |
scrapbookPalette->readTempContents(scrapbookTemp); |
QString scrapbookFile = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/main"); |
QString scrapbookFile = QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrapbook/main"); |
QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile); |
if (scrapbookFileInfo.exists()) |
scrapbookPalette->readContents(scrapbookFile); |
scrapbookPalette->setScrapbookFileName(scrapbookFile); |
ScCore->fileWatcher->addDir(scrapbookFile, true); |
scrapbookPalette->setOpenScrapbooks(prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks); |
scrapbookPalette->setOpenScrapbooks(m_prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks); |
rebuildRecentPasteMenu(); |
connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu())); |
connect(ScCore->fileWatcher, SIGNAL(dirChanged(QString )), scrapbookPalette, SLOT(reloadLib(QString ))); |
1289,8 → 1289,8 |
zoomLayout->addWidget( zoomDefaultToolbarButton ); |
zoomLayout->addWidget( zoomInToolbarButton ); |
mainWindowStatusLabel = new QLabel( " ", statusBar()); |
mainWindowStatusLabel->setFont(fo); |
m_mainWindowStatusLabel = new QLabel( " ", statusBar()); |
m_mainWindowStatusLabel->setFont(fo); |
mainWindowProgressBar = new QProgressBar(statusBar()); |
mainWindowProgressBar->setAlignment(Qt::AlignHCenter); |
mainWindowProgressBar->setFixedWidth( 100 ); |
1335,7 → 1335,7 |
*/ |
statusBar()->setFont(fo); |
statusBar()->addPermanentWidget(mainWindowStatusLabel, 5); |
statusBar()->addPermanentWidget(m_mainWindowStatusLabel, 5); |
QLabel *s=new QLabel(""); |
QLabel *s2=new QLabel(""); |
QLabel *s3=new QLabel(""); |
1451,20 → 1451,20 |
void ScribusMainWindow::setTempStatusBarText(const QString &text) |
{ |
if (mainWindowStatusLabel) |
if (m_mainWindowStatusLabel) |
{ |
if (text.isEmpty()) |
mainWindowStatusLabel->setText(statusLabelText); |
m_mainWindowStatusLabel->setText(m_statusLabelText); |
else |
mainWindowStatusLabel->setText(text); |
m_mainWindowStatusLabel->setText(text); |
} |
} |
void ScribusMainWindow::setStatusBarInfoText(QString newText) |
{ |
if (mainWindowStatusLabel) |
mainWindowStatusLabel->setText(newText); |
statusLabelText = newText; |
if (m_mainWindowStatusLabel) |
m_mainWindowStatusLabel->setText(newText); |
m_statusLabelText = newText; |
} |
1533,12 → 1533,12 |
UndoTransaction activeTransaction; |
if (currItem->HasSel){ |
if (UndoManager::undoEnabled()) |
activeTransaction = undoManager->beginTransaction(Um::Selection, Um::IGroup, Um::ReplaceText, "", Um::IDelete); |
activeTransaction = m_undoManager->beginTransaction(Um::Selection, Um::IGroup, Um::ReplaceText, "", Um::IDelete); |
currItem->deleteSelectedTextFromFrame(); |
} |
if (UndoManager::undoEnabled()) |
{ |
SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo()); |
SimpleState *ss = dynamic_cast<SimpleState*>(m_undoManager->getLastUndo()); |
if (ss && ss->get("ETEA") == "insert_frametext") |
ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(QChar(unicodevalue))); |
else { |
1553,7 → 1553,7 |
undoTarget = doc; |
ss->set("noteframeName", currItem->getUName()); |
} |
undoManager->action(undoTarget, ss); |
m_undoManager->action(undoTarget, ss); |
} |
} |
currItem->itemText.insertChars(QString(QChar(unicodevalue)), true); |
1573,7 → 1573,7 |
#else |
if (UndoManager::undoEnabled()) |
{ |
SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo()); |
SimpleState *ss = dynamic_cast<SimpleState*>(m_undoManager->getLastUndo()); |
if (ss && ss->get("ETEA") == "insert_frametext") |
ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(SpecialChars::SHYPHEN)); |
else { |
1588,7 → 1588,7 |
undoTarget = doc; |
ss->set("noteframeName", currItem->getUName()); |
} |
undoManager->action(undoTarget, ss); |
m_undoManager->action(undoTarget, ss); |
} |
} |
currItem->itemText.insertChars(QString(SpecialChars::SHYPHEN), true); |
1608,7 → 1608,7 |
{ |
bool retVal; |
if (e->type() == QEvent::ToolTip) |
return (!prefsManager->appPrefs.displayPrefs.showToolTips); |
return (!m_prefsManager->appPrefs.displayPrefs.showToolTips); |
if ( e->type() == QEvent::KeyPress ) |
{ |
1666,9 → 1666,9 |
return; |
} |
} |
if (keyrep) |
if (m_keyrep) |
return; |
keyrep = true; |
m_keyrep = true; |
int keyMod=0; |
if (k->modifiers() & Qt::ShiftModifier) |
keyMod |= Qt::SHIFT; |
1679,7 → 1679,7 |
//User presses escape and we have a doc open, and we have an item selected |
if ((kk == Qt::Key_Escape) && (HaveDoc)) |
{ |
keyrep = false; |
m_keyrep = false; |
PageItem *currItem; |
if (!doc->m_Selection->isEmpty()) |
{ |
1734,7 → 1734,7 |
slotSelect(); |
if (doc->m_Selection->isEmpty()) |
HaveNewSel(); |
prefsManager->appPrefs.uiPrefs.stickyTools = false; |
m_prefsManager->appPrefs.uiPrefs.stickyTools = false; |
scrActions["stickyTools"]->setChecked(false); |
return; |
} |
1777,13 → 1777,13 |
if ((doc->appMode != modeEdit) && (doc->m_Selection->isEmpty())) |
{ |
int pg; |
int wheelVal = prefsManager->mouseWheelJump(); |
int wheelVal = m_prefsManager->mouseWheelJump(); |
if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
wheelVal = qMax(qRound(wheelVal / 10.0), 1); |
switch (kk) |
{ |
case Qt::Key_Space: |
keyrep = false; |
m_keyrep = false; |
if (doc->appMode == modePanning) |
view->requestMode(modeNormal); |
else |
1792,7 → 1792,7 |
break; |
case Qt::Key_PageUp: |
if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode()) |
view->scrollBy(0, -prefsManager->mouseWheelJump()); |
view->scrollBy(0, -m_prefsManager->mouseWheelJump()); |
else |
{ |
pg = doc->currentPageNumber(); |
1803,12 → 1803,12 |
if (pg > -1) |
view->GotoPage(pg); |
} |
keyrep = false; |
m_keyrep = false; |
return; |
break; |
case Qt::Key_PageDown: |
if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode()) |
view->scrollBy(0, prefsManager->mouseWheelJump()); |
view->scrollBy(0, m_prefsManager->mouseWheelJump()); |
else |
{ |
pg = doc->currentPageNumber(); |
1819,33 → 1819,33 |
if (pg < static_cast<int>(doc->Pages->count())) |
view->GotoPage(pg); |
} |
keyrep = false; |
m_keyrep = false; |
return; |
break; |
case Qt::Key_Left: |
view->scrollBy(-wheelVal, 0); |
keyrep = false; |
m_keyrep = false; |
return; |
break; |
case Qt::Key_Right: |
view->scrollBy(wheelVal, 0); |
keyrep = false; |
m_keyrep = false; |
return; |
break; |
case Qt::Key_Up: |
view->scrollBy(0, -wheelVal); |
keyrep = false; |
m_keyrep = false; |
return; |
break; |
case Qt::Key_Down: |
view->scrollBy(0, wheelVal); |
keyrep = false; |
m_keyrep = false; |
return; |
break; |
case Qt::Key_Tab: |
if (buttonModifiers == Qt::ControlModifier) |
{ |
keyrep = false; |
m_keyrep = false; |
windows = mdiArea->subWindowList(); |
if (windows.count() > 1) |
{ |
1878,9 → 1878,9 |
case Qt::Key_Right: |
case Qt::Key_Up: |
case Qt::Key_Down: |
_arrowKeyDown = true; |
m__arrowKeyDown = true; |
} |
keyrep = false; |
m_keyrep = false; |
} |
void ScribusMainWindow::keyReleaseEvent(QKeyEvent *k) |
1896,7 → 1896,7 |
if (doc->appMode == modeMagnifier) |
view->setCursor(IconManager::instance()->loadCursor("LupeZ.xpm")); |
} |
if (k->isAutoRepeat() || !_arrowKeyDown) |
if (k->isAutoRepeat() || !m__arrowKeyDown) |
return; |
switch(k->key()) |
{ |
1904,7 → 1904,7 |
case Qt::Key_Right: |
case Qt::Key_Up: |
case Qt::Key_Down: |
_arrowKeyDown = false; |
m__arrowKeyDown = false; |
if ((HaveDoc) && (!zoomSpinBox->hasFocus()) && (!pageSelector->hasFocus())) |
{ |
int docSelectionCount=doc->m_Selection->count(); |
1992,12 → 1992,12 |
// Clean up plugins, THEN save prefs to disk |
ScCore->pluginManager->cleanupPlugins(); |
if (!prefsManager->appPrefs.scrapbookPrefs.persistentScrapbook) |
if (!m_prefsManager->appPrefs.scrapbookPrefs.persistentScrapbook) |
scrapbookPalette->CleanUpTemp(); |
prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks.clear(); |
prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks = scrapbookPalette->getOpenScrapbooks(); |
m_prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks.clear(); |
m_prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks = scrapbookPalette->getOpenScrapbooks(); |
if (!emergencyActivated) |
prefsManager->SavePrefs(); |
m_prefsManager->SavePrefs(); |
UndoManager::deleteInstance(); |
FormatsManager::deleteInstance(); |
UrlLauncher::deleteInstance(); |
2017,13 → 2017,13 |
bool ScribusMainWindow::arrowKeyDown() |
{ |
return _arrowKeyDown; |
return m__arrowKeyDown; |
} |
void ScribusMainWindow::startUpDialog() |
{ |
bool docSet = false; |
PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false); |
PrefsContext* docContext = m_prefsManager->prefsFile->getContext("docdirs", false); |
NewDoc* dia = new NewDoc(this, RecentDocs, true, ScCore->getGuiLanguage()); |
if (dia->exec()) |
{ |
2095,9 → 2095,9 |
{ |
appModeHelper->setStartupActionsEnabled(false); |
} |
prefsManager->setShowStartupDialog(!dia->startUpDialog->isChecked()); |
m_prefsManager->setShowStartupDialog(!dia->startUpDialog->isChecked()); |
delete dia; |
mainWindowStatusLabel->setText( tr("Ready")); |
m_mainWindowStatusLabel->setText( tr("Ready")); |
if (docSet) |
slotDocSetup(); |
} |
2137,7 → 2137,7 |
{ |
doc->setPageSetFirstPage(facingPages, firstPage); |
doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight()); |
mainWindowStatusLabel->setText( tr("Ready")); |
m_mainWindowStatusLabel->setText( tr("Ready")); |
HaveNewDoc(); |
doc->reformPages(true); |
retVal = true; |
2163,10 → 2163,10 |
{ |
if (HaveDoc) |
outlinePalette->buildReopenVals(); |
undoManager->setUndoEnabled(false); |
m_undoManager->setUndoEnabled(false); |
MarginStruct margins(topMargin, leftMargin, bottomMargin, rightMargin); |
DocPagesSetup pagesSetup(pageArrangement, firstPageLocation, firstPageNumber, orientation, autoTextFrames, columnDistance, columnCount); |
QString newDocName( tr("Document")+"-"+QString::number(DocNr)); |
QString newDocName( tr("Document")+"-"+QString::number(m_DocNr)); |
ScribusDoc *tempDoc = new ScribusDoc(); |
if (requiresGUI) |
doc=tempDoc; |
2190,13 → 2190,13 |
} |
else |
{ |
if (prefsManager->appPrefs.colorPrefs.DColorSet != "Scribus Small") |
if (m_prefsManager->appPrefs.colorPrefs.DColorSet != "Scribus Small") |
{ |
QStringList CustomColorSets = csm.userPaletteNames(); |
if (CustomColorSets.contains(prefsManager->appPrefs.colorPrefs.DColorSet)) |
Cpfad = csm.userPaletteFileFromName(prefsManager->appPrefs.colorPrefs.DColorSet); |
if (CustomColorSets.contains(m_prefsManager->appPrefs.colorPrefs.DColorSet)) |
Cpfad = csm.userPaletteFileFromName(m_prefsManager->appPrefs.colorPrefs.DColorSet); |
else |
Cpfad = csm.paletteFileFromName(prefsManager->appPrefs.colorPrefs.DColorSet); |
Cpfad = csm.paletteFileFromName(m_prefsManager->appPrefs.colorPrefs.DColorSet); |
if (!Cpfad.isEmpty()) |
csm.loadPalette(Cpfad, doc, colorList, gradientsList, patternsList, false); |
doc->PageColors = colorList; |
2204,7 → 2204,7 |
doc->docPatterns = patternsList; |
} |
else |
doc->PageColors = prefsManager->appPrefs.colorPrefs.DColors; |
doc->PageColors = m_prefsManager->appPrefs.colorPrefs.DColors; |
} |
tempDoc->PageColors.ensureDefaultColors(); |
tempDoc->setup(unitIndex, pageArrangement, firstPageLocation, orientation, firstPageNumber, defaultPageSize, newDocName); |
2211,7 → 2211,7 |
if (requiresGUI) |
{ |
HaveDoc++; |
DocNr++; |
m_DocNr++; |
} |
if (ScCore->haveCMS() && tempDoc->cmsSettings().CMSinUse) |
recalcColors(); |
2249,13 → 2249,13 |
if (requiresGUI) |
{ |
tempDoc->createHyphenator(); |
tempDoc->docHyphenator->ignoredWords = prefsManager->appPrefs.hyphPrefs.ignoredWords; |
tempDoc->docHyphenator->specialWords = prefsManager->appPrefs.hyphPrefs.specialWords; |
tempDoc->docHyphenator->ignoredWords = m_prefsManager->appPrefs.hyphPrefs.ignoredWords; |
tempDoc->docHyphenator->specialWords = m_prefsManager->appPrefs.hyphPrefs.specialWords; |
} |
tempDoc->setLoading(false); |
//run after setGUI to set up guidepalette ok |
tempView->setScale(prefsManager->displayScale()); |
tempView->setScale(m_prefsManager->displayScale()); |
if (requiresGUI) |
{ |
//done in newactinw actionManager->connectNewViewActions(tempView); |
2301,13 → 2301,13 |
connect(doc, SIGNAL(updateAutoSaveClock()), view->clockLabel, SLOT(resetTime())); |
view->clockLabel->resetTime(); |
scrActions["viewToggleCMS"]->setChecked(tempDoc->HasCMS); |
undoManager->switchStack(tempDoc->DocName); |
styleManager->setDoc(tempDoc); |
m_undoManager->switchStack(tempDoc->DocName); |
m_styleManager->setDoc(tempDoc); |
marksManager->setDoc(tempDoc); |
nsEditor->setDoc(tempDoc); |
tocGenerator->setDoc(tempDoc); |
m_tocGenerator->setDoc(tempDoc); |
} |
undoManager->setUndoEnabled(true); |
m_undoManager->setUndoEnabled(true); |
return tempDoc; |
} |
2337,13 → 2337,13 |
ScribusWin* w = new ScribusWin(mdiArea, doc); |
w->setMainWindow(this); |
view = new ScribusView(w, this, doc); |
view->setScale(prefsManager->displayScale()); |
view->setScale(m_prefsManager->displayScale()); |
w->setView(view); |
ActWin = w; |
w->setCentralWidget(view); |
actionManager->connectNewViewActions(view); |
alignDistributePalette->setDoc(doc); |
connect(undoManager, SIGNAL(undoRedoDone()), view, SLOT(DrawNew())); |
connect(m_undoManager, SIGNAL(undoRedoDone()), view, SLOT(DrawNew())); |
view->show(); |
} |
2449,9 → 2449,9 |
docCheckerPalette->clearErrorList(); |
if (HaveDoc && (doc != NULL) && doc->hasGUI()) |
{ |
disconnect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin())); |
disconnect(undoManager, SIGNAL(undoRedoDone()) , doc, SLOT(undoRedoDone())); |
disconnect(undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew())); |
disconnect(m_undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin())); |
disconnect(m_undoManager, SIGNAL(undoRedoDone()) , doc, SLOT(undoRedoDone())); |
disconnect(m_undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew())); |
disconnect(doc, SIGNAL(addBookmark(PageItem *)), this, SLOT(AddBookMark(PageItem *))); |
disconnect(doc, SIGNAL(deleteBookmark(PageItem *)), this, SLOT(DelBookMark(PageItem *))); |
unitSwitcher->disconnect(); |
2466,12 → 2466,12 |
pageSelector->setEnabled(false); |
} |
doc = ActWin->doc(); |
undoManager->switchStack(doc->DocName); |
m_undoManager->switchStack(doc->DocName); |
if ((doc != NULL) && doc->hasGUI()) |
{ |
connect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin())); |
connect(undoManager, SIGNAL(undoRedoDone()) , doc, SLOT(undoRedoDone())); |
connect(undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew())); |
connect(m_undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin())); |
connect(m_undoManager, SIGNAL(undoRedoDone()) , doc, SLOT(undoRedoDone())); |
connect(m_undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew())); |
connect(doc, SIGNAL(addBookmark(PageItem *)), this, SLOT(AddBookMark(PageItem *))); |
connect(doc, SIGNAL(deleteBookmark(PageItem *)), this, SLOT(DelBookMark(PageItem *))); |
connect(unitSwitcher, SIGNAL(activated(int)), doc->view(), SLOT(ChgUnit(int))); |
2559,8 → 2559,8 |
doc->m_Selection->itemAt(0)->emitAllToGUI(); |
} |
docCheckerPalette->setDoc(doc); |
tocGenerator->setDoc(doc); |
styleManager->setDoc(doc); |
m_tocGenerator->setDoc(doc); |
m_styleManager->setDoc(doc); |
marksManager->setDoc(doc); |
nsEditor->setDoc(doc); |
symbolPalette->setDoc(doc); |
2906,7 → 2906,7 |
{ |
scrMenuMgr->clearMenuStrings("FileOpenRecent"); |
scrRecentFileActions.clear(); |
uint max = qMin(prefsManager->appPrefs.uiPrefs.recentDocCount, RecentDocs.count()); |
uint max = qMin(m_prefsManager->appPrefs.uiPrefs.recentDocCount, RecentDocs.count()); |
QString strippedName, localName; |
for (uint m = 0; m < max; ++m) |
{ |
2926,7 → 2926,7 |
scrMenuMgr->clearMenuStrings("EditPasteRecent"); |
scrRecentPasteActions.clear(); |
int max = qMin(prefsManager->appPrefs.scrapbookPrefs.numScrapbookCopies, scrapbookPalette->tempBView->objectMap.count()); |
int max = qMin(m_prefsManager->appPrefs.scrapbookPrefs.numScrapbookCopies, scrapbookPalette->tempBView->objectMap.count()); |
if (max > 0) |
{ |
QMap<QString,BibView::Elem>::Iterator it; |
3024,7 → 3024,7 |
{ |
UndoTransaction pasteAction; |
if(UndoManager::undoEnabled()) |
pasteAction = undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Create,"",Um::ICreate); |
pasteAction = m_undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Create,"",Um::ICreate); |
view->Deselect(true); |
uint ac = doc->Items->count(); |
bool savedAlignGrid = doc->SnapGrid; |
3194,14 → 3194,14 |
if (!HaveDoc) |
return; |
requestUpdate(reqColorsUpdate | reqLineStylesUpdate); |
styleManager->updateColorList(); |
m_styleManager->updateColorList(); |
} |
bool ScribusMainWindow::slotFileOpen() |
{ |
PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false); |
PrefsContext* docContext = m_prefsManager->prefsFile->getContext("docdirs", false); |
QString docDir("."); |
QString prefsDocDir(prefsManager->documentDir()); |
QString prefsDocDir(m_prefsManager->documentDir()); |
if (!prefsDocDir.isEmpty()) |
docDir = docContext->get("docsopen", prefsDocDir); |
else |
3223,11 → 3223,11 |
MergeDoc *dia = new MergeDoc(this, false, doc->DocPages.count(), doc->currentPage()->pageNr() + 1); |
UndoTransaction activeTransaction; |
if(UndoManager::undoEnabled()) |
activeTransaction = undoManager->beginTransaction(Um::ImportPage, Um::IGroup, Um::ImportPage, 0, Um::ILock); |
activeTransaction = m_undoManager->beginTransaction(Um::ImportPage, Um::IGroup, Um::ImportPage, 0, Um::ILock); |
if (dia->exec()) |
{ |
mainWindowStatusLabel->setText( tr("Importing Pages...")); |
m_mainWindowStatusLabel->setText( tr("Importing Pages...")); |
qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); |
std::vector<int> pageNs; |
parsePagesString(dia->getPageNumbers(), &pageNs, dia->getPageCounter()); |
3283,7 → 3283,7 |
else |
{ |
doIt = false; |
mainWindowStatusLabel->setText(""); |
m_mainWindowStatusLabel->setText(""); |
} |
qApp->restoreOverrideCursor(); |
} |
3304,11 → 3304,11 |
} |
view->GotoPa(startPage); |
mainWindowProgressBar->reset(); |
mainWindowStatusLabel->setText( tr("Import done")); |
m_mainWindowStatusLabel->setText( tr("Import done")); |
} |
else |
{ |
mainWindowStatusLabel->setText( tr("Found nothing to import")); |
m_mainWindowStatusLabel->setText( tr("Found nothing to import")); |
doIt = false; |
} |
} |
3464,17 → 3464,17 |
if (docProfileDir.exists()) |
ScCore->getCMSProfilesDir(fi.absolutePath()+"/profiles", false, false); |
prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/", FName); |
m_prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/", FName); |
QDir docFontDir(fi.absolutePath() + "/fonts"); |
if (docFontDir.exists()) |
prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/fonts", FName); |
m_prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/fonts", FName); |
QDir docFontDir2(fi.absolutePath() + "/Fonts"); |
if (docFontDir2.exists()) |
prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/Fonts", FName); |
m_prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/Fonts", FName); |
QDir docFontDir3(fi.absolutePath() + "/Document fonts"); |
if (docFontDir3.exists()) |
prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/Document fonts", FName); |
prefsManager->appPrefs.fontPrefs.AvailFonts.updateFontMap(); |
m_prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/Document fonts", FName); |
m_prefsManager->appPrefs.fontPrefs.AvailFonts.updateFontMap(); |
if (view != NULL) |
{ |
actionManager->disconnectNewViewActions(); |
3488,13 → 3488,13 |
//doc->setActiveLayer(0); //CB should not need this, the file load process sets it to ALAYER from the doc |
doc->OpenNodes.clear(); |
doc->setLoading(true); |
mainWindowStatusLabel->setText( tr("Loading...")); |
m_mainWindowStatusLabel->setText( tr("Loading...")); |
mainWindowProgressBar->reset(); |
ScribusWin* w = new ScribusWin(mdiArea, doc); |
w->setMainWindow(this); |
view = new ScribusView(w, this, doc); |
doc->setGUI(true, this, view); |
view->setScale(prefsManager->displayScale()); |
view->setScale(m_prefsManager->displayScale()); |
w->setView(view); |
alignDistributePalette->setDoc(doc); |
ActWin = w; |
3523,7 → 3523,7 |
doc=NULL; |
setScriptRunning(false); |
qApp->restoreOverrideCursor(); |
mainWindowStatusLabel->setText(""); |
m_mainWindowStatusLabel->setText(""); |
mainWindowProgressBar->reset(); |
ActWin = NULL; |
if (windows.count() != 0) |
3547,12 → 3547,12 |
view->unitChange(); |
setScriptRunning(false); |
view->Deselect(true); |
mainWindowStatusLabel->setText(""); |
m_mainWindowStatusLabel->setText(""); |
mainWindowProgressBar->reset(); |
HaveDoc++; |
if (doc->checkerProfiles().count() == 0) |
{ |
prefsManager->initDefaultCheckerPrefs(&(doc->checkerProfiles())); |
m_prefsManager->initDefaultCheckerPrefs(&(doc->checkerProfiles())); |
doc->setCurCheckProfile(CommonStrings::PostScript); |
} |
if (doc->pdfOptions().LPISettings.count() == 0) |
3580,49 → 3580,49 |
{ |
cmsWarning = true; |
missing.append(doc->cmsSettings().DefaultImageRGBProfile); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile); |
doc->cmsSettings().DefaultImageRGBProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile; |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile); |
doc->cmsSettings().DefaultImageRGBProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile; |
} |
if (!ScCore->InputProfilesCMYK.contains(doc->cmsSettings().DefaultImageCMYKProfile)) |
{ |
cmsWarning = true; |
missing.append(doc->cmsSettings().DefaultImageCMYKProfile); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile); |
doc->cmsSettings().DefaultImageCMYKProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile; |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile); |
doc->cmsSettings().DefaultImageCMYKProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile; |
} |
if (!ScCore->InputProfiles.contains(doc->cmsSettings().DefaultSolidColorRGBProfile)) |
{ |
cmsWarning = true; |
missing.append(doc->cmsSettings().DefaultSolidColorRGBProfile); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile); |
doc->cmsSettings().DefaultSolidColorRGBProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile; |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile); |
doc->cmsSettings().DefaultSolidColorRGBProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile; |
} |
if (!ScCore->InputProfilesCMYK.contains(doc->cmsSettings().DefaultSolidColorCMYKProfile)) |
{ |
cmsWarning = true; |
missing.append(doc->cmsSettings().DefaultSolidColorCMYKProfile); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile); |
doc->cmsSettings().DefaultSolidColorCMYKProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile; |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile); |
doc->cmsSettings().DefaultSolidColorCMYKProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile; |
} |
if (!ScCore->MonitorProfiles.contains(doc->cmsSettings().DefaultMonitorProfile)) |
{ |
cmsWarning = true; |
missing.append(doc->cmsSettings().DefaultMonitorProfile); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile); |
doc->cmsSettings().DefaultMonitorProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile; |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile); |
doc->cmsSettings().DefaultMonitorProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile; |
} |
if (!ScCore->PrinterProfiles.contains(doc->cmsSettings().DefaultPrinterProfile)) |
{ |
cmsWarning = true; |
missing.append(doc->cmsSettings().DefaultPrinterProfile); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile); |
doc->cmsSettings().DefaultPrinterProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile; |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile); |
doc->cmsSettings().DefaultPrinterProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile; |
} |
if (!ScCore->PrinterProfiles.contains(doc->pdfOptions().PrintProf)) |
{ |
cmsWarning = true; |
missing.append(doc->pdfOptions().PrintProf); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile); |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile); |
doc->pdfOptions().PrintProf = doc->cmsSettings().DefaultPrinterProfile; |
} |
if (!ScCore->InputProfiles.contains(doc->pdfOptions().ImageProf)) |
3629,7 → 3629,7 |
{ |
cmsWarning = true; |
missing.append(doc->pdfOptions().ImageProf); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile); |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile); |
doc->pdfOptions().ImageProf = doc->cmsSettings().DefaultImageRGBProfile; |
} |
if (!ScCore->InputProfiles.contains(doc->pdfOptions().SolidProf)) |
3636,7 → 3636,7 |
{ |
cmsWarning = true; |
missing.append(doc->pdfOptions().SolidProf); |
replacement.append(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile); |
replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile); |
doc->pdfOptions().SolidProf = doc->cmsSettings().DefaultSolidColorRGBProfile; |
} |
if (cmsWarning) |
3754,7 → 3754,7 |
doc->setModified(false); |
inlinePalette->setDoc(doc); |
updateRecent(FName); |
mainWindowStatusLabel->setText( tr("Ready")); |
m_mainWindowStatusLabel->setText( tr("Ready")); |
ret = true; |
doc->setLoading(true); |
for (int p = 0; p < doc->DocPages.count(); ++p) |
3788,9 → 3788,9 |
connect(ScCore->fileWatcher, SIGNAL(fileChanged(QString )), doc, SLOT(updatePict(QString))); |
connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), doc, SLOT(removePict(QString))); |
connect(ScCore->fileWatcher, SIGNAL(dirChanged(QString )), doc, SLOT(updatePictDir(QString ))); |
connect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin())); |
connect(undoManager, SIGNAL(undoRedoDone()), doc, SLOT(undoRedoDone())); |
connect(undoManager, SIGNAL(undoRedoDone()), view, SLOT(DrawNew())); |
connect(m_undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin())); |
connect(m_undoManager, SIGNAL(undoRedoDone()), doc, SLOT(undoRedoDone())); |
connect(m_undoManager, SIGNAL(undoRedoDone()), view, SLOT(DrawNew())); |
doc->connectDocSignals(); |
if (doc->autoSave()) |
doc->autoSaveTimer->start(doc->autoSaveTime()); |
3807,7 → 3807,7 |
pagePalette->setView(0); |
} |
undoManager->switchStack(doc->DocName); |
m_undoManager->switchStack(doc->DocName); |
pagePalette->Rebuild(); |
qApp->restoreOverrideCursor(); |
doc->setModified(false); |
3846,11 → 3846,11 |
QString formatD(FormatsManager::instance()->fileDialogFormatList(FormatsManager::IMAGESIMGFRAME)); |
QString docDir = "."; |
QString prefsDocDir=prefsManager->documentDir(); |
QString prefsDocDir=m_prefsManager->documentDir(); |
if (!prefsDocDir.isEmpty()) |
docDir = prefsManager->prefsFile->getContext("dirs")->get("images", prefsDocDir); |
docDir = m_prefsManager->prefsFile->getContext("dirs")->get("images", prefsDocDir); |
else |
docDir = prefsManager->prefsFile->getContext("dirs")->get("images", "."); |
docDir = m_prefsManager->prefsFile->getContext("dirs")->get("images", "."); |
QStringList fileNames; |
fileNames.clear(); |
3861,7 → 3861,7 |
//QStringList fileNames = CFileDialog( docDir, tr("Open"), formatD, "", fdShowPreview | fdExistingFiles); |
if (!fileNames.isEmpty()) |
{ |
prefsManager->prefsFile->getContext("dirs")->set("images", fileNames[0].left(fileNames[0].lastIndexOf("/"))); |
m_prefsManager->prefsFile->getContext("dirs")->set("images", fileNames[0].left(fileNames[0].lastIndexOf("/"))); |
view->requestMode(modeImportImage); |
dynamic_cast<CanvasMode_ImageImport*>(view->canvasMode())->setImageList(fileNames); |
} |
3895,7 → 3895,7 |
doc->flag_NumUpdateRequest = true; |
view->DrawNew(); |
slotDocCh(); |
styleManager->setDoc(doc); |
m_styleManager->setDoc(doc); |
marksManager->setDoc(doc); |
nsEditor->setDoc(doc); |
inlinePalette->unsetDoc(); |
3994,7 → 3994,7 |
{ |
QFileInfo fiB(currItem->Pfile); |
PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false); |
PrefsContext* docContext = m_prefsManager->prefsFile->getContext("docdirs", false); |
QString wdir = "."; |
if (doc->hasName) |
{ |
4003,7 → 4003,7 |
} |
else |
{ |
QString prefsDocDir = prefsManager->documentDir(); |
QString prefsDocDir = m_prefsManager->documentDir(); |
if (!prefsDocDir.isEmpty()) |
wdir = docContext->get("place_as", prefsDocDir); |
else |
4084,7 → 4084,7 |
slotFileClose(); |
qApp->processEvents(); |
loadDoc(fn); |
undoManager->clearStack(); |
m_undoManager->clearStack(); |
} |
} |
4126,7 → 4126,7 |
// |
bool ret = false; |
QString filename; |
PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false); |
PrefsContext* docContext = m_prefsManager->prefsFile->getContext("docdirs", false); |
QString wdir = "."; |
if (doc->hasName) |
{ |
4141,7 → 4141,7 |
} |
else |
{ |
QString prefsDocDir=prefsManager->documentDir(); |
QString prefsDocDir=m_prefsManager->documentDir(); |
if (!prefsDocDir.isEmpty()) |
wdir = docContext->get("save_as", prefsDocDir); |
else |
4153,7 → 4153,7 |
filename = wdir; |
filename += doc->DocName + ".sla"; |
} |
bool saveCompressed=prefsManager->appPrefs.docSetupPrefs.saveCompressed; |
bool saveCompressed=m_prefsManager->appPrefs.docSetupPrefs.saveCompressed; |
if (saveCompressed) |
filename.append(".gz"); |
4179,7 → 4179,7 |
doc->pdfOptions().fileName = ""; // #1482 reset the pdf file name |
} |
} |
mainWindowStatusLabel->setText( tr("Ready")); |
m_mainWindowStatusLabel->setText( tr("Ready")); |
return ret; |
} |
4188,7 → 4188,7 |
ScCore->fileWatcher->forceScan(); |
ScCore->fileWatcher->stop(); |
doc->reorganiseFonts(); |
mainWindowStatusLabel->setText( tr("Saving...")); |
m_mainWindowStatusLabel->setText( tr("Saving...")); |
mainWindowProgressBar->reset(); |
bool ret=doc->save(fileName, savedFileName); |
qApp->processEvents(); |
4195,11 → 4195,11 |
if (ret) |
{ |
updateActiveWindowCaption(fileName); |
undoManager->renameStack(fileName); |
m_undoManager->renameStack(fileName); |
scrActions["fileRevert"]->setEnabled(false); |
updateRecent(fileName); |
} |
mainWindowStatusLabel->setText(""); |
m_mainWindowStatusLabel->setText(""); |
mainWindowProgressBar->reset(); |
ScCore->fileWatcher->start(); |
return ret; |
4222,7 → 4222,7 |
actionManager->disconnectNewDocActions(); |
actionManager->disconnectNewViewActions(); |
disconnect(view, SIGNAL(signalGuideInformation(int, qreal)), alignDistributePalette, SLOT(setGuide(int, qreal))); |
undoManager->removeStack(doc->DocName); |
m_undoManager->removeStack(doc->DocName); |
closeActiveWindowMasterPageEditor(); |
slotSelect(); |
doc->autoSaveTimer->stop(); |
4255,8 → 4255,8 |
PluginManager& pluginManager(PluginManager::instance()); |
pluginManager.enableOnlyStartupPluginActions(this); |
appModeHelper->mainWindowCloseLastDoc(); |
mainWindowStatusLabel->setText( tr("Ready")); |
PrinterUsed = false; |
m_mainWindowStatusLabel->setText( tr("Ready")); |
m_PrinterUsed = false; |
} |
// Give plugins a chance to react on closing the document |
PluginManager& pluginManager(PluginManager::instance()); |
4278,8 → 4278,8 |
doc->setLoading(true); |
guidePalette->setDoc(0); |
charPalette->setDoc(0); |
tocGenerator->setDoc(0); |
styleManager->setDoc(0); |
m_tocGenerator->setDoc(0); |
m_styleManager->setDoc(0); |
marksManager->setDoc(0); |
nsEditor->setDoc(0); |
layerPalette->ClearInhalt(); |
4352,7 → 4352,7 |
} |
QString printError; |
PrintOptions options; |
mainWindowStatusLabel->setText( tr("Printing...")); |
m_mainWindowStatusLabel->setText( tr("Printing...")); |
if (doc->Print_Options.firstUse) |
{ |
doc->Print_Options.printer.clear(); |
4376,7 → 4376,7 |
ColorList usedSpots; |
doc->getUsedColors(usedSpots, true); |
QStringList spots = usedSpots.keys(); |
PrintDialog *printer = new PrintDialog(this, doc, doc->Print_Options, prefsManager->appPrefs.printerPrefs.GCRMode, spots); |
PrintDialog *printer = new PrintDialog(this, doc, doc->Print_Options, m_prefsManager->appPrefs.printerPrefs.GCRMode, spots); |
printer->setMinMax(1, doc->Pages->count(), doc->currentPage()->pageNr()+1); |
printDinUse = true; |
connect(printer, SIGNAL(doPreview()), this, SLOT(doPrintPreview())); |
4394,7 → 4394,7 |
else |
parsePagesString(printer->getPageString(), &doc->Print_Options.pageNumbers, doc->DocPages.count()); |
} |
PrinterUsed = true; |
m_PrinterUsed = true; |
done = doPrint(doc->Print_Options, printError); |
qApp->restoreOverrideCursor(); |
if (!done) |
4411,7 → 4411,7 |
printDinUse = false; |
disconnect(printer, SIGNAL(doPreview()), this, SLOT(doPrintPreview())); |
delete printer; |
mainWindowStatusLabel->setText( tr("Ready")); |
m_mainWindowStatusLabel->setText( tr("Ready")); |
} |
void ScribusMainWindow::slotEndSpecialEdit() |
4497,11 → 4497,11 |
if (UndoManager::undoEnabled()) |
{ |
if (docSelectionCount > 1) |
activeTransaction = undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Cut,"",Um::ICut); |
activeTransaction = m_undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Cut,"",Um::ICut); |
else |
{ |
PageItem* item=doc->m_Selection->itemAt(0); |
activeTransaction = undoManager->beginTransaction(item->getUName(), item->getUPixmap(), Um::Cut, "", Um::ICut); |
activeTransaction = m_undoManager->beginTransaction(item->getUName(), item->getUPixmap(), Um::Cut, "", Um::ICut); |
} |
} |
currItem = doc->m_Selection->itemAt(0); |
4542,7 → 4542,7 |
return; |
ScriXmlDoc ss; |
QString BufferS = ss.WriteElem(doc, doc->m_Selection); |
if ((prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy)) |
if ((m_prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy)) |
{ |
scrapbookPalette->ObjFromCopyAction(BufferS, currItem->itemName()); |
rebuildRecentPasteMenu(); |
4623,7 → 4623,7 |
QString BufferS = ss.WriteElem(doc, doc->m_Selection); |
if (!internalCopy) |
{ |
if ((prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy)) |
if ((m_prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy)) |
{ |
scrapbookPalette->ObjFromCopyAction(BufferS, currItem->itemName()); |
rebuildRecentPasteMenu(); |
4653,7 → 4653,7 |
if (!ScMimeData::clipboardHasScribusData() && (!internalCopy)) |
return; |
if (UndoManager::undoEnabled()) |
activeTransaction = undoManager->beginTransaction(doc->currentPage()->getUName(), 0, Um::Paste, "", Um::IPaste); |
activeTransaction = m_undoManager->beginTransaction(doc->currentPage()->getUName(), 0, Um::Paste, "", Um::IPaste); |
PageItem* selItem = doc->m_Selection->itemAt(0); |
if (((doc->appMode == modeEdit) || (doc->appMode == modeEditTable)) && selItem && (selItem->isTextFrame() || selItem->isTable())) |
{ |
4698,7 → 4698,7 |
is->set("PASTE_TEXT", "paste_text"); |
is->set("START",currItem->itemText.cursorPosition()); |
is->setItem(*story); |
undoManager->action(currItem, is); |
m_undoManager->action(currItem, is); |
} |
currItem->itemText.insert(*story); |
4719,11 → 4719,11 |
doc->SnapElement = false; |
// HACK #6541 : undo does not handle text modification => do not record embedded item creation |
// if embedded item is deleted, undo system will not be aware of its deletion => crash - JG |
undoManager->setUndoEnabled(false); |
m_undoManager->setUndoEnabled(false); |
QString buffer = ScMimeData::clipboardScribusElem(); |
slotElemRead(buffer, 0, 0, false, true, doc, view); |
// update style lists: |
styleManager->setDoc(doc); |
m_styleManager->setDoc(doc); |
propertiesPalette->unsetDoc(); |
propertiesPalette->setDoc(doc); |
marksManager->setDoc(doc); |
4771,7 → 4771,7 |
doc->maxCanvasCoordinate = maxSize; |
if (outlinePalette->isVisible()) |
outlinePalette->BuildTree(); |
undoManager->setUndoEnabled(true); |
m_undoManager->setUndoEnabled(true); |
if (UndoManager::undoEnabled()) |
{ |
SimpleState *is = new SimpleState(Um::Paste,"",Um::IPaste); |
4778,7 → 4778,7 |
is->set("PASTE_INLINE", "paste_inline"); |
is->set("START",currItem->itemText.cursorPosition()); |
is->set("INDEX",fIndex); |
undoManager->action(currItem, is); |
m_undoManager->action(currItem, is); |
} |
currItem->itemText.insertObject(fIndex); |
doc->m_Selection->delaySignalsOff(); |
4806,7 → 4806,7 |
double y = (view->contentsY() / view->scale()) + ((view->visibleHeight() / 2.0) / view->scale()) - (retObj->height() / 2.0); |
retObj->setTextFlowMode(PageItem::TextFlowUsesBoundingBox); |
retObj->setXYPos(x, y, true); |
styleManager->setDoc(doc); |
m_styleManager->setDoc(doc); |
propertiesPalette->unsetDoc(); |
propertiesPalette->setDoc(doc); |
marksManager->setDoc(doc); |
4838,7 → 4838,7 |
doc->maxCanvasCoordinate = maxSize; |
if (outlinePalette->isVisible()) |
outlinePalette->BuildTree(); |
undoManager->setUndoEnabled(true); |
m_undoManager->setUndoEnabled(true); |
if (UndoManager::undoEnabled()) |
{ |
SimpleState *is = new SimpleState(Um::Paste,"",Um::IPaste); |
4845,7 → 4845,7 |
is->set("PASTE_INLINE", "paste_inline"); |
is->set("START",currItem->itemText.cursorPosition()); |
is->set("INDEX",fIndex); |
undoManager->action(currItem, is); |
m_undoManager->action(currItem, is); |
} |
currItem->itemText.insertObject(fIndex); |
doc->m_Selection->delaySignalsOff(); |
4888,7 → 4888,7 |
slotElemRead(buffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view); |
} |
// update style lists: |
styleManager->setDoc(doc); |
m_styleManager->setDoc(doc); |
propertiesPalette->unsetDoc(); |
propertiesPalette->setDoc(doc); |
marksManager->setDoc(doc); |
5137,16 → 5137,16 |
void ScribusMainWindow::slotOnlineHelp(const QString & jumpToSection, const QString & jumpToFile) |
{ |
if (!helpBrowser) |
if (!m_helpBrowser) |
{ |
helpBrowser = new HelpBrowser(0, tr("Scribus Manual"), ScCore->getGuiLanguage(), jumpToSection, jumpToFile); |
connect(helpBrowser, SIGNAL(closed()), this, SLOT(slotOnlineHelpClosed())); |
m_helpBrowser = new HelpBrowser(0, tr("Scribus Manual"), ScCore->getGuiLanguage(), jumpToSection, jumpToFile); |
connect(m_helpBrowser, SIGNAL(closed()), this, SLOT(slotOnlineHelpClosed())); |
} |
else //just set the requested page |
{ |
if (!jumpToSection.isNull() || !jumpToFile.isNull()) |
{ |
helpBrowser->jumpToHelpSection(jumpToSection, jumpToFile, true); |
m_helpBrowser->jumpToHelpSection(jumpToSection, jumpToFile, true); |
} |
} |
slotRaiseOnlineHelp(); |
5154,14 → 5154,14 |
void ScribusMainWindow::slotRaiseOnlineHelp() |
{ |
if (helpBrowser) |
helpBrowser->show(); |
if (m_helpBrowser) |
m_helpBrowser->show(); |
} |
void ScribusMainWindow::slotOnlineHelpClosed() |
{ |
if (helpBrowser) |
helpBrowser->deleteLater(); |
if (m_helpBrowser) |
m_helpBrowser->deleteLater(); |
} |
void ScribusMainWindow::slotResourceManager() |
5177,12 → 5177,12 |
void ScribusMainWindow::ToggleTips() |
{ |
prefsManager->appPrefs.displayPrefs.showToolTips = scrActions["helpTooltips"]->isChecked(); |
m_prefsManager->appPrefs.displayPrefs.showToolTips = scrActions["helpTooltips"]->isChecked(); |
} |
void ScribusMainWindow::ToggleMouseTips() |
{ |
prefsManager->appPrefs.displayPrefs.showMouseCoordinates = scrActions["showMouseCoordinates"]->isChecked(); |
m_prefsManager->appPrefs.displayPrefs.showMouseCoordinates = scrActions["showMouseCoordinates"]->isChecked(); |
} |
void ScribusMainWindow::SaveText() |
5189,15 → 5189,15 |
{ |
LoadEnc = ""; |
QString wdir = "."; |
QString prefsDocDir=prefsManager->documentDir(); |
QString prefsDocDir=m_prefsManager->documentDir(); |
if (!prefsDocDir.isEmpty()) |
wdir = prefsManager->prefsFile->getContext("dirs")->get("save_text", prefsDocDir); |
wdir = m_prefsManager->prefsFile->getContext("dirs")->get("save_text", prefsDocDir); |
else |
wdir = prefsManager->prefsFile->getContext("dirs")->get("save_text", "."); |
wdir = m_prefsManager->prefsFile->getContext("dirs")->get("save_text", "."); |
QString fn = CFileDialog( wdir, tr("Save As"), tr("Text Files (*.txt);;All Files (*)"), "", fdShowCodecs|fdHidePreviewCheckBox); |
if (!fn.isEmpty()) |
{ |
prefsManager->prefsFile->getContext("dirs")->set("save_text", fn.left(fn.lastIndexOf("/"))); |
m_prefsManager->prefsFile->getContext("dirs")->set("save_text", fn.left(fn.lastIndexOf("/"))); |
const StoryText& story (doc->m_Selection->itemAt(0)->itemText); |
Serializer::writeWithEncoding(fn, LoadEnc, story.text(0, story.length())); |
} |
5261,7 → 5261,7 |
UndoTransaction activeTransaction; |
if (UndoManager::undoEnabled()) |
{ |
activeTransaction = undoManager->beginTransaction(doc->getUName(), Um::IDocument, (numPages == 1) ? Um::AddPage : Um::AddPages, "", Um::ICreate); |
activeTransaction = m_undoManager->beginTransaction(doc->getUName(), Um::IDocument, (numPages == 1) ? Um::AddPage : Um::AddPages, "", Um::ICreate); |
SimpleState *ss = new SimpleState(Um::AddPage, "", Um::ICreate); |
ss->set("ADD_PAGE", "add_page"); |
ss->set("PAGE", wo); |
5285,11 → 5285,11 |
ss->set("ORIENT", orient); |
ss->set("SIZE", siz); |
ss->set("MOVED", mov); |
undoManager->action(this, ss); |
m_undoManager->action(this, ss); |
} |
// disable recording of undo actions related to new page creating |
// and object moving related to that |
undoManager->setUndoEnabled(false); |
m_undoManager->setUndoEnabled(false); |
QStringList base; |
if (basedOn != NULL) |
5363,7 → 5363,7 |
doc->updateEndnotesFrames(); |
updateGUIAfterPagesChanged(); |
undoManager->setUndoEnabled(true); |
m_undoManager->setUndoEnabled(true); |
if (activeTransaction) |
{ |
5455,7 → 5455,7 |
} |
//Zoom to % |
else |
finalZoomFactor = zoomFactor*prefsManager->displayScale()/100.0; |
finalZoomFactor = zoomFactor*m_prefsManager->displayScale()/100.0; |
if (finalZoomFactor == view->scale()) |
return; |
5477,46 → 5477,46 |
void ScribusMainWindow::ToggleStickyTools() |
{ |
prefsManager->appPrefs.uiPrefs.stickyTools = !prefsManager->appPrefs.uiPrefs.stickyTools; |
scrActions["stickyTools"]->setChecked(prefsManager->appPrefs.uiPrefs.stickyTools); |
if (HaveDoc && doc->appMode!=modeNormal && !prefsManager->appPrefs.uiPrefs.stickyTools) |
m_prefsManager->appPrefs.uiPrefs.stickyTools = !m_prefsManager->appPrefs.uiPrefs.stickyTools; |
scrActions["stickyTools"]->setChecked(m_prefsManager->appPrefs.uiPrefs.stickyTools); |
if (HaveDoc && doc->appMode!=modeNormal && !m_prefsManager->appPrefs.uiPrefs.stickyTools) |
view->requestMode(modeNormal); |
} |
void ScribusMainWindow::ToggleAllPalettes() |
{ |
if (palettesStatus[PS_ALL]) |
if (m_palettesStatus[PS_ALL]) |
{ |
palettesStatus[PS_ALL] = false; |
if (palettesStatus[PS_PROPERTIES]) |
m_palettesStatus[PS_ALL] = false; |
if (m_palettesStatus[PS_PROPERTIES]) |
propertiesPalette->show(); |
if (palettesStatus[PS_OUTLINE]) |
if (m_palettesStatus[PS_OUTLINE]) |
outlinePalette->show(); |
if (palettesStatus[PS_SCRAPBOOK]) |
if (m_palettesStatus[PS_SCRAPBOOK]) |
scrapbookPalette->show(); |
if (palettesStatus[PS_LAYER]) |
if (m_palettesStatus[PS_LAYER]) |
layerPalette->show(); |
if (palettesStatus[PS_PAGE]) |
if (m_palettesStatus[PS_PAGE]) |
pagePalette->show(); |
if (palettesStatus[PS_BOOKMARK]) |
if (m_palettesStatus[PS_BOOKMARK]) |
bookmarkPalette->show(); |
if (palettesStatus[PS_VERIFIER]) |
if (m_palettesStatus[PS_VERIFIER]) |
docCheckerPalette->show(); |
if (palettesStatus[PS_DOWNLOADS]) |
if (m_palettesStatus[PS_DOWNLOADS]) |
downloadsPalette->show(); |
setUndoPalette(palettesStatus[PS_UNDO]); |
setUndoPalette(m_palettesStatus[PS_UNDO]); |
} |
else |
{ |
palettesStatus[PS_PROPERTIES] = propertiesPalette->isVisible(); |
palettesStatus[PS_OUTLINE] = outlinePalette->isVisible(); |
palettesStatus[PS_SCRAPBOOK] = scrapbookPalette->isVisible(); |
palettesStatus[PS_LAYER] = layerPalette->isVisible(); |
palettesStatus[PS_PAGE] = pagePalette->isVisible(); |
palettesStatus[PS_BOOKMARK] = bookmarkPalette->isVisible(); |
palettesStatus[PS_UNDO] = undoPalette->isVisible(); |
palettesStatus[PS_VERIFIER] = docCheckerPalette->isVisible(); |
palettesStatus[PS_DOWNLOADS] = downloadsPalette->isVisible(); |
m_palettesStatus[PS_PROPERTIES] = propertiesPalette->isVisible(); |
m_palettesStatus[PS_OUTLINE] = outlinePalette->isVisible(); |
m_palettesStatus[PS_SCRAPBOOK] = scrapbookPalette->isVisible(); |
m_palettesStatus[PS_LAYER] = layerPalette->isVisible(); |
m_palettesStatus[PS_PAGE] = pagePalette->isVisible(); |
m_palettesStatus[PS_BOOKMARK] = bookmarkPalette->isVisible(); |
m_palettesStatus[PS_UNDO] = undoPalette->isVisible(); |
m_palettesStatus[PS_VERIFIER] = docCheckerPalette->isVisible(); |
m_palettesStatus[PS_DOWNLOADS] = downloadsPalette->isVisible(); |
propertiesPalette->hide(); |
outlinePalette->hide(); |
scrapbookPalette->hide(); |
5526,13 → 5526,13 |
docCheckerPalette->hide(); |
downloadsPalette->hide(); |
setUndoPalette(false); |
palettesStatus[PS_ALL] = true; |
m_palettesStatus[PS_ALL] = true; |
} |
} |
void ScribusMainWindow::toggleCheckPal() |
{ |
palettesStatus[PS_ALL] = false; |
m_palettesStatus[PS_ALL] = false; |
} |
void ScribusMainWindow::setUndoPalette(bool visible) |
5543,13 → 5543,13 |
void ScribusMainWindow::togglePagePalette() |
{ |
palettesStatus[PS_ALL] = false; |
m_palettesStatus[PS_ALL] = false; |
} |
void ScribusMainWindow::toggleUndoPalette() |
{ |
setUndoPalette(!undoPalette->isVisible()); |
palettesStatus[PS_ALL] = false; |
m_palettesStatus[PS_ALL] = false; |
} |
void ScribusMainWindow::toggleImageVisibility() |
5593,22 → 5593,22 |
{ |
if (!doc) |
return; |
keyrep=false; |
if (guidesStatus[GS_ALL]) |
m_keyrep=false; |
if (m_guidesStatus[GS_ALL]) |
{ |
guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().marginsShown = guidesStatus[GS_MARGINS]; |
doc->guidesPrefs().framesShown = guidesStatus[GS_FRAMES]; |
doc->guidesPrefs().gridShown = guidesStatus[GS_GRID]; |
doc->guidesPrefs().guidesShown = guidesStatus[GS_GUIDES]; |
doc->guidesPrefs().baselineGridShown = guidesStatus[GS_BASELINE]; |
doc->guidesPrefs().linkShown = guidesStatus[GS_LINKS]; |
doc->guidesPrefs().showControls = guidesStatus[GS_CONTROLS]; |
doc->guidesPrefs().rulerMode = guidesStatus[GS_RULERMODE]; |
doc->guidesPrefs().rulersShown = guidesStatus[GS_RULERS]; |
doc->guidesPrefs().colBordersShown = guidesStatus[GS_COLUMNBORDERS]; |
doc->guidesPrefs().layerMarkersShown = guidesStatus[GS_LAYERMARKERS] ; |
doc->guidesPrefs().showBleed = guidesStatus[GS_BLEED]; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().marginsShown = m_guidesStatus[GS_MARGINS]; |
doc->guidesPrefs().framesShown = m_guidesStatus[GS_FRAMES]; |
doc->guidesPrefs().gridShown = m_guidesStatus[GS_GRID]; |
doc->guidesPrefs().guidesShown = m_guidesStatus[GS_GUIDES]; |
doc->guidesPrefs().baselineGridShown = m_guidesStatus[GS_BASELINE]; |
doc->guidesPrefs().linkShown = m_guidesStatus[GS_LINKS]; |
doc->guidesPrefs().showControls = m_guidesStatus[GS_CONTROLS]; |
doc->guidesPrefs().rulerMode = m_guidesStatus[GS_RULERMODE]; |
doc->guidesPrefs().rulersShown = m_guidesStatus[GS_RULERS]; |
doc->guidesPrefs().colBordersShown = m_guidesStatus[GS_COLUMNBORDERS]; |
doc->guidesPrefs().layerMarkersShown = m_guidesStatus[GS_LAYERMARKERS] ; |
doc->guidesPrefs().showBleed = m_guidesStatus[GS_BLEED]; |
toggleMarks(); |
toggleFrames(); |
toggleLayerMarkers(); |
5624,19 → 5624,19 |
} |
else |
{ |
guidesStatus[GS_ALL] = true; |
guidesStatus[GS_MARGINS] = !doc->guidesPrefs().marginsShown; |
guidesStatus[GS_FRAMES] = !doc->guidesPrefs().framesShown; |
guidesStatus[GS_GRID] = !doc->guidesPrefs().gridShown; |
guidesStatus[GS_GUIDES] = !doc->guidesPrefs().guidesShown; |
guidesStatus[GS_BASELINE] = !doc->guidesPrefs().baselineGridShown; |
guidesStatus[GS_LINKS] = !doc->guidesPrefs().linkShown; |
guidesStatus[GS_CONTROLS] = !doc->guidesPrefs().showControls; |
guidesStatus[GS_RULERMODE] = !doc->guidesPrefs().rulerMode; |
guidesStatus[GS_RULERS] = !doc->guidesPrefs().rulersShown; |
guidesStatus[GS_COLUMNBORDERS] = !doc->guidesPrefs().colBordersShown; |
guidesStatus[GS_LAYERMARKERS] = !doc->guidesPrefs().layerMarkersShown; |
guidesStatus[GS_BLEED] = !doc->guidesPrefs().showBleed; |
m_guidesStatus[GS_ALL] = true; |
m_guidesStatus[GS_MARGINS] = !doc->guidesPrefs().marginsShown; |
m_guidesStatus[GS_FRAMES] = !doc->guidesPrefs().framesShown; |
m_guidesStatus[GS_GRID] = !doc->guidesPrefs().gridShown; |
m_guidesStatus[GS_GUIDES] = !doc->guidesPrefs().guidesShown; |
m_guidesStatus[GS_BASELINE] = !doc->guidesPrefs().baselineGridShown; |
m_guidesStatus[GS_LINKS] = !doc->guidesPrefs().linkShown; |
m_guidesStatus[GS_CONTROLS] = !doc->guidesPrefs().showControls; |
m_guidesStatus[GS_RULERMODE] = !doc->guidesPrefs().rulerMode; |
m_guidesStatus[GS_RULERS] = !doc->guidesPrefs().rulersShown; |
m_guidesStatus[GS_COLUMNBORDERS] = !doc->guidesPrefs().colBordersShown; |
m_guidesStatus[GS_LAYERMARKERS] = !doc->guidesPrefs().layerMarkersShown; |
m_guidesStatus[GS_BLEED] = !doc->guidesPrefs().showBleed; |
doc->guidesPrefs().marginsShown = false; |
doc->guidesPrefs().framesShown = false; |
doc->guidesPrefs().gridShown = false; |
5670,7 → 5670,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().marginsShown = !doc->guidesPrefs().marginsShown; |
view->DrawNew(); |
} |
5679,7 → 5679,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().showBleed = !doc->guidesPrefs().showBleed; |
view->DrawNew(); |
} |
5688,7 → 5688,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().framesShown = !doc->guidesPrefs().framesShown; |
view->DrawNew(); |
} |
5697,7 → 5697,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().layerMarkersShown = !doc->guidesPrefs().layerMarkersShown; |
view->DrawNew(); |
} |
5706,7 → 5706,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().gridShown = !doc->guidesPrefs().gridShown; |
view->DrawNew(); |
} |
5715,7 → 5715,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().guidesShown = !doc->guidesPrefs().guidesShown; |
view->DrawNew(); |
} |
5724,7 → 5724,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().colBordersShown = !doc->guidesPrefs().colBordersShown; |
view->DrawNew(); |
} |
5733,7 → 5733,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().baselineGridShown = !doc->guidesPrefs().baselineGridShown; |
view->DrawNew(); |
} |
5742,7 → 5742,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().linkShown = !doc->guidesPrefs().linkShown; |
view->DrawNew(); |
} |
5751,7 → 5751,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().showControls = !doc->guidesPrefs().showControls; |
view->DrawNew(); |
} |
5760,7 → 5760,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().rulersShown = !doc->guidesPrefs().rulersShown; |
view->setRulersShown(doc->guidesPrefs().rulersShown); |
} |
5769,7 → 5769,7 |
{ |
if (!doc) |
return; |
guidesStatus[GS_ALL] = false; |
m_guidesStatus[GS_ALL] = false; |
doc->guidesPrefs().rulerMode = !doc->guidesPrefs().rulerMode; |
if (doc->guidesPrefs().rulerMode) |
{ |
5865,7 → 5865,7 |
doc->nodeEdit.reset(); |
appModeHelper->setFrameEditMode(true); |
enablePalettes(false); |
styleManager->setEnabled(false); |
m_styleManager->setEnabled(false); |
pageSelector->setEnabled(false); |
layerMenu->setEnabled(false); |
if (!doc->m_Selection->isEmpty()) |
5911,7 → 5911,7 |
scrActions["toolsEditContents"]->setChecked(false); |
scrActions["toolsEditWithStoryEditor"]->setChecked(false); |
enablePalettes(true); |
styleManager->setEnabled(true); |
m_styleManager->setEnabled(true); |
pageSelector->setEnabled(true); |
layerMenu->setEnabled(true); |
if (HaveDoc) |
5939,9 → 5939,9 |
void ScribusMainWindow::setAppModeByToggle(bool isOn, int newMode) |
{ |
keyrep=false; |
m_keyrep=false; |
if (newMode==modeDrawLatex && !prefsManager->renderFrameConfigured()) |
if (newMode==modeDrawLatex && !m_prefsManager->renderFrameConfigured()) |
{ |
ScMessageBox::critical(this, "Render Frames Not Configured", "Your Render Frame configuration seems to be invalid. Please check the settings in the External Tools section of the Preferences dialog."); |
return; |
6069,7 → 6069,7 |
int oldPg = doc->currentPageNumber(); |
guidePalette->setDoc(NULL); |
if (UndoManager::undoEnabled()) |
activeTransaction = undoManager->beginTransaction(doc->DocName, Um::IDocument, |
activeTransaction = m_undoManager->beginTransaction(doc->DocName, Um::IDocument, |
(from - to == 0) ? Um::DeletePage : Um::DeletePages, "", |
Um::IDelete); |
PageItem* ite; |
6117,9 → 6117,9 |
// replaced with the "undone" page if user choose to undo the action |
DummyUndoObject *duo = new DummyUndoObject(); |
uint id = static_cast<uint>(duo->getUId()); |
undoManager->replaceObject(doc->Pages->at(a)->getUId(), duo); |
m_undoManager->replaceObject(doc->Pages->at(a)->getUId(), duo); |
ss->set("DUMMY_ID", id); |
undoManager->action(this, ss); |
m_undoManager->action(this, ss); |
} |
bool isMasterPage = !(doc->Pages->at(a)->pageName().isEmpty()); |
if (doc->masterPageMode()) |
6131,9 → 6131,9 |
} |
pageSelector->setMaximum(doc->Pages->count()); |
pageSelector->blockSignals(b); |
undoManager->setUndoEnabled(false); // ugly hack to disable object moving when undoing page deletion |
m_undoManager->setUndoEnabled(false); // ugly hack to disable object moving when undoing page deletion |
view->reformPagesView(); |
undoManager->setUndoEnabled(true); // ugly hack continues |
m_undoManager->setUndoEnabled(true); // ugly hack continues |
view->updatesOn(true); |
view->GotoPage(qMin(doc->Pages->count()-1, oldPg)); |
doc->updateEndnotesFrames(); |
6358,7 → 6358,7 |
UndoTransaction trans; |
if (UndoManager::undoEnabled()) |
trans = undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Duplicate,"",Um::IMultipleDuplicate); |
trans = m_undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Duplicate,"",Um::IMultipleDuplicate); |
ItemMultipleDuplicateData mdData; |
memset(&mdData, 0, sizeof(mdData)); |
6545,37 → 6545,37 |
{ |
QString oldMonitorProfile(ScCore->monitorProfile.productDescription()); |
slotSelect(); |
struct ApplicationPrefs oldPrefs(prefsManager->appPrefs); |
struct ApplicationPrefs oldPrefs(m_prefsManager->appPrefs); |
PreferencesDialog prefsDialog(this, oldPrefs); |
int prefsResult=prefsDialog.exec(); |
if (prefsResult==QDialog::Accepted) |
{ |
struct ApplicationPrefs newPrefs(prefsDialog.prefs()); |
prefsManager->setNewPrefs(newPrefs); |
prefsManager->applyLoadedShortCuts(); |
m_prefsManager->setNewPrefs(newPrefs); |
m_prefsManager->applyLoadedShortCuts(); |
//TODO: and the other dirs? |
DocDir = prefsManager->documentDir(); |
DocDir = m_prefsManager->documentDir(); |
if (oldPrefs.pathPrefs.documents != newPrefs.pathPrefs.documents) |
{ |
PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false); |
PrefsContext* docContext = m_prefsManager->prefsFile->getContext("docdirs", false); |
docContext->set("docsopen", newPrefs.pathPrefs.documents); |
} |
ScQApp->neverSplash(!prefsManager->appPrefs.uiPrefs.showSplashOnStartup); |
ScQApp->neverSplash(!m_prefsManager->appPrefs.uiPrefs.showSplashOnStartup); |
QString newUILanguage = prefsManager->uiLanguage(); |
QString newUILanguage = m_prefsManager->uiLanguage(); |
if (oldPrefs.uiPrefs.language != newUILanguage || ScQApp->currGUILanguage()!=newUILanguage) |
ScQApp->changeGUILanguage(newUILanguage); |
QString newUIStyle = prefsManager->guiStyle(); |
QString newUIStyle = m_prefsManager->guiStyle(); |
if (oldPrefs.uiPrefs.style != newUIStyle) |
{ |
if (newUIStyle.isEmpty()) |
qApp->setStyle(prefsManager->guiSystemStyle()); |
qApp->setStyle(m_prefsManager->guiSystemStyle()); |
else |
qApp->setStyle(QStyleFactory::create(newUIStyle)); |
} |
int newUIFontSize = prefsManager->guiFontSize(); |
int newUIFontSize = m_prefsManager->guiFontSize(); |
if (oldPrefs.uiPrefs.applicationFontSize != newUIFontSize) |
{ |
QFont apf = qApp->font(); |
6583,7 → 6583,7 |
qApp->setFont(apf); |
} |
emit UpdateRequest(reqDefFontListUpdate); |
if (prefsManager->appPrefs.uiPrefs.useTabs) |
if (m_prefsManager->appPrefs.uiPrefs.useTabs) |
{ |
mdiArea->setViewMode(QMdiArea::TabbedView); |
mdiArea->setTabsClosable(true); |
6591,7 → 6591,7 |
} |
else |
mdiArea->setViewMode(QMdiArea::SubWindowView); |
bool shadowChanged = oldPrefs.displayPrefs.showPageShadow != prefsManager->showPageShadow(); |
bool shadowChanged = oldPrefs.displayPrefs.showPageShadow != m_prefsManager->showPageShadow(); |
QList<QMdiSubWindow *> windows = mdiArea->subWindowList(); |
if (!windows.isEmpty()) |
{ |
6601,7 → 6601,7 |
QWidget* w = windows.at(i)->widget(); |
ScribusWin* scw = (ScribusWin*) w; |
ScribusView* scw_v = scw->view(); |
if (oldPrefs.displayPrefs.displayScale != prefsManager->displayScale()) |
if (oldPrefs.displayPrefs.displayScale != m_prefsManager->displayScale()) |
{ |
int x = qRound(qMax(scw_v->contentsX() / scw_v->scale(), 0.0)); |
int y = qRound(qMax(scw_v->contentsY() / scw_v->scale(), 0.0)); |
6608,7 → 6608,7 |
int w = qRound(qMin(scw_v->visibleWidth() / scw_v->scale(), scw->doc()->currentPage()->width())); |
int h = qRound(qMin(scw_v->visibleHeight() / scw_v->scale(), scw->doc()->currentPage()->height())); |
scw_v->rememberOldZoomLocation(w / 2 + x,h / 2 + y); |
scw_v->zoom((scw_v->scale() / oldPrefs.displayPrefs.displayScale) * prefsManager->displayScale()); |
scw_v->zoom((scw_v->scale() / oldPrefs.displayPrefs.displayScale) * m_prefsManager->displayScale()); |
zoomSpinBox->setMaximum(doc->opToolPrefs().magMax); |
} |
if (shadowChanged) |
6633,7 → 6633,7 |
if (!success) |
{ |
newPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = oldMonitorProfile; |
prefsManager->setNewPrefs(newPrefs); |
m_prefsManager->setNewPrefs(newPrefs); |
QString message = tr("An error occurred while opening monitor profile.\nFormer monitor profile will be used." ); |
if (ScCore->usingGUI()) |
ScMessageBox::warning(this, CommonStrings::trWarning, message); |
6647,7 → 6647,7 |
icm.setMaxCacheEntries(newPrefs.imageCachePrefs.maxCacheEntries); |
icm.setCompressionLevel(newPrefs.imageCachePrefs.compressionLevel); |
prefsManager->SavePrefs(); |
m_prefsManager->SavePrefs(); |
} |
} |
6757,7 → 6757,7 |
guidePalette->startup(); |
inlinePalette->startup(); |
charPalette->startup(); |
styleManager->startup(); |
m_styleManager->startup(); |
marksManager->startup(); |
nsEditor->startup(); |
symbolPalette->startup(); |
6893,7 → 6893,7 |
options.useColor = true; |
options.mirrorH = false; |
options.mirrorV = false; |
options.doGCR = prefsManager->appPrefs.printerPrefs.GCRMode; |
options.doGCR = m_prefsManager->appPrefs.printerPrefs.GCRMode; |
options.setDevParam = false; |
options.doClip = true; |
options.cropMarks = false; |
6903,7 → 6903,7 |
options.markLength = 20.0; |
options.markOffset = 0.0; |
options.bleeds.set(0, 0, 0, 0); |
PSLib *pslib = new PSLib(options, false, prefsManager->appPrefs.fontPrefs.AvailFonts, ReallyUsed, usedColors, false, true); |
PSLib *pslib = new PSLib(options, false, m_prefsManager->appPrefs.fontPrefs.AvailFonts, ReallyUsed, usedColors, false, true); |
if (pslib != NULL) |
{ |
qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); |
6985,15 → 6985,15 |
} |
filename = QDir::toNativeSeparators(filename); |
QString wdir = "."; |
QString prefsDocDir=prefsManager->documentDir(); |
QString prefsDocDir=m_prefsManager->documentDir(); |
if (!prefsDocDir.isEmpty()) |
wdir = prefsManager->prefsFile->getContext("dirs")->get("eps", prefsDocDir); |
wdir = m_prefsManager->prefsFile->getContext("dirs")->get("eps", prefsDocDir); |
else |
wdir = prefsManager->prefsFile->getContext("dirs")->get("eps", "."); |
QString fn = CFileDialog( wdir, tr("Save As"), tr("%1;;All Files (*)").arg(formatsManager->extensionsForFormat(FormatsManager::EPS)), filename, fdHidePreviewCheckBox | fdNone); |
wdir = m_prefsManager->prefsFile->getContext("dirs")->get("eps", "."); |
QString fn = CFileDialog( wdir, tr("Save As"), tr("%1;;All Files (*)").arg(m_formatsManager->extensionsForFormat(FormatsManager::EPS)), filename, fdHidePreviewCheckBox | fdNone); |
if (!fn.isEmpty()) |
{ |
prefsManager->prefsFile->getContext("dirs")->set("eps", fn.left(fn.lastIndexOf("/"))); |
m_prefsManager->prefsFile->getContext("dirs")->set("eps", fn.left(fn.lastIndexOf("/"))); |
if (overwrite(this, fn)) |
{ |
QString epsError; |
7092,7 → 7092,7 |
doc->pdfOptions().SubsetList = tmpEm; |
} |
MarginStruct optBleeds(doc->pdfOptions().bleeds); |
PDFExportDialog dia(this, doc->DocName, ReallyUsed, view, doc->pdfOptions(), ScCore->PDFXProfiles, prefsManager->appPrefs.fontPrefs.AvailFonts, ScCore->PrinterProfiles); |
PDFExportDialog dia(this, doc->DocName, ReallyUsed, view, doc->pdfOptions(), ScCore->PDFXProfiles, m_prefsManager->appPrefs.fontPrefs.AvailFonts, ScCore->PrinterProfiles); |
if (dia.exec()) |
{ |
qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); |
7339,7 → 7339,7 |
view->requestMode(submodeEndNodeEdit); |
ScriXmlDoc ss; |
if(ss.ReadElem(xml, prefsManager->appPrefs.fontPrefs.AvailFonts, docc, x, y, art, loca, prefsManager->appPrefs.fontPrefs.GFontSub)) |
if(ss.ReadElem(xml, m_prefsManager->appPrefs.fontPrefs.AvailFonts, docc, x, y, art, loca, m_prefsManager->appPrefs.fontPrefs.GFontSub)) |
{ |
vie->DrawNew(); |
if (doc == docc) |
7365,7 → 7365,7 |
nodePalette->unitChange(); |
alignDistributePalette->unitChange(); |
guidePalette->setupPage(); |
styleManager->unitChange(); |
m_styleManager->unitChange(); |
if (draw) |
view->DrawNew(); |
} |
7396,10 → 7396,10 |
doc->setAutoSave(false); |
} |
view->Deselect(true); |
storedPageNum = doc->currentPageNumber(); |
storedViewXCoor = view->contentsX(); |
storedViewYCoor = view->contentsY(); |
storedViewScale = view->scale(); |
m_storedPageNum = doc->currentPageNumber(); |
m_storedViewXCoor = view->contentsX(); |
m_storedViewYCoor = view->contentsY(); |
m_storedViewScale = view->scale(); |
doc->stored_minCanvasCoordinate = doc->minCanvasCoordinate; |
doc->stored_maxCanvasCoordinate = doc->maxCanvasCoordinate; |
view->showSymbolPage(temp); |
7431,7 → 7431,7 |
{ |
doc->minCanvasCoordinate = doc->stored_minCanvasCoordinate; |
doc->maxCanvasCoordinate = doc->stored_maxCanvasCoordinate; |
view->setScale(storedViewScale); |
view->setScale(m_storedViewScale); |
view->hideSymbolPage(); |
if (m_WasAutoSave) |
{ |
7445,13 → 7445,13 |
scrActions["PrintPreview"]->setEnabled(true); |
pagePalette->enablePalette(true); |
pagePalette->rebuildMasters(); |
view->setScale(storedViewScale); |
view->setScale(m_storedViewScale); |
// #12857 : the number of pages may change when undoing/redoing |
// page addition/deletion while in edit mode, so take some extra |
// care so that storedPageNum is in appropriate range |
storedPageNum = qMin(storedPageNum, doc->DocPages.count() - 1); |
doc->setCurrentPage(doc->DocPages.at(storedPageNum)); |
view->setContentsPos(static_cast<int>(storedViewXCoor * storedViewScale), static_cast<int>(storedViewYCoor * storedViewScale)); |
m_storedPageNum = qMin(m_storedPageNum, doc->DocPages.count() - 1); |
doc->setCurrentPage(doc->DocPages.at(m_storedPageNum)); |
view->setContentsPos(static_cast<int>(m_storedViewXCoor * m_storedViewScale), static_cast<int>(m_storedViewYCoor * m_storedViewScale)); |
view->DrawNew(); |
pagePalette->Rebuild(); |
propertiesPalette->updateColorList(); |
7477,10 → 7477,10 |
else |
doc->currentEditedTextframe = NULL; |
view->Deselect(true); |
storedPageNum = doc->currentPageNumber(); |
storedViewXCoor = view->contentsX(); |
storedViewYCoor = view->contentsY(); |
storedViewScale = view->scale(); |
m_storedPageNum = doc->currentPageNumber(); |
m_storedViewXCoor = view->contentsX(); |
m_storedViewYCoor = view->contentsY(); |
m_storedViewScale = view->scale(); |
doc->stored_minCanvasCoordinate = doc->minCanvasCoordinate; |
doc->stored_maxCanvasCoordinate = doc->maxCanvasCoordinate; |
view->showInlinePage(id); |
7497,7 → 7497,7 |
{ |
doc->minCanvasCoordinate = doc->stored_minCanvasCoordinate; |
doc->maxCanvasCoordinate = doc->stored_maxCanvasCoordinate; |
view->setScale(storedViewScale); |
view->setScale(m_storedViewScale); |
view->hideInlinePage(); |
if (m_WasAutoSave) |
{ |
7508,13 → 7508,13 |
appModeHelper->setInlineEditMode(false, doc); |
pagePalette->enablePalette(true); |
pagePalette->rebuildMasters(); |
view->setScale(storedViewScale); |
view->setScale(m_storedViewScale); |
// #12857 : the number of pages may change when undoing/redoing |
// page addition/deletion while in edit mode, so take some extra |
// care so that storedPageNum is in appropriate range |
storedPageNum = qMin(storedPageNum, doc->DocPages.count() - 1); |
doc->setCurrentPage(doc->DocPages.at(storedPageNum)); |
view->setContentsPos(static_cast<int>(storedViewXCoor * storedViewScale), static_cast<int>(storedViewYCoor * storedViewScale)); |
m_storedPageNum = qMin(m_storedPageNum, doc->DocPages.count() - 1); |
doc->setCurrentPage(doc->DocPages.at(m_storedPageNum)); |
view->setContentsPos(static_cast<int>(m_storedViewXCoor * m_storedViewScale), static_cast<int>(m_storedViewYCoor * m_storedViewScale)); |
if (doc->currentEditedTextframe != NULL) |
doc->currentEditedTextframe->invalidateLayout(); |
doc->currentEditedTextframe = NULL; |
7553,10 → 7553,10 |
return; |
} |
storedPageNum = doc->currentPageNumber(); |
storedViewXCoor = view->contentsX(); |
storedViewYCoor = view->contentsY(); |
storedViewScale = view->scale(); |
m_storedPageNum = doc->currentPageNumber(); |
m_storedViewXCoor = view->contentsX(); |
m_storedViewYCoor = view->contentsY(); |
m_storedViewScale = view->scale(); |
doc->stored_minCanvasCoordinate = doc->minCanvasCoordinate; |
doc->stored_maxCanvasCoordinate = doc->maxCanvasCoordinate; |
7571,7 → 7571,7 |
void ScribusMainWindow::editMasterPagesEnd() |
{ |
view->setScale(storedViewScale); |
view->setScale(m_storedViewScale); |
doc->minCanvasCoordinate = doc->stored_minCanvasCoordinate; |
doc->maxCanvasCoordinate = doc->stored_maxCanvasCoordinate; |
view->hideMasterPage(); |
7595,13 → 7595,13 |
// #12857 : the number of pages may change when undoing/redoing |
// page addition/deletion while in edit mode, so take some extra |
// care so that storedPageNum is in appropriate range |
storedPageNum = qMin(storedPageNum, doc->DocPages.count() - 1); |
doc->setCurrentPage(doc->DocPages.at(storedPageNum)); |
m_storedPageNum = qMin(m_storedPageNum, doc->DocPages.count() - 1); |
doc->setCurrentPage(doc->DocPages.at(m_storedPageNum)); |
doc->minCanvasCoordinate = doc->stored_minCanvasCoordinate; |
doc->maxCanvasCoordinate = doc->stored_maxCanvasCoordinate; |
doc->setLoading(true); |
view->reformPages(false); |
view->setContentsPos(static_cast<int>(storedViewXCoor * storedViewScale), static_cast<int>(storedViewYCoor * storedViewScale)); |
view->setContentsPos(static_cast<int>(m_storedViewXCoor * m_storedViewScale), static_cast<int>(m_storedViewYCoor * m_storedViewScale)); |
doc->setLoading(false); |
view->DrawNew(); |
} |
7769,7 → 7769,7 |
addNewPages(wo, where, 1, doc->pageHeight(), doc->pageWidth(), doc->pageOrientation(), doc->pageSize(), true, &tmpl); |
} |
UndoObject *tmp = |
undoManager->replaceObject(state->getUInt("DUMMY_ID"), doc->Pages->at(pagenr - 1)); |
m_undoManager->replaceObject(state->getUInt("DUMMY_ID"), doc->Pages->at(pagenr - 1)); |
delete tmp; |
} |
else |
7776,7 → 7776,7 |
{ |
DummyUndoObject *duo = new DummyUndoObject(); |
uint id = static_cast<uint>(duo->getUId()); |
undoManager->replaceObject(doc->Pages->at(pagenr - 1)->getUId(), duo); |
m_undoManager->replaceObject(doc->Pages->at(pagenr - 1)->getUId(), duo); |
state->set("DUMMY_ID", id); |
deletePage(pagenr, pagenr); |
} |
7836,7 → 7836,7 |
{ |
DummyUndoObject *duo = new DummyUndoObject(); |
ulong did = duo->getUId(); |
undoManager->replaceObject(doc->Pages->at(i)->getUId(), duo); |
m_undoManager->replaceObject(doc->Pages->at(i)->getUId(), duo); |
state->set(QString("Page%1").arg(i), static_cast<uint>(did)); |
} |
if (doc->appMode == modeEditClip) |
7857,7 → 7857,7 |
} |
for (int i = delFrom - 1; i < delTo; ++i) |
{ |
UndoObject *tmp = undoManager->replaceObject( |
UndoObject *tmp = m_undoManager->replaceObject( |
state->getUInt(QString("Page%1").arg(i)), doc->Pages->at(i)); |
delete tmp; |
} |
8015,7 → 8015,7 |
void ScribusMainWindow::SetShortCut() |
{ |
for (QMap<QString,Keys>::Iterator it = prefsManager->appPrefs.keyShortcutPrefs.KeyActions.begin(); it != prefsManager->appPrefs.keyShortcutPrefs.KeyActions.end(); ++it ) |
for (QMap<QString,Keys>::Iterator it = m_prefsManager->appPrefs.keyShortcutPrefs.KeyActions.begin(); it != m_prefsManager->appPrefs.keyShortcutPrefs.KeyActions.end(); ++it ) |
{ |
if (!it.value().actionName.isEmpty()) |
if (scrActions[it.value().actionName]) |
8163,9 → 8163,9 |
//For each hyphenation file, grab the strings and the hyphenation data. |
QString lang = QString(QLocale::system().name()).left(2); |
//IL LangTransl.clear(); |
prefsManager->appPrefs.hyphPrefs.Language = "en_GB"; |
m_prefsManager->appPrefs.hyphPrefs.Language = "en_GB"; |
if (!LanguageManager::instance()->getHyphFilename(lang).isEmpty() ) |
prefsManager->appPrefs.hyphPrefs.Language = lang; |
m_prefsManager->appPrefs.hyphPrefs.Language = lang; |
/* |
if ((hyphDir.exists()) && (hyphDir.count() != 0)) |
8372,7 → 8372,7 |
return; |
} |
#endif |
QString imageEditorExecutable=prefsManager->imageEditorExecutable(); |
QString imageEditorExecutable=m_prefsManager->imageEditorExecutable(); |
if (ExternalApp != 0) |
{ |
QString ieExe = QDir::toNativeSeparators(imageEditorExecutable); |
8429,25 → 8429,25 |
void ScribusMainWindow::setUndoMode(bool isObjectSpecific) |
{ |
objectSpecificUndo = isObjectSpecific; |
m_objectSpecificUndo = isObjectSpecific; |
if (!objectSpecificUndo && HaveDoc) |
undoManager->showObject(Um::GLOBAL_UNDO_MODE); |
if (!m_objectSpecificUndo && HaveDoc) |
m_undoManager->showObject(Um::GLOBAL_UNDO_MODE); |
else if (HaveDoc) |
{ |
uint docSelectionCount=doc->m_Selection->count(); |
if (docSelectionCount == 1) |
undoManager->showObject(doc->m_Selection->itemAt(0)->getUId()); |
m_undoManager->showObject(doc->m_Selection->itemAt(0)->getUId()); |
else if (docSelectionCount == 0) |
undoManager->showObject(doc->currentPage()->getUId()); |
m_undoManager->showObject(doc->currentPage()->getUId()); |
else |
undoManager->showObject(Um::NO_UNDO_STACK); |
m_undoManager->showObject(Um::NO_UNDO_STACK); |
} |
} |
bool ScribusMainWindow::isObjectSpecificUndo() |
{ |
return objectSpecificUndo; |
return m_objectSpecificUndo; |
} |
void ScribusMainWindow::getImageInfo() |
8485,7 → 8485,7 |
void ScribusMainWindow::generateTableOfContents() |
{ |
if (HaveDoc) |
tocGenerator->generateDefault(); |
m_tocGenerator->generateDefault(); |
} |
void ScribusMainWindow::updateDocument() |
8503,9 → 8503,9 |
if (!HaveDoc) |
return; |
LoremManager m(doc, this); |
if (prefsManager->appPrefs.miscPrefs.useStandardLI) |
if (m_prefsManager->appPrefs.miscPrefs.useStandardLI) |
{ |
m.insertLoremIpsum("la.xml", prefsManager->appPrefs.miscPrefs.paragraphsLI); |
m.insertLoremIpsum("la.xml", m_prefsManager->appPrefs.miscPrefs.paragraphsLI); |
return; |
} |
8520,7 → 8520,7 |
//Update colours in case someone has a translated None colour in their preference settings |
//before changing the tr_NoneColor to the new value. See #9267, #5529 |
prefsManager->languageChange(); |
m_prefsManager->languageChange(); |
CommonStrings::languageChange(); |
LanguageManager::instance()->languageChange(); |
//Update actions |
8533,8 → 8533,8 |
//Update menu texts |
if (scrMenuMgr!=NULL && !scrMenuMgr->empty()) |
scrMenuMgr->languageChange(); |
if (undoManager!=NULL) |
undoManager->languageChange(); |
if (m_undoManager!=NULL) |
m_undoManager->languageChange(); |
statusBarLanguageChange(); |
viewToolBar->languageChange(); |
} |
8551,7 → 8551,7 |
mainWindowYPosLabel->setText( tr("Y:")); |
mainWindowXPosDataLabel->setText(" "); |
mainWindowYPosDataLabel->setText(" "); |
mainWindowStatusLabel->setText( tr("Ready")); |
m_mainWindowStatusLabel->setText( tr("Ready")); |
} |
void ScribusMainWindow::setDefaultPrinter(const QString& name, const QString& file, const QString& command) |
8818,7 → 8818,7 |
return; |
UndoTransaction trans; |
if (UndoManager::undoEnabled()) |
trans = undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Transform,"",Um::IMove); |
trans = m_undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Transform,"",Um::IMove); |
qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); |
int count=td.getCount(); |
QTransform matrix(td.getTransformMatrix()); |
8847,8 → 8847,8 |
doc->SnapGrid = false; |
doc->SnapGuides = false; |
doc->SnapElement = false; |
bool wasUndo = undoManager->undoEnabled(); |
undoManager->setUndoEnabled(false); |
bool wasUndo = m_undoManager->undoEnabled(); |
m_undoManager->setUndoEnabled(false); |
slotElemRead(buffer, 0, 0, false, true, doc, view); |
doc->SnapGrid = savedAlignGrid; |
doc->SnapGuides = savedAlignGuides; |
8884,7 → 8884,7 |
*doc->m_Selection=tempSelection; |
doc->minCanvasCoordinate = minSize; |
doc->maxCanvasCoordinate = maxSize; |
undoManager->setUndoEnabled(wasUndo); |
m_undoManager->setUndoEnabled(wasUndo); |
inlinePalette->unsetDoc(); |
inlinePalette->setDoc(doc); |
if (outlinePalette->isVisible()) |
8908,8 → 8908,8 |
doc->SnapGrid = false; |
doc->SnapGuides = false; |
doc->SnapElement = false; |
bool wasUndo = undoManager->undoEnabled(); |
undoManager->setUndoEnabled(false); |
bool wasUndo = m_undoManager->undoEnabled(); |
m_undoManager->setUndoEnabled(false); |
internalCopy = true; |
slotEditCopy(); |
slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view); |
8948,7 → 8948,7 |
*doc->m_Selection=tempSelection; |
doc->minCanvasCoordinate = minSize; |
doc->maxCanvasCoordinate = maxSize; |
undoManager->setUndoEnabled(wasUndo); |
m_undoManager->setUndoEnabled(wasUndo); |
inlinePalette->unsetDoc(); |
inlinePalette->setDoc(doc); |
if (outlinePalette->isVisible()) |
8971,7 → 8971,7 |
doc->SnapGrid = false; |
doc->SnapGuides = false; |
doc->SnapElement = false; |
undoManager->setUndoEnabled(false); |
m_undoManager->setUndoEnabled(false); |
internalCopy = true; |
slotEditCopy(); |
slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view); |
9048,7 → 9048,7 |
doc->maxCanvasCoordinate = maxSize; |
if (outlinePalette->isVisible()) |
outlinePalette->BuildTree(); |
undoManager->setUndoEnabled(true); |
m_undoManager->setUndoEnabled(true); |
return; |
} |
ScPattern pat = ScPattern(); |
9094,7 → 9094,7 |
view->DrawNew(); |
if (outlinePalette->isVisible()) |
outlinePalette->BuildTree(); |
undoManager->setUndoEnabled(true); |
m_undoManager->setUndoEnabled(true); |
} |
void ScribusMainWindow::ConvertToSymbol() |
9114,7 → 9114,7 |
if (!dia.exec()) |
return; |
patternName = dia.getEditText(); |
undoManager->setUndoEnabled(false); |
m_undoManager->setUndoEnabled(false); |
doc->itemSelection_convertItemsToSymbol(patternName); |
propertiesPalette->updateColorList(); |
symbolPalette->updateSymbolList(); |
9122,7 → 9122,7 |
if (outlinePalette->isVisible()) |
outlinePalette->BuildTree(); |
view->DrawNew(); |
undoManager->setUndoEnabled(true); |
m_undoManager->setUndoEnabled(true); |
} |
void ScribusMainWindow::managePaints() |
9140,14 → 9140,14 |
} |
else |
{ |
Gradients = &prefsManager->appPrefs.defaultGradients; |
edc = prefsManager->colorSet(); |
docPatterns = &prefsManager->appPrefs.defaultPatterns; |
Gradients = &m_prefsManager->appPrefs.defaultGradients; |
edc = m_prefsManager->colorSet(); |
docPatterns = &m_prefsManager->appPrefs.defaultPatterns; |
tmpDoc = m_doc; |
doc = m_doc; |
} |
undoManager->setUndoEnabled(false); |
PaintManagerDialog *dia = new PaintManagerDialog(this, Gradients, edc, prefsManager->colorSetName(), docPatterns, tmpDoc, this); |
m_undoManager->setUndoEnabled(false); |
PaintManagerDialog *dia = new PaintManagerDialog(this, Gradients, edc, m_prefsManager->colorSetName(), docPatterns, tmpDoc, this); |
if (dia->exec()) |
{ |
if (HaveDoc) |
9197,11 → 9197,11 |
else |
{ |
// Update tools colors if needed |
prefsManager->replaceToolColors(dia->replaceColorMap); |
prefsManager->setColorSet(dia->m_colorList); |
propertiesPalette->Cpal->setColors(prefsManager->colorSet()); |
prefsManager->appPrefs.defaultGradients = dia->dialogGradients; |
prefsManager->appPrefs.defaultPatterns = dia->dialogPatterns; |
m_prefsManager->replaceToolColors(dia->replaceColorMap); |
m_prefsManager->setColorSet(dia->m_colorList); |
propertiesPalette->Cpal->setColors(m_prefsManager->colorSet()); |
m_prefsManager->appPrefs.defaultGradients = dia->dialogGradients; |
m_prefsManager->appPrefs.defaultPatterns = dia->dialogPatterns; |
QString Cpfad = QDir::toNativeSeparators(ScPaths::getApplicationDataDir())+"DefaultColors.xml"; |
const FileFormat *fmt = LoadSavePlugin::getFormatById(FORMATID_SLA150EXPORT); |
if (fmt) |
9218,7 → 9218,7 |
fmt->savePalette(Cpfad); |
delete s_doc; |
} |
prefsManager->setColorSetName(dia->getColorSetName()); |
m_prefsManager->setColorSetName(dia->getColorSetName()); |
doc = NULL; |
} |
} |
9225,7 → 9225,7 |
if (!HaveDoc) |
doc = NULL; |
delete dia; |
undoManager->setUndoEnabled(true); |
m_undoManager->setUndoEnabled(true); |
} |
void ScribusMainWindow::slotReplaceColors() |
9246,7 → 9246,7 |
doc->recalculateColors(); |
doc->recalcPicturesRes(); |
requestUpdate(reqColorsUpdate | reqLineStylesUpdate); |
styleManager->updateColorList(); |
m_styleManager->updateColorList(); |
if (!doc->m_Selection->isEmpty()) |
doc->m_Selection->itemAt(0)->emitAllToGUI(); |
view->DrawNew(); |
9283,7 → 9283,7 |
if (currItem->HasSel) |
{ |
if (UndoManager::instance()->undoEnabled()) |
trans = undoManager->beginTransaction(Um::Selection,Um::IDelete,Um::Delete,"",Um::IDelete); |
trans = m_undoManager->beginTransaction(Um::Selection,Um::IDelete,Um::Delete,"",Um::IDelete); |
//inserting mark replace some selected text |
currItem->asTextFrame()->deleteSelectedTextFromFrame(); |
} |
9370,7 → 9370,7 |
if (currItem->HasSel) |
{ |
if (UndoManager::instance()->undoEnabled()) |
trans = undoManager->beginTransaction(Um::Selection,Um::IDelete,Um::Delete,"",Um::IDelete); |
trans = m_undoManager->beginTransaction(Um::Selection,Um::IDelete,Um::Delete,"",Um::IDelete); |
//inserting mark replace some selected text |
currItem->asTextFrame()->deleteSelectedTextFromFrame(); |
} |
9414,7 → 9414,7 |
is->set("nStyle", nStyle->name()); |
is->set("at", currItem->itemText.cursorPosition() -1); |
is->insertItem("inItem", currItem); |
undoManager->action(doc, is); |
m_undoManager->action(doc, is); |
} |
if (trans) |
trans.commit(); |
9613,7 → 9613,7 |
is->set("noteframeName", currItem->getUName()); |
else |
is->insertItem("inItem", currItem); |
undoManager->action(doc, is); |
m_undoManager->action(doc, is); |
docWasChanged = true; |
} |
} |
9878,7 → 9878,7 |
is->insertItem("itemPtrNEW", mrk->getItemPtr()); |
} |
} |
undoManager->action(doc, is); |
m_undoManager->action(doc, is); |
} |
} |
delete editMDialog; |
9908,11 → 9908,11 |
{ |
qDebug()<<"Testing Qt Quick 2.0"; |
qqview = new QQuickView(); |
qqview->setSource(QUrl::fromLocalFile(ScPaths::instance().qmlDir() + "qtq_test1.qml")); |
qqview->setFlags(Qt::Tool); |
qqview->setResizeMode(QQuickView::SizeViewToRootObject); |
QObject *rootObject = dynamic_cast<QObject*>(qqview->rootObject()); |
m_qqview = new QQuickView(); |
m_qqview->setSource(QUrl::fromLocalFile(ScPaths::instance().qmlDir() + "qtq_test1.qml")); |
m_qqview->setFlags(Qt::Tool); |
m_qqview->setResizeMode(QQuickView::SizeViewToRootObject); |
QObject *rootObject = dynamic_cast<QObject*>(m_qqview->rootObject()); |
QObject *q_closeCheckBox = rootObject->findChild<QObject*>("closeCheckBox"); |
QObject *q_xSpinBox = rootObject->findChild<QObject*>("xSpinBox"); |
QObject *q_ySpinBox = rootObject->findChild<QObject*>("ySpinBox"); |
9920,7 → 9920,7 |
connect(q_xSpinBox, SIGNAL(editingFinished()), this, SLOT(testQT_slot4())); |
connect(q_ySpinBox, SIGNAL(valueChanged(int)), this, SLOT(testQT_slot3(int))); |
connect(q_closeCheckBox, SIGNAL(clicked()), this, SLOT(testQT_slot4())); |
qqview->show(); |
m_qqview->show(); |
} |
void ScribusMainWindow::testQT_slot1(QString s) |
9941,14 → 9941,14 |
void ScribusMainWindow::testQT_slot4() |
{ |
qDebug()<<"Signal data empty but received"; |
QObject *rootObject = dynamic_cast<QObject*>(qqview->rootObject()); |
QObject *rootObject = dynamic_cast<QObject*>(m_qqview->rootObject()); |
QObject *q_xSpinBox = rootObject->findChild<QObject*>("xSpinBox"); |
//if (q_xSpinBox==sender()) |
{ |
qDebug()<<"qov"<<q_xSpinBox->property("value").toDouble(); |
} |
qqview->close(); |
qqview->deleteLater(); |
m_qqview->close(); |
m_qqview->deleteLater(); |
} |
/* |
/trunk/Scribus/scribus/scribus.h |
---|
140,8 → 140,8 |
void setDefaultPrinter(const QString&, const QString&, const QString&); |
void getDefaultPrinter(QString& name, QString& file, QString& command); |
inline bool scriptIsRunning(void) const { return (ScriptRunning > 0); } |
inline void setScriptRunning(bool value) { ScriptRunning += (value ? 1 : -1); } |
inline bool scriptIsRunning(void) const { return (m_ScriptRunning > 0); } |
inline void setScriptRunning(bool value) { m_ScriptRunning += (value ? 1 : -1); } |
ScribusDoc *doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount=1, bool showView=true, int marginPreset=0); |
ScribusDoc *newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount=1, bool showView=true, int marginPreset=0); |
541,7 → 541,7 |
//! \brief manages paints |
void managePaints(); |
//! \brief allow SE to get the SM for edit stlyes |
StyleManager *styleMgr() const {return styleManager;}; |
StyleManager *styleMgr() const {return m_styleManager;}; |
//! \brief drawnew, call palettes to update for new page layout |
void updateGUIAfterPagesChanged(); |
/** |
609,55 → 609,55 |
void updateColorMenu(QProgressBar* progressBar=NULL); |
int ScriptRunning; |
int m_ScriptRunning; |
QLabel* mainWindowStatusLabel; |
QString statusLabelText; |
QLabel* m_mainWindowStatusLabel; |
QString m_statusLabelText; |
//QPixmap noIcon; |
int toolbarMenuTools; |
int toolbarMenuPDFTools; |
int viewToolbars; |
int viewPropertiesPalette; |
int viewOutlinePalette; |
int viewNodePalette; |
int viewBpal; |
int viewLayerPalette; |
int viewPagePalette; |
int viewBopal; |
int viewUndoPalette; |
int m_toolbarMenuTools; |
int m_toolbarMenuPDFTools; |
int m_viewToolbars; |
int m_viewPropertiesPalette; |
int m_viewOutlinePalette; |
int m_viewNodePalette; |
int m_viewBpal; |
int m_viewLayerPalette; |
int m_viewPagePalette; |
int m_viewBopal; |
int m_viewUndoPalette; |
bool palettesStatus[11]; |
bool guidesStatus[13]; |
bool m_palettesStatus[11]; |
bool m_guidesStatus[13]; |
bool keyrep; |
bool m_keyrep; |
/** @brief Tells if an arrow key is pressed down */ |
bool _arrowKeyDown; |
bool m__arrowKeyDown; |
/** @brief tells the undo mode */ |
bool objectSpecificUndo; |
bool m_objectSpecificUndo; |
//CB: #8212: add overrideMasterPageSizing, however default to true for compatibility with other calls.. for now |
void addNewPages(int wo, int where, int numPages, double height, double width, int orient, QString siz, bool mov, QStringList* basedOn = 0, bool overrideMasterPageSizing=true); |
int DocNr; |
bool PrinterUsed; |
int m_DocNr; |
bool m_PrinterUsed; |
struct PDe { |
QString Pname; |
QString Dname; |
QString Command; |
} PDef ; |
TOCGenerator *tocGenerator; |
int storedPageNum; |
int storedViewXCoor; |
int storedViewYCoor; |
double storedViewScale; |
StyleManager *styleManager; |
UndoManager *undoManager; |
PrefsManager *prefsManager; |
FormatsManager *formatsManager; |
TOCGenerator *m_tocGenerator; |
int m_storedPageNum; |
int m_storedViewXCoor; |
int m_storedViewYCoor; |
double m_storedViewScale; |
StyleManager *m_styleManager; |
UndoManager *m_undoManager; |
PrefsManager *m_prefsManager; |
FormatsManager *m_formatsManager; |
QPointer<HelpBrowser> helpBrowser; |
QString osgFilterString; |
QPointer<HelpBrowser> m_helpBrowser; |
QString m_osgFilterString; |
void insertMark(MarkType); |
bool insertMarkDialog(PageItem_TextFrame* item, MarkType mT, ScItemsState* &is); |
665,7 → 665,7 |
bool m_WasAutoSave; |
bool m_pagePalVisible; |
QQuickView *qqview; |
QQuickView *m_qqview; |
}; |
#endif |
/trunk/Scribus/scribus/scribusapp.cpp |
---|
102,8 → 102,8 |
bool ScribusQApp::useGUI=false; |
ScribusQApp::ScribusQApp( int & argc, char ** argv ) : QApplication(argc, argv), |
lang(""), |
GUILang("") |
m_lang(""), |
m_GUILang("") |
{ |
ScQApp = this; |
ScCore = 0; |
127,7 → 127,7 |
void ScribusQApp::initLang() |
{ |
QStringList langs = getLang(QString(lang)); |
QStringList langs = getLang(QString(m_lang)); |
if (!langs.isEmpty()) |
installTranslators(langs); |
141,7 → 141,7 |
void ScribusQApp::parseCommandLine() |
{ |
showSplash=!neverSplashExists(); |
m_showSplash=!neverSplashExists(); |
QString arg(""); |
bool usage=false; |
bool header=false; |
153,8 → 153,8 |
char** testargsv; |
int testargsc; |
#endif |
showFontInfo=false; |
showProfileInfo=false; |
m_showFontInfo=false; |
m_showProfileInfo=false; |
bool neversplash = false; |
//Parse for command line options |
196,7 → 196,7 |
else if ((arg == ARG_LANG || arg == ARG_LANG_SHORT)) |
{ |
if (++argi < argsc) |
lang = args[argi]; |
m_lang = args[argi]; |
else |
{ |
std::cout << tr("Option %1 requires an argument.").arg(arg).toLocal8Bit().data() << std::endl; |
236,11 → 236,11 |
continue; |
} else if (arg == ARG_NOSPLASH || arg == ARG_NOSPLASH_SHORT) |
{ |
showSplash = false; |
m_showSplash = false; |
} |
else if (arg == ARG_NEVERSPLASH || arg == ARG_NEVERSPLASH_SHORT) |
{ |
showSplash = false; |
m_showSplash = false; |
neversplash = true; |
} |
else if (arg == ARG_NOGUI || arg == ARG_NOGUI_SHORT) |
249,11 → 249,11 |
} |
else if (arg == ARG_FONTINFO || arg == ARG_FONTINFO_SHORT) |
{ |
showFontInfo=true; |
m_showFontInfo=true; |
} |
else if (arg == ARG_PROFILEINFO || arg == ARG_PROFILEINFO_SHORT) |
{ |
showProfileInfo=true; |
m_showProfileInfo=true; |
} |
else if ((arg == ARG_DISPLAY || arg==ARG_DISPLAY_SHORT || arg==ARG_DISPLAY_QT) && ++argi < argsc) |
{ |
268,10 → 268,10 |
std::cout << tr("Option %1 requires an argument.").arg(arg).toLocal8Bit().data() << std::endl; |
std::exit(EXIT_FAILURE); |
} |
prefsUserFile = QFile::decodeName(args[argi + 1].toLocal8Bit()); |
if (!QFileInfo(prefsUserFile).exists()) |
m_prefsUserFile = QFile::decodeName(args[argi + 1].toLocal8Bit()); |
if (!QFileInfo(m_prefsUserFile).exists()) |
{ |
std::cout << tr("Preferences file %1 does not exist, aborting.").arg(prefsUserFile).toLocal8Bit().data() << std::endl; |
std::cout << tr("Preferences file %1 does not exist, aborting.").arg(m_prefsUserFile).toLocal8Bit().data() << std::endl; |
std::exit(EXIT_FAILURE); |
} else { |
++argi; |
293,15 → 293,15 |
std::cout << tr("Invalid argument: %1").arg(arg).toLocal8Bit().data() << std::endl; |
std::exit(EXIT_FAILURE); |
} |
fileName = QFile::decodeName(args[argi].toLocal8Bit()); |
if (!QFileInfo(fileName).exists()) |
m_fileName = QFile::decodeName(args[argi].toLocal8Bit()); |
if (!QFileInfo(m_fileName).exists()) |
{ |
std::cout << tr("File %1 does not exist, aborting.").arg(fileName).toLocal8Bit().data() << std::endl; |
std::cout << tr("File %1 does not exist, aborting.").arg(m_fileName).toLocal8Bit().data() << std::endl; |
std::exit(EXIT_FAILURE); |
} |
else |
{ |
filesToLoad.append(fileName); |
m_filesToLoad.append(m_fileName); |
} |
} |
} |
308,15 → 308,15 |
// parse for remaining (positional) arguments, if any |
for ( ; argi<argsc; argi++) |
{ |
fileName = QFile::decodeName(args[argi].toLocal8Bit()); |
if (!QFileInfo(fileName).exists()) |
m_fileName = QFile::decodeName(args[argi].toLocal8Bit()); |
if (!QFileInfo(m_fileName).exists()) |
{ |
std::cout << tr("File %1 does not exist, aborting.").arg(fileName).toLocal8Bit().data() << std::endl; |
std::cout << tr("File %1 does not exist, aborting.").arg(m_fileName).toLocal8Bit().data() << std::endl; |
std::exit(EXIT_FAILURE); |
} |
else |
{ |
filesToLoad.append(fileName); |
m_filesToLoad.append(m_fileName); |
} |
} |
//Init translations |
360,7 → 360,7 |
return EXIT_FAILURE; |
ScCore=m_ScCore; |
processEvents(); |
ScCore->init(useGUI, filesToLoad); |
ScCore->init(useGUI, m_filesToLoad); |
int retVal=EXIT_SUCCESS; |
/* TODO: |
* When Scribus is truly able to run without GUI |
369,7 → 369,7 |
*/ |
// if (useGUI) |
if (true) |
retVal=ScCore->startGUI(showSplash, showFontInfo, showProfileInfo, lang, prefsUserFile); |
retVal=ScCore->startGUI(m_showSplash, m_showFontInfo, m_showProfileInfo, m_lang, m_prefsUserFile); |
// A hook for plugins and scripts to trigger on. Some plugins and scripts |
// require the app to be fully set up (in particular, the main window to be |
499,7 → 499,7 |
lang=(*it); |
if (lang == "en") |
{ |
GUILang=lang; |
m_GUILang=lang; |
break; |
} |
else |
523,10 → 523,10 |
if (loadedScribus) |
{ |
installTranslator(trans); |
GUILang=lang; |
m_GUILang=lang; |
} |
else if (lang == "en") |
GUILang=lang; |
m_GUILang=lang; |
/* CB TODO, currently disabled, because its broken broken broken |
path = ScPaths::instance().pluginDir(); |
QDir dir(path , "*.*", QDir::Name, QDir::Files | QDir::NoSymLinks); |
556,7 → 556,7 |
} |
else |
newLangs.append(newGUILang); |
if (newLangs[0] != GUILang) |
if (newLangs[0] != m_GUILang) |
installTranslators(newLangs); |
} |
694,7 → 694,7 |
} |
else |
{ |
filesToLoad.append(filename); |
m_filesToLoad.append(filename); |
} |
return true; |
} |
/trunk/Scribus/scribus/scribusapp.h |
---|
42,7 → 42,7 |
void initLang(); |
void initDLMgr(); |
void parseCommandLine(); |
void changeGUILanguage(const QString & lang); |
void changeGUILanguage(const QString & m_lang); |
/*! |
\author Franz Schmid |
\author Alessandro Rimoldi |
55,7 → 55,7 |
\param lang QString a two letter string describing the lang environement |
\retval QStringList A string describing the language environement |
*/ |
QStringList getLang(QString lang); |
QStringList getLang(QString m_lang); |
/*! |
\author Franz Schmid |
\author Alessandro Rimoldi |
69,7 → 69,7 |
static bool useGUI; |
void neverSplash(bool splashOff); |
bool neverSplashExists(); |
const QString& currGUILanguage() { return GUILang; } |
const QString& currGUILanguage() { return m_GUILang; } |
ScDLManager* dlManager() { return m_scDLMgr; } |
QString pythonScript; // script to be run in python from CLI |
QStringList pythonScriptArgs; // command line arguments and flags for script from CLI |
92,15 → 92,15 |
*/ |
void showAvailLangs(); |
QString lang; |
QString GUILang; |
bool showSplash; |
bool showFontInfo; |
bool showProfileInfo; |
QString m_lang; |
QString m_GUILang; |
bool m_showSplash; |
bool m_showFontInfo; |
bool m_showProfileInfo; |
//! \brief If is there user given prefs file... |
QString prefsUserFile; |
QList<QString> filesToLoad; |
QString fileName; |
QString m_prefsUserFile; |
QList<QString> m_filesToLoad; |
QString m_fileName; |
ScDLManager *m_scDLMgr; |
protected: |
/trunk/Scribus/scribus/scribuscore.cpp |
---|
62,9 → 62,9 |
ScribusCore::~ScribusCore() |
{ |
while (ScMWList.count() > 0) |
while (m_ScMWList.count() > 0) |
{ |
ScribusMainWindow *mainWindow = ScMWList.takeAt(0); |
ScribusMainWindow *mainWindow = m_ScMWList.takeAt(0); |
delete mainWindow; |
} |
} |
99,7 → 99,7 |
Q_CHECK_PTR(scribus); |
if (!scribus) |
return(EXIT_FAILURE); |
ScMWList.append(scribus); |
m_ScMWList.append(scribus); |
m_currScMW=0; |
int retVal=initScribusCore(showSplash, showFontInfo, showProfileInfo,newGuiLanguage, prefsUserFile); |
if (retVal == EXIT_FAILURE) |
142,39 → 142,39 |
const QString newGuiLanguage, const QString prefsUserFile) |
{ |
CommonStrings::languageChange(); |
iconManager = IconManager::instance(); |
if (!iconManager->setup()) |
m_iconManager = IconManager::instance(); |
if (!m_iconManager->setup()) |
return EXIT_FAILURE; |
// FIXME: Splash needs the prefs loaded by initDefaults() to know if it must force the image to grayscale |
initSplash(showSplash); |
LocaleManager::instance(); |
prefsManager = PrefsManager::instance(); |
prefsManager->setup(); |
m_prefsManager = PrefsManager::instance(); |
m_prefsManager->setup(); |
//CB #4428 Get fonts before prefs are set to default |
bool haveFonts=false; |
haveFonts=ScCore->initFonts(showFontInfo); |
if (!haveFonts) |
return EXIT_FAILURE; |
prefsManager->initDefaults(); |
prefsManager->initDefaultGUIFont(qApp->font()); |
prefsManager->initArrowStyles(); |
undoManager = UndoManager::instance(); |
m_prefsManager->initDefaults(); |
m_prefsManager->initDefaultGUIFont(qApp->font()); |
m_prefsManager->initArrowStyles(); |
m_undoManager = UndoManager::instance(); |
fileWatcher = new FileWatcher(this); |
pluginManager = new PluginManager(); |
setSplashStatus( tr("Initializing Keyboard Shortcuts") ); |
prefsManager->initDefaultActionKeys(); |
m_prefsManager->initDefaultActionKeys(); |
setSplashStatus( tr("Reading Preferences") ); |
if (prefsUserFile.isEmpty()) |
prefsManager->ReadPrefs(); |
m_prefsManager->ReadPrefs(); |
else |
prefsManager->ReadPrefs(prefsUserFile); |
prefsManager->appPrefs.uiPrefs.showSplashOnStartup=showSplash; |
if (!iconManager->setActiveFromPrefs(prefsManager->appPrefs.uiPrefs.iconSet)) |
m_prefsManager->ReadPrefs(prefsUserFile); |
m_prefsManager->appPrefs.uiPrefs.showSplashOnStartup=showSplash; |
if (!m_iconManager->setActiveFromPrefs(m_prefsManager->appPrefs.uiPrefs.iconSet)) |
{ |
//reset prefs name to chosen name based on version, when prefs is empty or not found |
prefsManager->appPrefs.uiPrefs.iconSet=iconManager->activeSetBasename(); |
m_prefsManager->appPrefs.uiPrefs.iconSet=m_iconManager->activeSetBasename(); |
} |
m_HaveGS = testGSAvailability(); |
190,10 → 190,10 |
setSplashStatus( tr("Initializing Image Cache") ); |
ScImageCacheManager & icm = ScImageCacheManager::instance(); |
icm.setEnabled(prefsManager->appPrefs.imageCachePrefs.cacheEnabled); |
icm.setMaxCacheSizeMiB(prefsManager->appPrefs.imageCachePrefs.maxCacheSizeMiB); |
icm.setMaxCacheEntries(prefsManager->appPrefs.imageCachePrefs.maxCacheEntries); |
icm.setCompressionLevel(prefsManager->appPrefs.imageCachePrefs.compressionLevel); |
icm.setEnabled(m_prefsManager->appPrefs.imageCachePrefs.cacheEnabled); |
icm.setMaxCacheSizeMiB(m_prefsManager->appPrefs.imageCachePrefs.maxCacheSizeMiB); |
icm.setMaxCacheEntries(m_prefsManager->appPrefs.imageCachePrefs.maxCacheEntries); |
icm.setCompressionLevel(m_prefsManager->appPrefs.imageCachePrefs.compressionLevel); |
icm.initialize(); |
return 0; |
} |
268,7 → 268,7 |
bool ScribusCore::initFonts(bool showFontInfo) |
{ |
setSplashStatus( tr("Searching for Fonts") ); |
bool haveFonts=prefsManager->GetAllFonts(showFontInfo); |
bool haveFonts=m_prefsManager->GetAllFonts(showFontInfo); |
if (!haveFonts) |
{ |
closeSplash(); |
292,7 → 292,7 |
InputProfilesCMYK.clear(); |
LabProfiles.clear(); |
profDirs = ScPaths::getSystemProfilesDirs(); |
profDirs.prepend( prefsManager->appPrefs.pathPrefs.colorProfiles ); |
profDirs.prepend( m_prefsManager->appPrefs.pathPrefs.colorProfiles ); |
profDirs.prepend( ScPaths::instance().shareDir()+"profiles/"); |
for(int i = 0; i < profDirs.count(); i++) |
{ |
428,12 → 428,12 |
MonitorProfiles.insert(defaultRGBString, defaultRGBProfile.profilePath()); |
// Open monitor profile as defined by user preferences |
QString displayProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile; |
QString displayProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile; |
if (MonitorProfiles.contains(displayProfile)) |
monitorProfile = defaultEngine.openProfileFromFile( MonitorProfiles[displayProfile] ); |
if (monitorProfile.isNull()) |
{ |
prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = defaultRGBString; |
m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = defaultRGBString; |
monitorProfile = defaultRGBProfile; |
} |
478,47 → 478,47 |
if (m_HaveCMS) |
{ |
ProfilesL::Iterator ip; |
if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile.isEmpty()) || (!InputProfiles.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile))) |
if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile.isEmpty()) || (!InputProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile))) |
{ |
ip = InputProfiles.find("sRGB IEC61966-2.1"); |
if (ip == InputProfiles.end()) |
ip = InputProfiles.begin(); |
prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = ip.key(); |
m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = ip.key(); |
} |
if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile))) |
if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile))) |
{ |
ip = InputProfilesCMYK.find("Fogra27L CMYK Coated Press"); |
if (ip == InputProfilesCMYK.end()) |
ip = InputProfilesCMYK.begin(); |
prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile = ip.key(); |
m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile = ip.key(); |
} |
if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile.isEmpty()) || (!InputProfiles.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile))) |
if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile.isEmpty()) || (!InputProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile))) |
{ |
ip = InputProfiles.find("sRGB IEC61966-2.1"); |
if (ip == InputProfiles.end()) |
ip = InputProfiles.begin(); |
prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile = ip.key(); |
m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile = ip.key(); |
} |
if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile))) |
if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile))) |
{ |
ip = InputProfilesCMYK.find("Fogra27L CMYK Coated Press"); |
if (ip == InputProfilesCMYK.end()) |
ip = InputProfilesCMYK.begin(); |
prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile = ip.key(); |
m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile = ip.key(); |
} |
if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile.isEmpty()) || (!MonitorProfiles.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile))) |
if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile.isEmpty()) || (!MonitorProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile))) |
{ |
ip = MonitorProfiles.find("sRGB IEC61966-2.1"); |
if (ip == MonitorProfiles.end()) |
ip = MonitorProfiles.begin(); |
prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = ip.key(); |
m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = ip.key(); |
} |
if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile.isEmpty()) || (!PrinterProfiles.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile))) |
if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile.isEmpty()) || (!PrinterProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile))) |
{ |
ip = PrinterProfiles.find("Fogra27L CMYK Coated Press"); |
if (ip == PrinterProfiles.end()) |
ip = PrinterProfiles.begin(); |
prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = ip.key(); |
m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = ip.key(); |
} |
InitDefaultColorTransforms(); |
} |
526,9 → 526,9 |
ScribusMainWindow * ScribusCore::primaryMainWindow() |
{ |
if (ScMWList.count() == 0 || m_currScMW > ScMWList.count()) |
if (m_ScMWList.count() == 0 || m_currScMW > m_ScMWList.count()) |
return 0; |
ScribusMainWindow* mw=ScMWList.at(m_currScMW); |
ScribusMainWindow* mw=m_ScMWList.at(m_currScMW); |
if (!mw) |
return 0; |
return mw; |
/trunk/Scribus/scribus/scribuscore.h |
---|
129,13 → 129,13 |
protected: |
void initCMS(); |
QList<ScribusMainWindow*> ScMWList; |
QList<ScribusMainWindow*> m_ScMWList; |
int m_currScMW; |
ScSplashScreen *m_SplashScreen; |
IconManager *iconManager; |
UndoManager *undoManager; |
PrefsManager *prefsManager; |
IconManager *m_iconManager; |
UndoManager *m_undoManager; |
PrefsManager *m_prefsManager; |
bool m_ScribusInitialized; |
bool m_UseGUI; |
QList<QString> m_Files; |
/trunk/Scribus/scribus/scribusdoc.cpp |
---|
199,15 → 199,15 |
ScribusDoc::ScribusDoc() : UndoObject( tr("Document")), Observable<ScribusDoc>(NULL), |
m_hasGUI(false), |
docFilePermissions(QFileDevice::ReadOwner|QFileDevice::WriteOwner), |
appPrefsData(PrefsManager::instance()->appPrefs), |
docPrefsData(PrefsManager::instance()->appPrefs), |
undoManager(UndoManager::instance()), |
loading(false), |
modified(false), |
ActiveLayer(0), |
rotMode(0), |
automaticTextFrames(0), |
m_docFilePermissions(QFileDevice::ReadOwner|QFileDevice::WriteOwner), |
m_appPrefsData(PrefsManager::instance()->appPrefs), |
m_docPrefsData(PrefsManager::instance()->appPrefs), |
m_undoManager(UndoManager::instance()), |
m_loading(false), |
m_modified(false), |
m_ActiveLayer(0), |
m_rotMode(0), |
m_automaticTextFrames(0), |
m_masterPageMode(false), |
m_symbolEditMode(false), |
m_inlineEditMode(false), |
238,7 → 238,7 |
ValCount(0), |
DocName( tr("Document")+"-"), |
UsedFonts(), |
AllFonts(&appPrefsData.fontPrefs.AvailFonts), |
AllFonts(&m_appPrefsData.fontPrefs.AvailFonts), |
AObjects(), |
CurrentSel(-1), |
nodeEdit(), |
246,10 → 246,10 |
DraggedElem(0), |
ElemToLink(0), |
DragElements(), |
docParagraphStyles(), |
docCharStyles(), |
docTableStyles(), |
docCellStyles(), |
m_docParagraphStyles(), |
m_docCharStyles(), |
m_docTableStyles(), |
m_docCellStyles(), |
Layers(), |
GroupCounter(1), |
colorEngine(ScCore->defaultEngine), |
277,7 → 277,7 |
m_currentPage(NULL), |
m_updateManager(), |
m_docUpdater(NULL), |
flag_notesChanged(false), |
m_flag_notesChanged(false), |
flag_restartMarksRenumbering(false), |
flag_updateMarksLabels(false), |
flag_updateEndNotes(false), |
285,14 → 285,14 |
flag_Renumber(false), |
flag_NumUpdateRequest(false) |
{ |
docUnitRatio=unitGetRatioFromIndex(docPrefsData.docSetupPrefs.docUnitIndex); |
docPrefsData.docSetupPrefs.pageHeight=0; |
docPrefsData.docSetupPrefs.pageWidth=0; |
docPrefsData.docSetupPrefs.pagePositioning=0; |
maxCanvasCoordinate=(FPoint(docPrefsData.displayPrefs.scratch.left() + docPrefsData.displayPrefs.scratch.right(), docPrefsData.displayPrefs.scratch.top() + docPrefsData.displayPrefs.scratch.bottom())), |
m_docUnitRatio=unitGetRatioFromIndex(m_docPrefsData.docSetupPrefs.docUnitIndex); |
m_docPrefsData.docSetupPrefs.pageHeight=0; |
m_docPrefsData.docSetupPrefs.pageWidth=0; |
m_docPrefsData.docSetupPrefs.pagePositioning=0; |
maxCanvasCoordinate=(FPoint(m_docPrefsData.displayPrefs.scratch.left() + m_docPrefsData.displayPrefs.scratch.right(), m_docPrefsData.displayPrefs.scratch.top() + m_docPrefsData.displayPrefs.scratch.bottom())), |
init(); |
docPrefsData.pdfPrefs.bleeds = docPrefsData.docSetupPrefs.bleeds; |
docPrefsData.pdfPrefs.useDocBleeds = true; |
m_docPrefsData.pdfPrefs.bleeds = m_docPrefsData.docSetupPrefs.bleeds; |
m_docPrefsData.pdfPrefs.useDocBleeds = true; |
Print_Options.firstUse = true; |
drawAsPreview = false; |
viewAsPreview = false; |
314,16 → 314,16 |
ScribusDoc::ScribusDoc(const QString& docName, int unitindex, const PageSize& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup) : UndoObject( tr("Document")), |
m_hasGUI(false), |
docFilePermissions(QFileDevice::ReadOwner|QFileDevice::WriteOwner), |
appPrefsData(PrefsManager::instance()->appPrefs), |
docPrefsData(PrefsManager::instance()->appPrefs), |
undoManager(UndoManager::instance()), |
loading(false), |
modified(false), |
ActiveLayer(0), |
docUnitRatio(unitGetRatioFromIndex(appPrefsData.docSetupPrefs.docUnitIndex)), |
rotMode(0), |
automaticTextFrames(pagesSetup.autoTextFrames), |
m_docFilePermissions(QFileDevice::ReadOwner|QFileDevice::WriteOwner), |
m_appPrefsData(PrefsManager::instance()->appPrefs), |
m_docPrefsData(PrefsManager::instance()->appPrefs), |
m_undoManager(UndoManager::instance()), |
m_loading(false), |
m_modified(false), |
m_ActiveLayer(0), |
m_docUnitRatio(unitGetRatioFromIndex(m_appPrefsData.docSetupPrefs.docUnitIndex)), |
m_rotMode(0), |
m_automaticTextFrames(pagesSetup.autoTextFrames), |
m_masterPageMode(false), |
m_symbolEditMode(false), |
m_inlineEditMode(false), |
355,7 → 355,7 |
ValCount(0), |
DocName(docName), |
UsedFonts(), |
AllFonts(&appPrefsData.fontPrefs.AvailFonts), |
AllFonts(&m_appPrefsData.fontPrefs.AvailFonts), |
AObjects(), |
CurrentSel(-1), |
nodeEdit(), |
363,10 → 363,10 |
DraggedElem(0), |
ElemToLink(0), |
DragElements(), |
docParagraphStyles(), |
docCharStyles(), |
docTableStyles(), |
docCellStyles(), |
m_docParagraphStyles(), |
m_docCharStyles(), |
m_docTableStyles(), |
m_docCellStyles(), |
Layers(), |
GroupCounter(1), |
colorEngine(ScCore->defaultEngine), |
394,7 → 394,7 |
m_currentPage(NULL), |
m_updateManager(), |
m_docUpdater(NULL), |
flag_notesChanged(false), |
m_flag_notesChanged(false), |
flag_restartMarksRenumbering(false), |
flag_updateMarksLabels(false), |
flag_updateEndNotes(false), |
402,18 → 402,18 |
flag_Renumber(false), |
flag_NumUpdateRequest(false) |
{ |
docPrefsData.docSetupPrefs.docUnitIndex=unitindex; |
docPrefsData.docSetupPrefs.pageHeight=pagesize.height(); |
docPrefsData.docSetupPrefs.pageWidth=pagesize.width(); |
docPrefsData.docSetupPrefs.pageSize=pagesize.name(); |
docPrefsData.docSetupPrefs.margins=margins; |
maxCanvasCoordinate=(FPoint(docPrefsData.displayPrefs.scratch.left() + docPrefsData.displayPrefs.scratch.right(), docPrefsData.displayPrefs.scratch.top() + docPrefsData.displayPrefs.scratch.bottom())), |
m_docPrefsData.docSetupPrefs.docUnitIndex=unitindex; |
m_docPrefsData.docSetupPrefs.pageHeight=pagesize.height(); |
m_docPrefsData.docSetupPrefs.pageWidth=pagesize.width(); |
m_docPrefsData.docSetupPrefs.pageSize=pagesize.name(); |
m_docPrefsData.docSetupPrefs.margins=margins; |
maxCanvasCoordinate=(FPoint(m_docPrefsData.displayPrefs.scratch.left() + m_docPrefsData.displayPrefs.scratch.right(), m_docPrefsData.displayPrefs.scratch.top() + m_docPrefsData.displayPrefs.scratch.bottom())), |
setPageSetFirstPage(pagesSetup.pageArrangement, pagesSetup.firstPageLocation); |
init(); |
docPrefsData.pdfPrefs.bleeds = docPrefsData.docSetupPrefs.bleeds; |
docPrefsData.pdfPrefs.useDocBleeds = true; |
docPrefsData.docSetupPrefs.pageOrientation=pagesSetup.orientation; |
docPrefsData.docSetupPrefs.pagePositioning=pagesSetup.pageArrangement; |
m_docPrefsData.pdfPrefs.bleeds = m_docPrefsData.docSetupPrefs.bleeds; |
m_docPrefsData.pdfPrefs.useDocBleeds = true; |
m_docPrefsData.docSetupPrefs.pageOrientation=pagesSetup.orientation; |
m_docPrefsData.docSetupPrefs.pagePositioning=pagesSetup.pageArrangement; |
Print_Options.firstUse = true; |
drawAsPreview = false; |
viewAsPreview = false; |
430,7 → 430,7 |
Q_CHECK_PTR(autoSaveTimer); |
HasCMS = false; |
docPrefsData.colorPrefs.DCMSset.CMSinUse = false; |
m_docPrefsData.colorPrefs.DCMSset.CMSinUse = false; |
colorEngine = ScCore->defaultEngine; |
SetDefaultCMSParams(); |
448,53 → 448,53 |
m_pagesChanged.connectObserver(m_docUpdater); |
PrefsManager *prefsManager = PrefsManager::instance(); |
docPrefsData.colorPrefs.DCMSset = prefsManager->appPrefs.colorPrefs.DCMSset; |
docPrefsData.pdfPrefs.SolidProf = docPrefsData.colorPrefs.DCMSset.DefaultSolidColorRGBProfile; |
docPrefsData.pdfPrefs.ImageProf = docPrefsData.colorPrefs.DCMSset.DefaultImageRGBProfile; |
docPrefsData.pdfPrefs.PrintProf = docPrefsData.colorPrefs.DCMSset.DefaultPrinterProfile; |
docPrefsData.pdfPrefs.Intent = docPrefsData.colorPrefs.DCMSset.DefaultIntentColors; |
docPrefsData.pdfPrefs.Intent2 = docPrefsData.colorPrefs.DCMSset.DefaultIntentImages; |
m_docPrefsData.colorPrefs.DCMSset = prefsManager->appPrefs.colorPrefs.DCMSset; |
m_docPrefsData.pdfPrefs.SolidProf = m_docPrefsData.colorPrefs.DCMSset.DefaultSolidColorRGBProfile; |
m_docPrefsData.pdfPrefs.ImageProf = m_docPrefsData.colorPrefs.DCMSset.DefaultImageRGBProfile; |
m_docPrefsData.pdfPrefs.PrintProf = m_docPrefsData.colorPrefs.DCMSset.DefaultPrinterProfile; |
m_docPrefsData.pdfPrefs.Intent = m_docPrefsData.colorPrefs.DCMSset.DefaultIntentColors; |
m_docPrefsData.pdfPrefs.Intent2 = m_docPrefsData.colorPrefs.DCMSset.DefaultIntentImages; |
AddFont(appPrefsData.itemToolPrefs.textFont);//, prefsData.AvailFonts[prefsData.itemToolPrefs.textFont]->Font); |
AddFont(m_appPrefsData.itemToolPrefs.textFont);//, prefsData.AvailFonts[prefsData.itemToolPrefs.textFont]->Font); |
//FIXME: aren't we doing this now anyway with prefs struct copy? |
docPrefsData.itemToolPrefs.textFont = appPrefsData.itemToolPrefs.textFont; |
docPrefsData.itemToolPrefs.textSize = appPrefsData.itemToolPrefs.textSize; |
docPrefsData.itemToolPrefs.textTabFillChar = appPrefsData.itemToolPrefs.textTabFillChar; |
docPrefsData.opToolPrefs.dispX = appPrefsData.opToolPrefs.dispX; |
docPrefsData.opToolPrefs.dispY = appPrefsData.opToolPrefs.dispY; |
docPrefsData.opToolPrefs.constrain = appPrefsData.opToolPrefs.constrain; |
m_docPrefsData.itemToolPrefs.textFont = m_appPrefsData.itemToolPrefs.textFont; |
m_docPrefsData.itemToolPrefs.textSize = m_appPrefsData.itemToolPrefs.textSize; |
m_docPrefsData.itemToolPrefs.textTabFillChar = m_appPrefsData.itemToolPrefs.textTabFillChar; |
m_docPrefsData.opToolPrefs.dispX = m_appPrefsData.opToolPrefs.dispX; |
m_docPrefsData.opToolPrefs.dispY = m_appPrefsData.opToolPrefs.dispY; |
m_docPrefsData.opToolPrefs.constrain = m_appPrefsData.opToolPrefs.constrain; |
PageColors.ensureDefaultColors(); |
if (appPrefsData.itemToolPrefs.shapeLineColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.shapeLineColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.shapeLineColor]); |
docPrefsData.itemToolPrefs.shapeLineColor = appPrefsData.itemToolPrefs.shapeLineColor; |
if (appPrefsData.itemToolPrefs.lineColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.lineColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.lineColor]); |
docPrefsData.itemToolPrefs.lineColor = appPrefsData.itemToolPrefs.lineColor; |
if (appPrefsData.itemToolPrefs.textColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.textColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.textColor]); |
docPrefsData.itemToolPrefs.textColor = appPrefsData.itemToolPrefs.textColor; |
if (appPrefsData.itemToolPrefs.textStrokeColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.textStrokeColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.textStrokeColor]); |
docPrefsData.itemToolPrefs.textStrokeColor = appPrefsData.itemToolPrefs.textStrokeColor; |
if (appPrefsData.itemToolPrefs.shapeFillColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.shapeFillColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.shapeFillColor]); |
docPrefsData.itemToolPrefs.shapeFillColor = appPrefsData.itemToolPrefs.shapeFillColor; |
if (appPrefsData.itemToolPrefs.imageFillColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.imageFillColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.imageFillColor]); |
docPrefsData.itemToolPrefs.imageFillColor = appPrefsData.itemToolPrefs.imageFillColor; |
if (appPrefsData.itemToolPrefs.imageStrokeColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.imageStrokeColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.imageStrokeColor]); |
docPrefsData.itemToolPrefs.imageStrokeColor = appPrefsData.itemToolPrefs.imageStrokeColor; |
if (appPrefsData.itemToolPrefs.textFillColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.textFillColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.textFillColor]); |
docPrefsData.itemToolPrefs.textFillColor = appPrefsData.itemToolPrefs.textFillColor; |
if (appPrefsData.itemToolPrefs.textLineColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.textLineColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.textLineColor]); |
if (appPrefsData.itemToolPrefs.calligraphicPenFillColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.calligraphicPenFillColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.calligraphicPenFillColor]); |
if (appPrefsData.itemToolPrefs.calligraphicPenLineColor != CommonStrings::None) |
PageColors.insert(appPrefsData.itemToolPrefs.calligraphicPenLineColor, appPrefsData.colorPrefs.DColors[appPrefsData.itemToolPrefs.calligraphicPenLineColor]); |
if (m_appPrefsData.itemToolPrefs.shapeLineColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.shapeLineColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.shapeLineColor]); |
m_docPrefsData.itemToolPrefs.shapeLineColor = m_appPrefsData.itemToolPrefs.shapeLineColor; |
if (m_appPrefsData.itemToolPrefs.lineColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.lineColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.lineColor]); |
m_docPrefsData.itemToolPrefs.lineColor = m_appPrefsData.itemToolPrefs.lineColor; |
if (m_appPrefsData.itemToolPrefs.textColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.textColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.textColor]); |
m_docPrefsData.itemToolPrefs.textColor = m_appPrefsData.itemToolPrefs.textColor; |
if (m_appPrefsData.itemToolPrefs.textStrokeColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.textStrokeColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.textStrokeColor]); |
m_docPrefsData.itemToolPrefs.textStrokeColor = m_appPrefsData.itemToolPrefs.textStrokeColor; |
if (m_appPrefsData.itemToolPrefs.shapeFillColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.shapeFillColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.shapeFillColor]); |
m_docPrefsData.itemToolPrefs.shapeFillColor = m_appPrefsData.itemToolPrefs.shapeFillColor; |
if (m_appPrefsData.itemToolPrefs.imageFillColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.imageFillColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.imageFillColor]); |
m_docPrefsData.itemToolPrefs.imageFillColor = m_appPrefsData.itemToolPrefs.imageFillColor; |
if (m_appPrefsData.itemToolPrefs.imageStrokeColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.imageStrokeColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.imageStrokeColor]); |
m_docPrefsData.itemToolPrefs.imageStrokeColor = m_appPrefsData.itemToolPrefs.imageStrokeColor; |
if (m_appPrefsData.itemToolPrefs.textFillColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.textFillColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.textFillColor]); |
m_docPrefsData.itemToolPrefs.textFillColor = m_appPrefsData.itemToolPrefs.textFillColor; |
if (m_appPrefsData.itemToolPrefs.textLineColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.textLineColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.textLineColor]); |
if (m_appPrefsData.itemToolPrefs.calligraphicPenFillColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.calligraphicPenFillColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.calligraphicPenFillColor]); |
if (m_appPrefsData.itemToolPrefs.calligraphicPenLineColor != CommonStrings::None) |
PageColors.insert(m_appPrefsData.itemToolPrefs.calligraphicPenLineColor, m_appPrefsData.colorPrefs.DColors[m_appPrefsData.itemToolPrefs.calligraphicPenLineColor]); |
ParagraphStyle pstyle; |
520,13 → 520,13 |
CharStyle cstyle; |
cstyle.setDefaultStyle(true); |
cstyle.setName(CommonStrings::DefaultCharacterStyle); |
cstyle.setFont(appPrefsData.fontPrefs.AvailFonts[docPrefsData.itemToolPrefs.textFont]); |
cstyle.setFontSize(docPrefsData.itemToolPrefs.textSize); |
cstyle.setFont(m_appPrefsData.fontPrefs.AvailFonts[m_docPrefsData.itemToolPrefs.textFont]); |
cstyle.setFontSize(m_docPrefsData.itemToolPrefs.textSize); |
cstyle.setFeatures(QStringList(CharStyle::INHERIT)); |
cstyle.setFillColor(docPrefsData.itemToolPrefs.textColor); |
cstyle.setFillShade(docPrefsData.itemToolPrefs.textShade); |
cstyle.setStrokeColor(docPrefsData.itemToolPrefs.textStrokeColor); |
cstyle.setStrokeShade(docPrefsData.itemToolPrefs.textStrokeShade); |
cstyle.setFillColor(m_docPrefsData.itemToolPrefs.textColor); |
cstyle.setFillShade(m_docPrefsData.itemToolPrefs.textShade); |
cstyle.setStrokeColor(m_docPrefsData.itemToolPrefs.textStrokeColor); |
cstyle.setStrokeShade(m_docPrefsData.itemToolPrefs.textStrokeShade); |
cstyle.setBackColor(CommonStrings::None); |
cstyle.setBackShade(100); |
cstyle.setBaselineOffset(0); |
533,23 → 533,23 |
cstyle.setShadowXOffset(50); |
cstyle.setShadowYOffset(-50); |
cstyle.setOutlineWidth(10); |
cstyle.setUnderlineOffset(docPrefsData.typoPrefs.valueUnderlinePos); |
cstyle.setUnderlineWidth(docPrefsData.typoPrefs.valueUnderlineWidth); |
cstyle.setStrikethruOffset(docPrefsData.typoPrefs.valueStrikeThruPos); |
cstyle.setStrikethruWidth(docPrefsData.typoPrefs.valueStrikeThruPos); |
cstyle.setUnderlineOffset(m_docPrefsData.typoPrefs.valueUnderlinePos); |
cstyle.setUnderlineWidth(m_docPrefsData.typoPrefs.valueUnderlineWidth); |
cstyle.setStrikethruOffset(m_docPrefsData.typoPrefs.valueStrikeThruPos); |
cstyle.setStrikethruWidth(m_docPrefsData.typoPrefs.valueStrikeThruPos); |
cstyle.setScaleH(1000); |
cstyle.setScaleV(1000); |
cstyle.setTracking(0); |
cstyle.setLanguage(PrefsManager::instance()->appPrefs.hyphPrefs.Language); |
docParagraphStyles.create(pstyle); |
docParagraphStyles.makeDefault( &(docParagraphStyles[0]) ); |
m_docParagraphStyles.create(pstyle); |
m_docParagraphStyles.makeDefault( & |