Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 5780 → Rev 5781

/branches/Version13x/Scribus/scribus/fileloader.cpp
29,7 → 29,7
#include "plugins/formatidlist.h"
#include "pagestructs.h"
#include "scconfig.h"
#include "scribus.h"
#include "scribuscore.h"
#include "scribusXml.h"
#include "units.h"
#include "loadsaveplugin.h"
136,7 → 136,7
return ret;
}
 
static void replaceFonts(PageItem *it, QMap<QString, int> UsedFonts, QMap<QString, QString> ReplacedFonts)
static void replaceFonts(ScribusDoc* currDoc, PageItem *it, QMap<QString, int> UsedFonts, QMap<QString, QString> ReplacedFonts)
{
if ((it->asTextFrame()) || (it->asPathText()))
{
146,7 → 146,7
int start = it->itemText.startOfRun(e);
Foi* oldFont = it->itemText.charStyle(start).font();
if (!UsedFonts.contains(oldFont->scName())) {
newFontStyle.setFont((*ScMW->doc->AllFonts)[ReplacedFonts[oldFont->scName()]]);
newFontStyle.setFont((*currDoc->AllFonts)[ReplacedFonts[oldFont->scName()]]);
it->itemText.applyCharStyle(start, it->itemText.endOfRun(e) - start, newFontStyle );
}
}
154,7 → 154,7
}
 
 
bool FileLoader::LoadPage(int PageToLoad, bool Mpage, QString renamedPageName)
bool FileLoader::LoadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName)
{
bool ret = false;
newReplacement = false;
166,7 → 166,7
{
if (FileType==FORMATID_SLA12XIMPORT)
{
(*it).plug->setupTargets(ScMW->doc, ScMW->view, ScMW->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
(*it).plug->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
if (ret)
(*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyFois);
173,7 → 173,7
}
if (FileType==FORMATID_SLA13XIMPORT || FileType==FORMATID_SLA134IMPORT)
{
(*it).plug->setupTargets(ScMW->doc, 0, ScMW->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
(*it).plug->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
if (ret)
(*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyFois);
199,32 → 199,32
return false;
}
}
for (uint d = 0; d < ScMW->doc->MasterItems.count(); ++d)
for (uint d = 0; d < currDoc->MasterItems.count(); ++d)
{
replaceFonts(ScMW->doc->MasterItems.at(d), ScMW->doc->UsedFonts, ReplacedFonts);
replaceFonts(currDoc, currDoc->MasterItems.at(d), currDoc->UsedFonts, ReplacedFonts);
}
for (uint d = 0; d < ScMW->doc->DocItems.count(); ++d)
for (uint d = 0; d < currDoc->DocItems.count(); ++d)
{
replaceFonts(ScMW->doc->DocItems.at(d), ScMW->doc->UsedFonts, ReplacedFonts);
replaceFonts(currDoc, currDoc->DocItems.at(d), currDoc->UsedFonts, ReplacedFonts);
}
for (uint d = 0; d < ScMW->doc->FrameItems.count(); ++d)
for (uint d = 0; d < currDoc->FrameItems.count(); ++d)
{
replaceFonts(ScMW->doc->FrameItems.at(d), ScMW->doc->UsedFonts, ReplacedFonts);
replaceFonts(currDoc, currDoc->FrameItems.at(d), currDoc->UsedFonts, ReplacedFonts);
}
for (uint a = 0; a < ScMW->doc->docParagraphStyles.count(); ++a)
for (uint a = 0; a < currDoc->docParagraphStyles.count(); ++a)
{
if ( ScMW->doc->docParagraphStyles[a].charStyle().font() != &Foi::NONE && !ScMW->doc->UsedFonts.contains(ScMW->doc->docParagraphStyles[a].charStyle().font()->scName()))
ScMW->doc->docParagraphStyles[a].charStyle().setFont
((*ScMW->doc->AllFonts)[ReplacedFonts[ScMW->doc->docParagraphStyles[a].charStyle().font()->scName()]]);
if ( currDoc->docParagraphStyles[a].charStyle().font() != &Foi::NONE && !currDoc->UsedFonts.contains(currDoc->docParagraphStyles[a].charStyle().font()->scName()))
currDoc->docParagraphStyles[a].charStyle().setFont
((*currDoc->AllFonts)[ReplacedFonts[currDoc->docParagraphStyles[a].charStyle().font()->scName()]]);
}
QMap<QString,QString>::Iterator itfsu;
for (itfsu = ReplacedFonts.begin(); itfsu != ReplacedFonts.end(); ++itfsu)
{
if (!ScMW->doc->UsedFonts.contains(itfsu.data()))
if (!currDoc->UsedFonts.contains(itfsu.data()))
{
// QFont fo = prefsManager->appPrefs.AvailFonts[itfsu.data()]->Font;
// fo.setPointSize(qRound(ScMW->doc->toolSettings.defSize / 10.0));
ScMW->doc->AddFont(itfsu.data(), qRound(ScMW->doc->toolSettings.defSize / 10.0));
currDoc->AddFont(itfsu.data(), qRound(currDoc->toolSettings.defSize / 10.0));
}
}
if (prefsManager->appPrefs.askBeforeSubstituite)
241,24 → 241,24
\brief Loads the file "FileName" as a Scribus document
\retval bool true when loading is succsessful, false otherwise
*/
bool FileLoader::LoadFile()
bool FileLoader::LoadFile(ScribusDoc* currDoc)
{
newReplacement = false;
ScMW->doc->guidesSettings.marginsShown = prefsManager->appPrefs.guidesSettings.marginsShown;
ScMW->doc->guidesSettings.framesShown = prefsManager->appPrefs.guidesSettings.framesShown;
ScMW->doc->guidesSettings.layerMarkersShown = prefsManager->appPrefs.guidesSettings.layerMarkersShown;
ScMW->doc->guidesSettings.gridShown = prefsManager->appPrefs.guidesSettings.gridShown;
ScMW->doc->guidesSettings.guidesShown = prefsManager->appPrefs.guidesSettings.guidesShown;
ScMW->doc->guidesSettings.colBordersShown = prefsManager->appPrefs.guidesSettings.colBordersShown;
ScMW->doc->guidesSettings.baseShown = prefsManager->appPrefs.guidesSettings.baseShown;
ScMW->doc->guidesSettings.linkShown = prefsManager->appPrefs.guidesSettings.linkShown;
ScMW->doc->toolSettings.polyC = prefsManager->appPrefs.toolSettings.polyC;
ScMW->doc->toolSettings.polyF = prefsManager->appPrefs.toolSettings.polyF;
ScMW->doc->toolSettings.polyR = prefsManager->appPrefs.toolSettings.polyR;
ScMW->doc->toolSettings.polyFd = prefsManager->appPrefs.toolSettings.polyFd;
ScMW->doc->toolSettings.polyS = prefsManager->appPrefs.toolSettings.polyS;
ScMW->doc->AutoSave = prefsManager->appPrefs.AutoSave;
ScMW->doc->AutoSaveTime = prefsManager->appPrefs.AutoSaveTime;
currDoc->guidesSettings.marginsShown = prefsManager->appPrefs.guidesSettings.marginsShown;
currDoc->guidesSettings.framesShown = prefsManager->appPrefs.guidesSettings.framesShown;
currDoc->guidesSettings.layerMarkersShown = prefsManager->appPrefs.guidesSettings.layerMarkersShown;
currDoc->guidesSettings.gridShown = prefsManager->appPrefs.guidesSettings.gridShown;
currDoc->guidesSettings.guidesShown = prefsManager->appPrefs.guidesSettings.guidesShown;
currDoc->guidesSettings.colBordersShown = prefsManager->appPrefs.guidesSettings.colBordersShown;
currDoc->guidesSettings.baseShown = prefsManager->appPrefs.guidesSettings.baseShown;
currDoc->guidesSettings.linkShown = prefsManager->appPrefs.guidesSettings.linkShown;
currDoc->toolSettings.polyC = prefsManager->appPrefs.toolSettings.polyC;
currDoc->toolSettings.polyF = prefsManager->appPrefs.toolSettings.polyF;
currDoc->toolSettings.polyR = prefsManager->appPrefs.toolSettings.polyR;
currDoc->toolSettings.polyFd = prefsManager->appPrefs.toolSettings.polyFd;
currDoc->toolSettings.polyS = prefsManager->appPrefs.toolSettings.polyS;
currDoc->AutoSave = prefsManager->appPrefs.AutoSave;
currDoc->AutoSaveTime = prefsManager->appPrefs.AutoSaveTime;
ReplacedFonts.clear();
dummyFois.clear();
dummyFois.setAutoDelete(true);
269,7 → 269,7
{
case FORMATID_SLA12XIMPORT:
{
(*it).setupTargets(ScMW->doc, ScMW->view, ScMW->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
(*it).setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
if (ret)
(*it).getReplacedFontData(newReplacement, ReplacedFonts, dummyFois);
278,7 → 278,7
case FORMATID_SLA13XIMPORT:
case FORMATID_SLA134IMPORT:
{
(*it).setupTargets(ScMW->doc, 0, ScMW->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
(*it).setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
if (ret)
(*it).getReplacedFontData(newReplacement, ReplacedFonts, dummyFois);
285,6 → 285,7
}
break;
default:
(*it).setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret = (*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
break;
}
302,7 → 303,7
// ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
// break;
// case FORMATID_SLA13XIMPORT:
(*it).setupTargets(doc, 0, ScMW->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
(*it).setupTargets(doc, 0, doc->scMW(), doc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).saveFile(fileName);
// break;
// default:
345,7 → 346,7
return false;
}
 
void FileLoader::readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc)
void FileLoader::readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *currDoc)
{
vg.setName(pg.attribute("NAME"));
vg.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(pg.attribute("LINESPMode", "0").toInt()));
360,7 → 361,7
vg.setGapBefore(pg.attribute("VOR", "0").toDouble());
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
PrefsManager * prefsManager = PrefsManager::instance();
QString tmpf = pg.attribute("FONT", doc->toolSettings.defFont);
QString tmpf = pg.attribute("FONT", currDoc->toolSettings.defFont);
if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
373,22 → 374,22
}
else
{
if (!doc->UsedFonts.contains(tmpf))
if (!currDoc->UsedFonts.contains(tmpf))
{
// QFont fo = avail[tmpf]->Font;
// fo.setPointSize(qRound(doc->toolSettings.defSize / 10.0));
doc->AddFont(tmpf, qRound(doc->toolSettings.defSize / 10.0));
// fo.setPointSize(qRound(currDoc->toolSettings.defSize / 10.0));
currDoc->AddFont(tmpf, qRound(currDoc->toolSettings.defSize / 10.0));
}
}
vg.charStyle().setFont((*ScMW->doc->AllFonts)[tmpf]);
vg.charStyle().setFont((*currDoc->AllFonts)[tmpf]);
vg.charStyle().setFontSize(qRound(pg.attribute("FONTSIZE", "12").toDouble() * 10.0));
vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt()));
vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt());
vg.setDropCapOffset(pg.attribute("DROPDIST", "0").toDouble());
vg.charStyle().setEffects(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()));
vg.charStyle().setFillColor(pg.attribute("FCOLOR", doc->toolSettings.dBrush));
vg.charStyle().setFillColor(pg.attribute("FCOLOR", currDoc->toolSettings.dBrush));
vg.charStyle().setFillShade(pg.attribute("FSHADE", "100").toInt());
vg.charStyle().setStrokeColor(pg.attribute("SCOLOR", doc->toolSettings.dPen));
vg.charStyle().setStrokeColor(pg.attribute("SCOLOR", currDoc->toolSettings.dPen));
vg.charStyle().setStrokeShade(pg.attribute("SSHADE", "100").toInt());
vg.setUseBaselineGrid(static_cast<bool>(pg.attribute("BASE", "0").toInt()));
vg.charStyle().setShadowXOffset(qRound(pg.attribute("TXTSHX", "5").toDouble() * 10));
444,7 → 445,7
}
}
 
bool FileLoader::postLoad()
bool FileLoader::postLoad(ScribusDoc* currDoc)
{
/* for (uint d = 0; d < ScMW->doc->MasterItems.count(); ++d)
{
496,55 → 497,55
return false;
}
}
for (uint d = 0; d < ScMW->doc->MasterItems.count(); ++d)
for (uint d = 0; d < currDoc->MasterItems.count(); ++d)
{
replaceFonts(ScMW->doc->MasterItems.at(d), ScMW->doc->UsedFonts, ReplacedFonts);
replaceFonts(currDoc, currDoc->MasterItems.at(d), currDoc->UsedFonts, ReplacedFonts);
}
for (uint d = 0; d < ScMW->doc->DocItems.count(); ++d)
for (uint d = 0; d < currDoc->DocItems.count(); ++d)
{
replaceFonts(ScMW->doc->DocItems.at(d), ScMW->doc->UsedFonts, ReplacedFonts);
replaceFonts(currDoc, currDoc->DocItems.at(d), currDoc->UsedFonts, ReplacedFonts);
}
for (uint d = 0; d < ScMW->doc->FrameItems.count(); ++d)
for (uint d = 0; d < currDoc->FrameItems.count(); ++d)
{
replaceFonts(ScMW->doc->FrameItems.at(d), ScMW->doc->UsedFonts, ReplacedFonts);
replaceFonts(currDoc, currDoc->FrameItems.at(d), currDoc->UsedFonts, ReplacedFonts);
}
for (uint a = 0; a < ScMW->doc->docParagraphStyles.count(); ++a)
for (uint a = 0; a < currDoc->docParagraphStyles.count(); ++a)
{
if ( ScMW->doc->docParagraphStyles[a].charStyle().font()
&& ScMW->doc->docParagraphStyles[a].charStyle().font() != &Foi::NONE
&& !ScMW->doc->UsedFonts.contains(ScMW->doc->docParagraphStyles[a].charStyle().font()->scName()))
if ( currDoc->docParagraphStyles[a].charStyle().font()
&& currDoc->docParagraphStyles[a].charStyle().font() != &Foi::NONE
&& !currDoc->UsedFonts.contains(currDoc->docParagraphStyles[a].charStyle().font()->scName()))
{
ScMW->doc->docParagraphStyles[a].charStyle().setFont
((*ScMW->doc->AllFonts)[ReplacedFonts[ScMW->doc->docParagraphStyles[a].charStyle().font()->scName()]]);
currDoc->docParagraphStyles[a].charStyle().setFont
((*currDoc->AllFonts)[ReplacedFonts[currDoc->docParagraphStyles[a].charStyle().font()->scName()]]);
}
}
QValueList<QString> tmpList;
tmpList.clear();
for (uint fe = 0; fe < ScMW->doc->PDF_Options.EmbedList.count(); ++fe)
for (uint fe = 0; fe < currDoc->PDF_Options.EmbedList.count(); ++fe)
{
if (ReplacedFonts.contains(ScMW->doc->PDF_Options.EmbedList[fe]))
tmpList.append(ReplacedFonts[ScMW->doc->PDF_Options.EmbedList[fe]]);
if (ReplacedFonts.contains(currDoc->PDF_Options.EmbedList[fe]))
tmpList.append(ReplacedFonts[currDoc->PDF_Options.EmbedList[fe]]);
else
tmpList.append(ScMW->doc->PDF_Options.EmbedList[fe]);
tmpList.append(currDoc->PDF_Options.EmbedList[fe]);
}
ScMW->doc->PDF_Options.EmbedList = tmpList;
currDoc->PDF_Options.EmbedList = tmpList;
tmpList.clear();
for (uint fe = 0; fe < ScMW->doc->PDF_Options.SubsetList.count(); ++fe)
for (uint fe = 0; fe < currDoc->PDF_Options.SubsetList.count(); ++fe)
{
if (ReplacedFonts.contains(ScMW->doc->PDF_Options.SubsetList[fe]))
tmpList.append(ReplacedFonts[ScMW->doc->PDF_Options.SubsetList[fe]]);
if (ReplacedFonts.contains(currDoc->PDF_Options.SubsetList[fe]))
tmpList.append(ReplacedFonts[currDoc->PDF_Options.SubsetList[fe]]);
else
tmpList.append(ScMW->doc->PDF_Options.SubsetList[fe]);
tmpList.append(currDoc->PDF_Options.SubsetList[fe]);
}
ScMW->doc->PDF_Options.SubsetList = tmpList;
currDoc->PDF_Options.SubsetList = tmpList;
QMap<QString,QString>::Iterator itfsu;
for (itfsu = ReplacedFonts.begin(); itfsu != ReplacedFonts.end(); ++itfsu)
{
if (!ScMW->doc->UsedFonts.contains(itfsu.data()))
if (!currDoc->UsedFonts.contains(itfsu.data()))
{
// QFont fo = prefsManager->appPrefs.AvailFonts[itfsu.data()]->Font;
// fo.setPointSize(qRound(ScMW->doc->toolSettings.defSize / 10.0));
ScMW->doc->AddFont(itfsu.data(), qRound(ScMW->doc->toolSettings.defSize / 10.0));
currDoc->AddFont(itfsu.data(), qRound(currDoc->toolSettings.defSize / 10.0));
}
}
if (prefsManager->appPrefs.askBeforeSubstituite)
566,7 → 567,7
{
mess += it.key() + tr(" was replaced by: ")+ it.data() +"\n";
}
QMessageBox::warning(ScMW, CommonStrings::trWarning, mess, 1, 0, 0);
QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, mess, 1, 0, 0);
}
}
 
/branches/Version13x/Scribus/scribus/scimage.h
26,6 → 26,8
#include <qfile.h>
#include <qdir.h>
#include <qstringlist.h>
 
#include "cmsettings.h"
#include "fpointarray.h"
#include "sccolor.h"
extern "C"
129,7 → 131,7
 
// Load an image into this ScImage instance
// TODO: document params, split into smaller functions
bool LoadPicture(const QString & fn, const QString & Prof, int rend, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0);
bool LoadPicture(const QString & fn, const CMSettings& cmSettings, int rend, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0);
 
struct PSDLayer
{
/branches/Version13x/Scribus/scribus/mpalette.h
261,7 → 261,7
void UpdtGui(int);
 
protected:
ScribusMainWindow *m_MainWindow;
ScribusMainWindow *m_ScMW;
QVBoxLayout* MpalLayout;
QVBoxLayout* pageLayout;
/branches/Version13x/Scribus/scribus/hyphenator.cpp
32,7 → 32,7
#include <cstdlib>
#include <string>
#include "scpaths.h"
#include "scribus.h"
#include "scribuscore.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "text/nlsconfig.h"
50,7 → 50,7
{
//FIXME:av pick up language from charstyle
QString pfad = ScPaths::instance().libDir();
if (ScMW->Sprachen.contains(doc->Language))
if (ScCore->primaryMainWindow()->Sprachen.contains(doc->Language))
Language = doc->Language;
else
{
57,7 → 57,7
Language = PrefsManager::instance()->appPrefs.Language;
doc->Language = Language;
}
pfad += "dicts/" + ScMW->Sprachen[Language];
pfad += "dicts/" + ScCore->primaryMainWindow()->Sprachen[Language];
QFile f(pfad);
if (f.open(IO_ReadOnly))
{
86,7 → 86,7
 
void Hyphenator::slotNewDict(QString name)
{
if (!ScMW->Sprachen.contains(name))
if (!ScCore->primaryMainWindow()->Sprachen.contains(name))
return;
char *filename = NULL;
if (hdict != NULL)
94,7 → 94,7
QString pfad = ScPaths::instance().libDir();
Language = name;
doc->Language = name;
pfad += "dicts/" + ScMW->Sprachen[Language];
pfad += "dicts/" + ScCore->primaryMainWindow()->Sprachen[Language];
QFile f(pfad);
if (f.open(IO_ReadOnly))
{
137,7 → 137,7
const int BORDER = 2;
QCString te;
 
uint maxC = it->itemText.length() - 1;
//uint maxC = it->itemText.length() - 1;
QString found = text;
if (static_cast<int>(found.length()) > MinWordLen-1)
{
148,7 → 148,7
return;
if (!hnj_hyphen_hyphenate(hdict, word, strlen(word), buffer))
{
uint i = 0;
//uint i = 0;
buffer[strlen(word)] = '\0';
it->itemText.hyphenateWord(firstC, found.length(), buffer);
}
191,7 → 191,7
int Ccount = 0;
QString found = "";
QString found2 = "";
uint maxC = it->itemText.length() - 1;
//uint maxC = it->itemText.length() - 1;
qApp->setOverrideCursor(QCursor(waitCursor), true);
while ((firstC+Ccount < static_cast<int>(text.length())) && (firstC != -1) &&
(lastC < static_cast<int>(text.length())))
/branches/Version13x/Scribus/scribus/customfdialog.cpp
29,6 → 29,8
#include <qdir.h>
#include <qdom.h>
#include <qtextcodec.h>
 
#include "cmsettings.h"
#include "sccombobox.h"
#include "scribusstructs.h"
#include "scimage.h"
132,7 → 134,9
if (formats.contains(ext))
{
ScImage im;
if (im.LoadPicture(name, "", 0, false, false, ScImage::Thumbnail, 72, &mode))
//No doc to send data anyway, so no doc to get into scimage.
CMSettings cms(0, "");
if (im.LoadPicture(name, cms, 0, false, false, ScImage::Thumbnail, 72, &mode))
{
int ix,iy;
if ((im.imgInfo.exifDataValid) && (!im.imgInfo.exifInfo.thumbnail.isNull()))
/branches/Version13x/Scribus/scribus/gtaction.cpp
37,26 → 37,26
#include "commonstrings.h"
#include "util.h"
 
gtAction::gtAction(bool append)
{
prefsManager=PrefsManager::instance();
//textFrame = ScMW->view->SelItem.at(0);
textFrame = ScMW->doc->m_Selection->itemAt(0);
it = textFrame;
lastParagraphStyle = -1;
inPara = false;
isFirstWrite = true;
lastCharWasLineChange = false;
currentFrameStyle = "";
doAppend = append;
updateParagraphStyles = false;
overridePStyleFont = true;
}
// gtAction::gtAction(bool append)
// {
// prefsManager=PrefsManager::instance();
// textFrame = ScMW->doc->m_Selection->itemAt(0);
// it = textFrame;
// lastParagraphStyle = -1;
// inPara = false;
// isFirstWrite = true;
// lastCharWasLineChange = false;
// currentFrameStyle = "";
// doAppend = append;
// updateParagraphStyles = false;
// overridePStyleFont = true;
// }
 
gtAction::gtAction(bool append, PageItem* pageitem)
{
prefsManager=PrefsManager::instance();
textFrame = pageitem;
m_ScMW=textFrame->doc()->scMW();
it = textFrame;
lastParagraphStyle = -1;
inPara = false;
70,20 → 70,20
 
void gtAction::setProgressInfo()
{
ScMW->mainWindowStatusLabel->setText(QObject::tr("Importing text"));
ScMW->mainWindowProgressBar->reset();
ScMW->mainWindowProgressBar->setTotalSteps(0);
m_ScMW->setStatusBarInfoText(QObject::tr("Importing text"));
m_ScMW->mainWindowProgressBar->reset();
m_ScMW->mainWindowProgressBar->setTotalSteps(0);
}
 
void gtAction::setProgressInfoDone()
{
ScMW->mainWindowStatusLabel->setText("");
ScMW->mainWindowProgressBar->reset();
m_ScMW->setStatusBarInfoText("");
m_ScMW->mainWindowProgressBar->reset();
}
 
void gtAction::setInfo(QString infoText)
{
ScMW->mainWindowStatusLabel->setText(infoText);
m_ScMW->setStatusBarInfoText(infoText);
}
 
void gtAction::clearFrame()
90,7 → 90,7
{
textFrame->itemText.clear();
textFrame->CPos = 0;
ScMW->doc->updateFrameItems();
textFrame->doc()->updateFrameItems();
}
 
void gtAction::write(const QString& text, gtStyle *style)
111,7 → 111,7
}
it->itemText.clear();
it->CPos = 0;
ScMW->doc->updateFrameItems();
textFrame->doc()->updateFrameItems();
}
}
int paragraphStyle = -1;
133,12 → 133,12
 
 
if (paragraphStyle == -1)
paragraphStyle = ::findParagraphStyle(ScMW->doc, ScMW->doc->currentStyle);
paragraphStyle = ::findParagraphStyle(textFrame->doc(), textFrame->doc()->currentStyle);
 
gtFont* font = style->getFont();
QString fontName = validateFont(font)->scName();
gtFont font2(*font);
font2.setName(ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().font()->scName());
font2.setName(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().font()->scName());
QString fontName2 = validateFont(&font2)->scName();
CharStyle lastStyle;
int lastStyleStart = 0;
152,20 → 152,20
ch = QChar(13);
if ((inPara) && (!overridePStyleFont))
{
if (ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().font() == &Foi::NONE)
newStyle.setFont((*ScMW->doc->AllFonts)[fontName2]);
if (textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().font() == &Foi::NONE)
newStyle.setFont((*textFrame->doc()->AllFonts)[fontName2]);
else
newStyle.setFont(ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().font());
newStyle.setFontSize(ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().fontSize());
newStyle.setFillColor(ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().fillColor());
newStyle.setFillShade(ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().fillShade());
newStyle.setStrokeColor(ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().strokeColor());
newStyle.setStrokeShade(ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().strokeShade());
newStyle.setEffects(ScMW->doc->docParagraphStyles[paragraphStyle].charStyle().effects());
newStyle.setFont(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().font());
newStyle.setFontSize(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().fontSize());
newStyle.setFillColor(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().fillColor());
newStyle.setFillShade(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().fillShade());
newStyle.setStrokeColor(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().strokeColor());
newStyle.setStrokeShade(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().strokeShade());
newStyle.setEffects(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().effects());
}
else
{
newStyle.setFont((*ScMW->doc->AllFonts)[fontName]);
newStyle.setFont((*textFrame->doc()->AllFonts)[fontName]);
newStyle.setFontSize(font->getSize());
newStyle.setFillColor(parseColor(font->getColor()));
newStyle.setFillShade(font->getShade());
192,11 → 192,11
lastStyleStart = pos;
}
if (ch == SpecialChars::PARSEP) {
it->itemText.applyStyle(pos, ScMW->doc->docParagraphStyles[paragraphStyle]);
it->itemText.applyStyle(pos, textFrame->doc()->docParagraphStyles[paragraphStyle]);
}
}
it->itemText.applyCharStyle(lastStyleStart, it->itemText.length()-lastStyleStart, lastStyle);
it->itemText.applyStyle(it->itemText.length()-1, ScMW->doc->docParagraphStyles[paragraphStyle]);
it->itemText.applyStyle(it->itemText.length()-1, textFrame->doc()->docParagraphStyles[paragraphStyle]);
lastCharWasLineChange = text.right(1) == "\n";
inPara = style->target() == "paragraph";
213,9 → 213,9
int gtAction::findParagraphStyle(const QString& name)
{
int pstyleIndex = -1;
for (uint i = 0; i < ScMW->doc->docParagraphStyles.size(); ++i)
for (uint i = 0; i < textFrame->doc()->docParagraphStyles.size(); ++i)
{
if (ScMW->doc->docParagraphStyles[i].name() == name)
if (textFrame->doc()->docParagraphStyles[i].name() == name)
{
pstyleIndex = i;
break;
230,7 → 230,7
if (pstyleIndex == -1)
{
createParagraphStyle(pstyle);
pstyleIndex = ScMW->doc->docParagraphStyles.size() - 1;
pstyleIndex = textFrame->doc()->docParagraphStyles.size() - 1;
}
else if (updateParagraphStyles)
{
324,7 → 324,7
 
void gtAction::createParagraphStyle(gtParagraphStyle* pstyle)
{
ScribusDoc* currDoc=textFrame->document();
ScribusDoc* currDoc=textFrame->doc();
if (currDoc->docParagraphStyles.size() > 5)
{
for (uint i = 5; i < currDoc->docParagraphStyles.size(); ++i)
373,12 → 373,12
vg.charStyle().setScaleV(1000);
vg.charStyle().setBaselineOffset(0);
vg.charStyle().setTracking(0);
vg.charStyle().setUnderlineOffset(ScMW->doc->typographicSettings.valueUnderlinePos);
vg.charStyle().setUnderlineWidth(ScMW->doc->typographicSettings.valueUnderlineWidth);
vg.charStyle().setStrikethruOffset(ScMW->doc->typographicSettings.valueStrikeThruPos);
vg.charStyle().setStrikethruWidth(ScMW->doc->typographicSettings.valueStrikeThruPos);
textFrame->document()->docParagraphStyles.append(vg);
ScMW->propertiesPalette->Spal->updateFormatList();
vg.charStyle().setUnderlineOffset(textFrame->doc()->typographicSettings.valueUnderlinePos);
vg.charStyle().setUnderlineWidth(textFrame->doc()->typographicSettings.valueUnderlineWidth);
vg.charStyle().setStrikethruOffset(textFrame->doc()->typographicSettings.valueStrikeThruPos);
vg.charStyle().setStrikethruWidth(textFrame->doc()->typographicSettings.valueStrikeThruPos);
textFrame->doc()->docParagraphStyles.append(vg);
m_ScMW->propertiesPalette->Spal->updateFormatList();
}
 
void gtAction::removeParagraphStyle(const QString& name)
390,8 → 390,8
 
void gtAction::removeParagraphStyle(int index)
{
QValueList<ParagraphStyle>::iterator it = ScMW->doc->docParagraphStyles.at(index);
ScMW->doc->docParagraphStyles.remove(it);
QValueList<ParagraphStyle>::iterator it = textFrame->doc()->docParagraphStyles.at(index);
textFrame->doc()->docParagraphStyles.remove(it);
}
 
void gtAction::updateParagraphStyle(const QString&, gtParagraphStyle* pstyle)
443,11 → 443,11
vg.charStyle().setScaleV(1000);
vg.charStyle().setBaselineOffset(0);
vg.charStyle().setTracking(0);
vg.charStyle().setUnderlineOffset(ScMW->doc->typographicSettings.valueUnderlinePos);
vg.charStyle().setUnderlineWidth(ScMW->doc->typographicSettings.valueUnderlineWidth);
vg.charStyle().setStrikethruOffset(ScMW->doc->typographicSettings.valueStrikeThruPos);
vg.charStyle().setStrikethruWidth(ScMW->doc->typographicSettings.valueStrikeThruPos);
ScMW->doc->docParagraphStyles[pstyleIndex] = vg;
vg.charStyle().setUnderlineOffset(textFrame->doc()->typographicSettings.valueUnderlinePos);
vg.charStyle().setUnderlineWidth(textFrame->doc()->typographicSettings.valueUnderlineWidth);
vg.charStyle().setStrikethruOffset(textFrame->doc()->typographicSettings.valueStrikeThruPos);
vg.charStyle().setStrikethruWidth(textFrame->doc()->typographicSettings.valueStrikeThruPos);
textFrame->doc()->docParagraphStyles[pstyleIndex] = vg;
}
 
Foi* gtAction::validateFont(gtFont* font)
503,7 → 503,7
{
if (!prefsManager->appPrefs.GFontSub.contains(font->getName()))
{
MissingFont *dia = new MissingFont(0, useFont, ScMW->doc);
MissingFont *dia = new MissingFont(0, useFont, textFrame->doc());
dia->exec();
useFont = dia->getReplacementFont();
prefsManager->appPrefs.GFontSub[font->getName()] = useFont;
515,8 → 515,8
}
}
 
if(!ScMW->doc->UsedFonts.contains(useFont))
ScMW->doc->AddFont(useFont);
if(!textFrame->doc()->UsedFonts.contains(useFont))
textFrame->doc()->AddFont(useFont);
return prefsManager->appPrefs.AvailFonts[useFont];
}
 
537,7 → 537,7
 
double gtAction::getLineSpacing(int fontSize)
{
return ((fontSize / 10.0) * static_cast<double>(ScMW->doc->typographicSettings.autoLineSpacing) / 100) + (fontSize / 10.0);
return ((fontSize / 10.0) * static_cast<double>(textFrame->doc()->typographicSettings.autoLineSpacing) / 100) + (fontSize / 10.0);
}
 
double gtAction::getFrameWidth()
576,7 → 576,7
return ret; // don't want None to become Black or any color
bool found = false;
ColorList::Iterator it;
for (it = ScMW->doc->PageColors.begin(); it != ScMW->doc->PageColors.end(); ++it)
for (it = textFrame->doc()->PageColors.begin(); it != textFrame->doc()->PageColors.end(); ++it)
{
if (it.key() == s)
{
620,9 → 620,9
c = parseColorN( rgbColor );
}
found = false;
for (it = ScMW->doc->PageColors.begin(); it != ScMW->doc->PageColors.end(); ++it)
for (it = textFrame->doc()->PageColors.begin(); it != textFrame->doc()->PageColors.end(); ++it)
{
if (c == ScMW->doc->PageColors[it.key()].getRGBColor())
if (c == textFrame->doc()->PageColors[it.key()].getRGBColor())
{
ret = it.key();
found = true;
632,8 → 632,8
{
ScColor tmp;
tmp.fromQColor(c);
ScMW->doc->PageColors.insert("FromGetText"+c.name(), tmp);
ScMW->propertiesPalette->updateColorList();
textFrame->doc()->PageColors.insert("FromGetText"+c.name(), tmp);
m_ScMW->propertiesPalette->updateColorList();
ret = "FromGetText"+c.name();
}
}
649,10 → 649,10
 
void gtAction::finalize()
{
if (ScMW->doc->docHyphenator->AutoCheck)
ScMW->doc->docHyphenator->slotHyphenate(textFrame);
ScMW->view->DrawNew();
ScMW->slotDocCh();
if (textFrame->doc()->docHyphenator->AutoCheck)
textFrame->doc()->docHyphenator->slotHyphenate(textFrame);
textFrame->doc()->view()->DrawNew();
textFrame->doc()->changed();
}
 
gtAction::~gtAction()
/branches/Version13x/Scribus/scribus/mpalette.cpp
103,7 → 103,7
 
Mpalette::Mpalette( QWidget* parent) : ScrPaletteBase( parent, "PropertiesPalette", false, 0)
{
m_MainWindow=0;
m_ScMW=0;
doc=0;
HaveDoc = false;
HaveItem = false;
903,27 → 903,27
 
void Mpalette::setMainWindow(ScribusMainWindow* mw)
{
m_MainWindow=mw;
m_ScMW=mw;
QPoint p1 = mapToGlobal(pos());
QPoint p2 = m_MainWindow->mapFromGlobal(p1);
reparent(m_MainWindow, this->getWFlags(), p2);
QPoint p2 = m_ScMW->mapFromGlobal(p1);
reparent(m_ScMW, this->getWFlags(), p2);
connect(this, SIGNAL(DocChanged()), m_MainWindow, SLOT(slotDocCh()));
connect(this, SIGNAL(NewParStyle(int)), m_MainWindow, SLOT(setNewParStyle(int)));
connect(this, SIGNAL(NewAlignment(int)), m_MainWindow, SLOT(setNewAlignment(int)));
connect(this, SIGNAL(NewEffects(int)), m_MainWindow, SLOT(setItemHoch(int)));
connect(this, SIGNAL(ShapeEdit()), m_MainWindow, SLOT(ToggleFrameEdit()));
connect(this, SIGNAL(NewFont(const QString&)), m_MainWindow, SLOT(SetNewFont(const QString&)));
connect(this, SIGNAL(UpdtGui(int)), m_MainWindow, SLOT(HaveNewSel(int)));
connect(this->Cpal, SIGNAL(QueryItem()), m_MainWindow, SLOT(GetBrushPen()));
connect(this->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), m_MainWindow, SLOT(updtGradFill()));
connect(this->Cpal, SIGNAL(gradientChanged()), m_MainWindow, SLOT(updtGradFill()));
connect(this, SIGNAL(DocChanged()), m_ScMW, SLOT(slotDocCh()));
connect(this, SIGNAL(NewParStyle(int)), m_ScMW, SLOT(setNewParStyle(int)));
connect(this, SIGNAL(NewAlignment(int)), m_ScMW, SLOT(setNewAlignment(int)));
connect(this, SIGNAL(NewEffects(int)), m_ScMW, SLOT(setItemHoch(int)));
connect(this, SIGNAL(ShapeEdit()), m_ScMW, SLOT(ToggleFrameEdit()));
connect(this, SIGNAL(NewFont(const QString&)), m_ScMW, SLOT(SetNewFont(const QString&)));
connect(this, SIGNAL(UpdtGui(int)), m_ScMW, SLOT(HaveNewSel(int)));
connect(this->Cpal, SIGNAL(QueryItem()), m_ScMW, SLOT(GetBrushPen()));
connect(this->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
}
 
void Mpalette::SelTab(int t)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem) && (t == 5))
{
1015,7 → 1015,7
 
void Mpalette::setCurrentItem(PageItem *i)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
//CB We shouldnt really need to process this if our item is the same one
//maybe we do if the item has been changed by scripter.. but that should probably
1049,7 → 1049,7
connect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
connect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
*/
langCombo->setCurrentText(m_MainWindow->LangTransl[i->document()->Language]);
langCombo->setCurrentText(m_ScMW->LangTransl[i->doc()->Language]);
if (TabStack->currentIndex() == 5)
Cpal->setActGradient(CurItem->GrType);
updateColorSpecialGradient();
1216,7 → 1216,7
 
void Mpalette::setTextFlowMode(PageItem::TextFlowMode mode)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if (mode == PageItem::TextFlowDisabled)
textFlowDisabled->setOn(true);
1230,7 → 1230,7
 
void Mpalette::SetCurItem(PageItem *i)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
//CB We shouldnt really need to process this if our item is the same one
//maybe we do if the item has been changed by scripter.. but that should probably
1305,7 → 1305,7
connect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
connect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
*/
langCombo->setCurrentText(m_MainWindow->LangTransl[i->document()->Language]);
langCombo->setCurrentText(m_ScMW->LangTransl[i->doc()->Language]);
bool setter;
if (i->NamedLStyle.isEmpty())
{
1429,7 → 1429,7
 
void Mpalette::NewSel(int nr)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
int visID;
PageItem *i=0;
1438,17 → 1438,17
{
RoVal = 0;
double gx, gy, gh, gw;
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
if (TopLeft->isChecked())
m_MainWindow->view->RCenter = FPoint(gx, gy);
m_ScMW->view->RCenter = FPoint(gx, gy);
if (TopRight->isChecked())
m_MainWindow->view->RCenter = FPoint(gx + gw, gy);
m_ScMW->view->RCenter = FPoint(gx + gw, gy);
if (Center->isChecked())
m_MainWindow->view->RCenter = FPoint(gx + gw / 2.0, gy + gh / 2.0);
m_ScMW->view->RCenter = FPoint(gx + gw / 2.0, gy + gh / 2.0);
if (BottomLeft->isChecked())
m_MainWindow->view->RCenter = FPoint(gx, gy + gh);
m_ScMW->view->RCenter = FPoint(gx, gy + gh);
if (BottomRight->isChecked())
m_MainWindow->view->RCenter = FPoint(gx + gw, gy + gh);
m_ScMW->view->RCenter = FPoint(gx + gw, gy + gh);
xposLabel->setText( tr( "&X-Pos:" ) );
widthLabel->setText( tr( "&Width:" ) );
yposLabel->setText( tr( "&Y-Pos:" ) );
1737,7 → 1737,7
 
void Mpalette::setXY(double x, double y)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
disconnect(Xpos, SIGNAL(valueChanged(int)), this, SLOT(NewX()));
disconnect(Ypos, SIGNAL(valueChanged(int)), this, SLOT(NewY()));
1749,7 → 1749,7
{
if (doc->m_Selection->isMultipleSelection())
{
m_MainWindow->view->getGroupRect(&dummy1, &dummy2, &b, &h);
m_ScMW->view->getGroupRect(&dummy1, &dummy2, &b, &h);
r = 0.0;
}
else
1801,7 → 1801,7
 
void Mpalette::setBH(double x, double y)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
1827,7 → 1827,7
 
void Mpalette::setR(double r)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
double rr = r;
1840,7 → 1840,7
 
void Mpalette::setRR(double r)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
1850,7 → 1850,7
 
void Mpalette::setCols(int r, double g)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
1890,7 → 1890,7
 
void Mpalette::setLsp(double r)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
1912,7 → 1912,7
 
void Mpalette::setDvals(double left, double top, double bottom, double right)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
1925,7 → 1925,7
 
void Mpalette::setFontFace(QString newFont)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
1936,7 → 1936,7
 
void Mpalette::setSize(int s)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
1946,7 → 1946,7
 
void Mpalette::setExtra(int e)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
1956,7 → 1956,7
 
void Mpalette::ChangeScaling()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if (FreeScale == sender())
{
1993,7 → 1993,7
 
void Mpalette::setLvalue(double scx, double scy, double x, double y)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
2020,7 → 2020,7
 
void Mpalette::setSvalue(double s)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
2030,7 → 2030,7
 
void Mpalette::setLIvalue(Qt::PenStyle p, Qt::PenCapStyle pc, Qt::PenJoinStyle pj)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
2090,7 → 2090,7
 
void Mpalette::setStil(int s)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
StrokeIcon->setEnabled(false);
TxStroke->setEnabled(false);
2106,7 → 2106,7
 
void Mpalette::setAli(int e)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
2124,7 → 2124,7
 
void Mpalette::setParStyle(int e)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
2135,7 → 2135,7
 
void Mpalette::setTScaleV(int e)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
2165,7 → 2165,7
 
void Mpalette::setTScale(int e)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
2175,7 → 2175,7
 
void Mpalette::setTBase(int e)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
bool tmp = HaveItem;
HaveItem = false;
2195,7 → 2195,7
 
void Mpalette::NewX()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2215,7 → 2215,7
}
if (doc->m_Selection->isMultipleSelection())
{
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
if ((TopLeft->isChecked()) || (BottomLeft->isChecked()))
base = gx;
if (Center->isChecked())
2222,11 → 2222,11
base = gx + gw / 2.0;
if ((TopRight->isChecked()) || (BottomRight->isChecked()))
base = gx + gw;
m_MainWindow->view->moveGroup(x - base, 0, true);
if (!_userActionOn && m_MainWindow->view->groupTransactionStarted())
m_ScMW->view->moveGroup(x - base, 0, true);
if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
{
UndoManager::instance()->commit();
m_MainWindow->view->setGroupTransactionStarted(false);
m_ScMW->view->setGroupTransactionStarted(false);
}
}
else
2235,9 → 2235,9
{
double r = atan2(h-y,w-x)*(180.0/M_PI);
w = sqrt(pow(w-x,2)+pow(h-y,2));
m_MainWindow->view->MoveItem(x - CurItem->xPos(), 0, CurItem, true);
m_MainWindow->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_MainWindow->view->RotateItem(r, CurItem->ItemNr);
m_ScMW->view->MoveItem(x - CurItem->xPos(), 0, CurItem, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->RotateItem(r, CurItem->ItemNr);
}
else
{
2253,10 → 2253,10
base = ma.m11() * CurItem->width() + ma.m21() * CurItem->height() + ma.dx();
if (BottomLeft->isChecked())
base = ma.m11() * 0.0 + ma.m21() * CurItem->height() + ma.dx();
m_MainWindow->view->MoveItem(x - base, 0, CurItem, true);
m_ScMW->view->MoveItem(x - base, 0, CurItem, true);
}
}
m_MainWindow->view->updateContents();
m_ScMW->view->updateContents();
emit DocChanged();
}
}
2263,7 → 2263,7
 
void Mpalette::NewY()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2283,7 → 2283,7
}
if (doc->m_Selection->isMultipleSelection())
{
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
if ((TopLeft->isChecked()) || (TopRight->isChecked()))
base = gy;
if (Center->isChecked())
2290,11 → 2290,11
base = gy + gh / 2.0;
if ((BottomLeft->isChecked()) || (BottomRight->isChecked()))
base = gy + gh;
m_MainWindow->view->moveGroup(0, y - base, true);
if (!_userActionOn && m_MainWindow->view->groupTransactionStarted())
m_ScMW->view->moveGroup(0, y - base, true);
if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
{
UndoManager::instance()->commit();
m_MainWindow->view->setGroupTransactionStarted(false);
m_ScMW->view->setGroupTransactionStarted(false);
}
}
else
2303,9 → 2303,9
{
double r = atan2(h-y,w-x)*(180.0/M_PI);
w = sqrt(pow(w-x,2)+pow(h-y,2));
m_MainWindow->view->MoveItem(0, y - CurItem->yPos(), CurItem, true);
m_MainWindow->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_MainWindow->view->RotateItem(r, CurItem->ItemNr);
m_ScMW->view->MoveItem(0, y - CurItem->yPos(), CurItem, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->RotateItem(r, CurItem->ItemNr);
}
else
{
2321,10 → 2321,10
base = ma.m22() * CurItem->height() + ma.m12() * CurItem->width() + ma.dy();
if (BottomLeft->isChecked())
base = ma.m22() * CurItem->height() + ma.m12() * 0.0 + ma.dy();
m_MainWindow->view->MoveItem(0, y - base, CurItem, true);
m_ScMW->view->MoveItem(0, y - base, CurItem, true);
}
}
m_MainWindow->view->updateContents();
m_ScMW->view->updateContents();
emit DocChanged();
}
}
2331,7 → 2331,7
 
void Mpalette::NewW()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2342,24 → 2342,24
h = Height->value() / Umrech;
if (doc->m_Selection->isMultipleSelection())
{
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
if (keepFrameWHRatioButton->isOn())
{
m_MainWindow->view->frameResizeHandle = 1;
m_MainWindow->view->scaleGroup(w / gw, w / gw);
m_ScMW->view->frameResizeHandle = 1;
m_ScMW->view->scaleGroup(w / gw, w / gw);
setBH(w, (w / gw) * gh);
}
else
{
m_MainWindow->view->frameResizeHandle = 6;
m_MainWindow->view->scaleGroup(w / gw, 1.0);
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->frameResizeHandle = 6;
m_ScMW->view->scaleGroup(w / gw, 1.0);
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
setBH(gw, gh);
}
if (!_userActionOn && m_MainWindow->view->groupTransactionStarted())
if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
{
UndoManager::instance()->commit();
m_MainWindow->view->setGroupTransactionStarted(false);
m_ScMW->view->setGroupTransactionStarted(false);
}
}
else
2371,10 → 2371,10
if (LMode)
{
double r = atan2(h-y,w-x)*(180.0/M_PI);
m_MainWindow->view->RotateItem(r, CurItem->ItemNr);
m_ScMW->view->RotateItem(r, CurItem->ItemNr);
w = sqrt(pow(w-x,2)+pow(h-y,2));
}
m_MainWindow->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
}
else
{
2395,19 → 2395,19
bb2 = bb;
while (bb2->RightLink != 0)
{
m_MainWindow->view->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
m_ScMW->view->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
bb2 = bb2->RightLink;
}
m_MainWindow->view->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
m_ScMW->view->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
bb = bb->BottomLink;
}
bb2 = bb;
while (bb2->RightLink != 0)
{
m_MainWindow->view->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
m_ScMW->view->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
bb2 = bb2->RightLink;
}
m_MainWindow->view->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
m_ScMW->view->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
doc->RotMode = rmo;
if (keepFrameWHRatioButton->isOn())
{
2422,21 → 2422,21
if (keepFrameWHRatioButton->isOn())
{
setBH(w, (w / CurItem->width()) * CurItem->height());
m_MainWindow->view->SizeItem(w, (w / CurItem->width()) * CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->SizeItem(w, (w / CurItem->width()) * CurItem->height(), CurItem->ItemNr, true);
}
else
m_MainWindow->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
}
}
}
emit DocChanged();
m_MainWindow->view->updateContents();
m_ScMW->view->updateContents();
}
}
 
void Mpalette::NewH()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2447,24 → 2447,24
h = Height->value() / Umrech;
if (doc->m_Selection->isMultipleSelection())
{
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
if (keepFrameWHRatioButton->isOn())
{
m_MainWindow->view->frameResizeHandle = 1;
m_MainWindow->view->scaleGroup(h / gh, h / gh);
m_ScMW->view->frameResizeHandle = 1;
m_ScMW->view->scaleGroup(h / gh, h / gh);
setBH((h / gh) * gw, h);
}
else
{
m_MainWindow->view->frameResizeHandle = 5;
m_MainWindow->view->scaleGroup(1.0, h / gh);
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->frameResizeHandle = 5;
m_ScMW->view->scaleGroup(1.0, h / gh);
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
setBH(gw, gh);
}
if (!_userActionOn && m_MainWindow->view->groupTransactionStarted())
if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
{
UndoManager::instance()->commit();
m_MainWindow->view->setGroupTransactionStarted(false);
m_ScMW->view->setGroupTransactionStarted(false);
}
}
else
2476,10 → 2476,10
if (LMode)
{
double r = atan2(h-y,w-x)*(180.0/M_PI);
m_MainWindow->view->RotateItem(r, CurItem->ItemNr);
m_ScMW->view->RotateItem(r, CurItem->ItemNr);
w = sqrt(pow(w-x,2)+pow(h-y,2));
}
m_MainWindow->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
}
else
{
2500,19 → 2500,19
bb2 = bb;
while (bb2->BottomLink != 0)
{
m_MainWindow->view->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
m_ScMW->view->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
bb2 = bb2->BottomLink;
}
m_MainWindow->view->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
m_ScMW->view->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
bb = bb->RightLink;
}
bb2 = bb;
while (bb2->BottomLink != 0)
{
m_MainWindow->view->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
m_ScMW->view->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
bb2 = bb2->BottomLink;
}
m_MainWindow->view->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
m_ScMW->view->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
doc->RotMode = rmo;
if (keepFrameWHRatioButton->isOn())
{
2527,21 → 2527,21
if (keepFrameWHRatioButton->isOn())
{
setBH((h / CurItem->height()) * CurItem->width(), h);
m_MainWindow->view->SizeItem((h / CurItem->height()) * CurItem->width(), h, CurItem->ItemNr, true);
m_ScMW->view->SizeItem((h / CurItem->height()) * CurItem->width(), h, CurItem->ItemNr, true);
}
else
m_MainWindow->view->SizeItem(CurItem->width(), h, CurItem->ItemNr, true);
m_ScMW->view->SizeItem(CurItem->width(), h, CurItem->ItemNr, true);
}
}
}
emit DocChanged();
m_MainWindow->view->updateContents();
m_ScMW->view->updateContents();
}
}
 
void Mpalette::NewR()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
double gx, gy, gh, gw;
if ((HaveDoc) && (HaveItem))
2548,19 → 2548,19
{
if (doc->m_Selection->isMultipleSelection())
{
m_MainWindow->view->RotateGroup((Rot->value() - RoVal)*(-1));
if (!_userActionOn && m_MainWindow->view->groupTransactionStarted())
m_ScMW->view->RotateGroup((Rot->value() - RoVal)*(-1));
if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
{
UndoManager::instance()->commit();
m_MainWindow->view->setGroupTransactionStarted(false);
m_ScMW->view->setGroupTransactionStarted(false);
}
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
setXY(gx, gy);
}
else
m_MainWindow->view->RotateItem(Rot->value()*(-1), CurItem->ItemNr);
m_ScMW->view->RotateItem(Rot->value()*(-1), CurItem->ItemNr);
emit DocChanged();
m_MainWindow->view->updateContents();
m_ScMW->view->updateContents();
RoVal = Rot->value();
}
}
2567,12 → 2567,12
 
void Mpalette::NewRR()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->setCornerRadius(RoundRect->value() / Umrech);
m_MainWindow->view->SetFrameRounded();
m_ScMW->view->SetFrameRounded();
emit DocChanged();
}
}
2579,7 → 2579,7
 
void Mpalette::NewLsp()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2603,13 → 2603,13
 
void Mpalette::NewCols()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->Cols = DCol->value();
setCols(CurItem->Cols, CurItem->ColGap);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
2616,7 → 2616,7
 
void Mpalette::NewGap()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2633,7 → 2633,7
double newGap = QMAX(((CurItem->width() - CurItem->textToFrameDistLeft() - CurItem->textToFrameDistRight() - lineCorr) - (newWidth * CurItem->Cols)) / (CurItem->Cols - 1), 0);
CurItem->ColGap = newGap;
}
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
2640,7 → 2640,7
 
void Mpalette::NewSize()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2651,7 → 2651,7
 
void Mpalette::NewExtra()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2667,7 → 2667,7
#ifndef NLS_PROTO
CurItem->itemText.item(CurItem->CPos)->setTracking(qRound(Extra->value() * 10.0));
#endif
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
2676,7 → 2676,7
 
void Mpalette::NewLocalXY()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2686,7 → 2686,7
 
void Mpalette::NewLocalSC()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2706,7 → 2706,7
 
void Mpalette::NewLocalDpi()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2727,7 → 2727,7
 
void Mpalette::NewLS()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2738,12 → 2738,12
 
void Mpalette::setStartArrow(int id)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->setStartArrowIndex(id);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
2750,12 → 2750,12
 
void Mpalette::setEndArrow(int id)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->setEndArrowIndex(id);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
2762,7 → 2762,7
 
void Mpalette::NewLSty()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
PenStyle c = SolidLine;
switch (LStyle->currentItem())
2792,7 → 2792,7
 
void Mpalette::NewLMode()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if (LineMode->currentItem() == 0)
{
2822,7 → 2822,7
 
void Mpalette::NewLJoin()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
PenJoinStyle c = MiterJoin;
switch (LJoinStyle->currentItem())
2846,7 → 2846,7
 
void Mpalette::NewLEnd()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
PenCapStyle c = FlatCap;
switch (LEndStyle->currentItem())
2870,7 → 2870,7
 
void Mpalette::ToggleKette()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
disconnect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
disconnect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
2910,7 → 2910,7
 
void Mpalette::ToggleKetteD()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
disconnect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
disconnect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
2950,7 → 2950,7
 
void Mpalette::NewAli(int a)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
2961,7 → 2961,7
 
void Mpalette::setTypeStyle(int s)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
emit NewEffects(s);
}
2981,7 → 2981,7
 
void Mpalette::setShadowOffs(int x, int y)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
disconnect(SeStyle->ShadowVal->Xoffset, SIGNAL(valueChanged(int)), this, SLOT(newShadowOffs()));
disconnect(SeStyle->ShadowVal->Yoffset, SIGNAL(valueChanged(int)), this, SLOT(newShadowOffs()));
3006,7 → 3006,7
 
void Mpalette::setUnderline(int p, int w)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
disconnect(SeStyle->UnderlineVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(newUnderline()));
disconnect(SeStyle->UnderlineVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newUnderline()));
3031,7 → 3031,7
 
void Mpalette::setStrike(int p, int w)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
disconnect(SeStyle->StrikeVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(newStrike()));
disconnect(SeStyle->StrikeVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newStrike()));
3043,7 → 3043,7
 
void Mpalette::setOutlineW(int x)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
disconnect(SeStyle->OutlineVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newOutlineW()));
SeStyle->OutlineVal->LWidth->setValue(x / 10.0);
3063,47 → 3063,47
 
void Mpalette::DoLower()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
m_MainWindow->view->LowerItem();
m_ScMW->view->LowerItem();
}
}
 
void Mpalette::DoRaise()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
m_MainWindow->view->RaiseItem();
m_ScMW->view->RaiseItem();
}
}
 
void Mpalette::DoFront()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
m_MainWindow->view->ToFront();
m_ScMW->view->ToFront();
}
}
 
void Mpalette::DoBack()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
m_MainWindow->view->ToBack();
m_ScMW->view->ToBack();
}
}
 
void Mpalette::NewRotMode(int m)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
double inX, inY, gx, gy, gh, gw;
inX = 0;
3113,35 → 3113,35
HaveItem = false;
if (doc->m_Selection->isMultipleSelection())
{
m_MainWindow->view->setGroupRect();
m_MainWindow->view->getGroupRect(&gx, &gy, &gw, &gh);
m_ScMW->view->setGroupRect();
m_ScMW->view->getGroupRect(&gx, &gy, &gw, &gh);
if (m == 0)
{
m_MainWindow->view->RCenter = FPoint(gx, gy);
m_ScMW->view->RCenter = FPoint(gx, gy);
inX = gx;
inY = gy;
}
if (m == 1)
{
m_MainWindow->view->RCenter = FPoint(gx+gw, gy);
m_ScMW->view->RCenter = FPoint(gx+gw, gy);
inX = gx+gw;
inY = gy;
}
if (m == 2)
{
m_MainWindow->view->RCenter = FPoint(gx + gw / 2.0, gy + gh / 2.0);
m_ScMW->view->RCenter = FPoint(gx + gw / 2.0, gy + gh / 2.0);
inX = gx + gw / 2.0;
inY = gy + gh / 2.0;
}
if (m == 3)
{
m_MainWindow->view->RCenter = FPoint(gx, gy+gh);
m_ScMW->view->RCenter = FPoint(gx, gy+gh);
inX = gx;
inY = gy+gh;
}
if (m == 4)
{
m_MainWindow->view->RCenter = FPoint(gx+gw, gy+gh);
m_ScMW->view->RCenter = FPoint(gx+gw, gy+gh);
inX = gx+gw;
inY = gy+gh;
}
3181,7 → 3181,7
void Mpalette::DoFlow(int /*id*/)
{
PageItem::TextFlowMode mode = PageItem::TextFlowDisabled;
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
3194,7 → 3194,7
if (textFlowUsesContourLine->isOn())
mode = PageItem::TextFlowUsesContourLine;
CurItem->setTextFlowMode(mode);
m_MainWindow->view->DrawNew();
m_ScMW->view->DrawNew();
emit DocChanged();
}
}
3201,7 → 3201,7
 
void Mpalette::MakeIrre(int f, int c, double *vals)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
3223,8 → 3223,8
CurItem->FrameType = f+2;
break;
}
m_MainWindow->SCustom->setPixmap(m_MainWindow->SCustom->getIconPixmap(f));
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->SCustom->setPixmap(m_ScMW->SCustom->getIconPixmap(f));
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame))
return;
3236,7 → 3236,7
 
void Mpalette::EditSh()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
3255,13 → 3255,13
 
void Mpalette::NewTDist()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->setTextToFrameDist(DLeft->value() / Umrech, DRight->value() / Umrech, DTop->value() / Umrech, DBottom->value() / Umrech);
setCols(CurItem->Cols, CurItem->ColGap);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3268,7 → 3268,7
 
void Mpalette::NewSpGradient(double x1, double y1, double x2, double y2)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
3276,7 → 3276,7
CurItem->GrStartY = y1 / Umrech;
CurItem->GrEndX = x2 / Umrech;
CurItem->GrEndY = y2 / Umrech;
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3283,21 → 3283,21
 
void Mpalette::toggleGradientEdit()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
if (Cpal->gradEditButton->isOn())
m_MainWindow->setAppMode(modeEditGradientVectors);
m_ScMW->setAppMode(modeEditGradientVectors);
else
m_MainWindow->setAppMode(modeNormal);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->setAppMode(modeNormal);
m_ScMW->view->RefreshItem(CurItem);
}
}
 
void Mpalette::NewTFont(QString c)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
emit NewFont(c);
3305,7 → 3305,7
 
void Mpalette::DoRevert()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
3312,7 → 3312,7
bool setter=Revert->isOn();
CurItem->setImageFlippedH(setter);
CurItem->setReversed(setter);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3319,7 → 3319,7
 
void Mpalette::SetLineFormats(ScribusDoc *dd)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
disconnect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
StyledLine->clear();
3369,7 → 3369,7
 
void Mpalette::SetSTline(QListBoxItem *c)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if (c == NULL)
return;
3382,7 → 3382,7
LSize->setEnabled(setter);
LJoinStyle->setEnabled(setter);
LEndStyle->setEnabled(setter);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
 
3395,7 → 3395,7
 
void Mpalette::updateCList()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if (!HaveDoc)
return;
3416,7 → 3416,7
 
void Mpalette::updateCmsList()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if (HaveDoc)
{
3483,7 → 3483,7
 
void Mpalette::ChProf(const QString& prn)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
/* PFJ - 29.02.04 - Moved bool into if scope */
if ((HaveDoc) && (HaveItem))
3493,25 → 3493,25
bool EmbedP = prn.startsWith("Embedded") ? true : false;
CurItem->UseEmbedded = EmbedP;
doc->LoadPict(CurItem->Pfile, CurItem->ItemNr, true);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
}
}
 
void Mpalette::ChIntent()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->IRender = MonitorI->currentItem();
doc->LoadPict(CurItem->Pfile, CurItem->ItemNr, true);
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
}
}
 
void Mpalette::ShowCMS()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if (HaveItem)
updateCmsList();
3546,7 → 3546,7
 
void Mpalette::setActShade()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
int b;
if (PM1 == sender())
3566,7 → 3566,7
 
void Mpalette::setActFarben(QString p, QString b, int shp, int shb)
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
ColorList::Iterator it;
int c = 0;
3599,30 → 3599,30
 
void Mpalette::handleLock()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
m_MainWindow->scrActions["itemLock"]->toggle();
m_ScMW->scrActions["itemLock"]->toggle();
}
 
void Mpalette::handleLockSize()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
m_MainWindow->scrActions["itemLockSize"]->toggle();
m_ScMW->scrActions["itemLockSize"]->toggle();
}
 
void Mpalette::handlePrint()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
m_MainWindow->scrActions["itemPrintingEnabled"]->toggle();
m_ScMW->scrActions["itemPrintingEnabled"]->toggle();
}
 
void Mpalette::handleFlipH()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
m_MainWindow->scrActions["itemFlipH"]->toggle();
m_ScMW->scrActions["itemFlipH"]->toggle();
/*
if ((HaveDoc) && (HaveItem))
{
3637,9 → 3637,9
 
void Mpalette::handleFlipV()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
m_MainWindow->scrActions["itemFlipV"]->toggle();
m_ScMW->scrActions["itemFlipV"]->toggle();
/*
if ((HaveDoc) && (HaveItem))
{
3655,12 → 3655,12
 
void Mpalette::handlePathLine()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->PoShow = showcurveCheckBox->isChecked();
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3667,14 → 3667,14
 
void Mpalette::handlePathDist()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->setTextToFrameDistLeft(Dist->value());
m_MainWindow->view->AdjustItemSize(CurItem);
m_ScMW->view->AdjustItemSize(CurItem);
CurItem->updatePolyClip();
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3681,14 → 3681,14
 
void Mpalette::handlePathOffs()
{
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
CurItem->BaseOffs = -LineW->value();
m_MainWindow->view->AdjustItemSize(CurItem);
m_ScMW->view->AdjustItemSize(CurItem);
CurItem->updatePolyClip();
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3698,7 → 3698,7
if ((HaveDoc) && (HaveItem))
{
CurItem->fillRule = EvenOdd->isChecked();
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3708,7 → 3708,7
if ((HaveDoc) && (HaveItem))
{
CurItem->doOverprint = Overprint->isChecked();
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3715,7 → 3715,7
 
void Mpalette::NewName()
{
if (m_MainWindow->ScriptRunning || !HaveDoc || !HaveItem)
if (m_ScMW->ScriptRunning || !HaveDoc || !HaveItem)
return;
QString NameOld = CurItem->itemName();
QString NameNew = NameEdit->text();
3754,7 → 3754,7
{
QStringList sortList;
QMap<QString,QString>::Iterator it;
if (!m_MainWindow || m_MainWindow->ScriptRunning)
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
langCombo->clear();
for (it = langMap.begin(); it != langMap.end(); ++it)
3767,7 → 3767,7
{
if ((HaveDoc) && (HaveItem))
{
CurItem->document()->Language = (m_MainWindow->GetLang(langCombo->currentText()));
CurItem->doc()->Language = (m_ScMW->GetLang(langCombo->currentText()));
emit DocChanged();
}
}
3783,7 → 3783,7
if (dia->exec())
{
CurItem->TabValues = dia->tmpTab;
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
delete dia;
3798,7 → 3798,7
CurItem->LeftLine = LeftLine->isChecked();
CurItem->RightLine = RightLine->isChecked();
CurItem->BottomLine = BottomLine->isChecked();
m_MainWindow->view->RefreshItem(CurItem);
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
3834,10 → 3834,10
 
for (uint i = 0; i < doc->m_Selection->count(); ++i)
doc->m_Selection->itemAt(i)->checkChanges(true);
if (m_MainWindow->view->groupTransactionStarted())
if (m_ScMW->view->groupTransactionStarted())
{
UndoManager::instance()->commit();
m_MainWindow->view->setGroupTransactionStarted(false);
m_ScMW->view->setGroupTransactionStarted(false);
}
}
 
/branches/Version13x/Scribus/scribus/util.cpp
1252,11 → 1252,11
return newName;
}
 
QString getFileNameByPage(uint pageNo, QString extension)
QString getFileNameByPage(ScribusDoc* currDoc, uint pageNo, QString extension)
{
QString number;
number = number.setNum(pageNo + ScMW->doc->FirstPnum);
QString defaultName = ScMW->doc->DocName;
number = number.setNum(pageNo + currDoc->FirstPnum);
QString defaultName = currDoc->DocName;
if (defaultName.isNull())
defaultName = "export";
else
/branches/Version13x/Scribus/scribus/loadsaveplugin.h
83,7 → 83,7
// First, by descending order of `id', then descending order of priority.
static const QValueList<FileFormat> & supportedFormats();
virtual void setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts);
virtual void setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, ScribusMainWindow* targetMW, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois);
virtual bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles);
107,6 → 107,7
ScribusDoc* m_Doc;
ScribusView* m_View; //For 1.2.x loader at the moment
ScribusMainWindow* m_ScMW; //For plugins when required
QProgressBar* m_mwProgressBar;
SCFonts* m_AvailableFonts;
 
166,7 → 167,7
bool saveFile(const QString & fileName) const;
void setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts) const;
void setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, ScribusMainWindow* targetMW, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts) const;
void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois) const;
bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null) const;
bool readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles) const;
/branches/Version13x/Scribus/scribus/charselect.h
50,7 → 50,8
/*! \brief Construct an optional state dialog */
CharSelect(QWidget* parent, PageItem *item, QString font, bool modal=true);
~CharSelect() {};
 
const PageItem* item() const {return m_Item;}
void setItem(PageItem* newItem) {m_Item=newItem;}
const QString & getCharacters();
 
bool needReturn;
69,8 → 70,6
QPushButton* insertButton;
QPushButton* deleteButton;
QPushButton* closeButton;
PageItem *ite;
ScribusMainWindow *ap;
typedef QValueList<uint> charClassDef;
QValueList<charClassDef> allClasses;
QValueList<uint> characters;
123,9 → 122,12
void insertSpecialChar();
 
protected:
void run(QWidget* parent, PageItem* item, ScribusMainWindow* pl);
void run(QWidget* parent, PageItem* item);
bool eventFilter( QObject *obj, QEvent *ev );
void recalcCellSizes();
PageItem *m_Item;
QVBoxLayout* zAuswahlLayout;
QHBoxLayout* selectionsLayout;
QHBoxLayout* layout1;
138,7 → 140,7
Q_OBJECT
 
public:
ChTable(CharSelect* parent, ScribusMainWindow *pl);
ChTable(CharSelect* parent, PageItem *pi);
~ChTable() {};
void resizeData( int ) {};
QRect cellGeometry ( int row, int col ) const;
148,7 → 150,7
bool mPressed;
bool alternate;
Zoom* dia;
ScribusMainWindow *ap;
PageItem *m_Item;
CharSelect* par;
QTimer* watchTimer;
uint maxCount;
/branches/Version13x/Scribus/scribus/scribuscore.h
34,6 → 34,8
class PrefsManager;
class UndoManager;
 
extern SCRIBUS_API ScribusCore* ScCore;
 
/**
@author Craig Bradney <cbradney@zip.com.au>
@brief The core functions moved from the old ScribusMainWindow class
89,6 → 91,7
int havePNGAlpha() const {return m_HavePngAlpha;};
int haveTIFFSep() const {return m_HaveTiffSep;};
void getCMSProfiles();
bool fileWatcherActive() const;
//Main Window members
ScribusMainWindow* primaryMainWindow();
/branches/Version13x/Scribus/scribus/loremipsum.cpp
98,9 → 98,10
}
 
 
LoremManager::LoremManager(QWidget* parent, const char* name, bool modal, WFlags fl)
LoremManager::LoremManager(ScribusDoc* doc, QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog( parent, name, modal, fl )
{
m_Doc=doc;
if ( !name )
setName( "LoremManager" );
LoremManagerLayout = new QGridLayout( this, 1, 1, 11, 6, "LoremManagerLayout");
203,12 → 204,13
 
void LoremManager::insertLoremIpsum(QString name, int paraCount)
{
//CB: Avox please make insertText for text frame to nuke all this
// is it really applied?
bool done = false;
 
for (uint i = 0; i < ScMW->doc->m_Selection->count(); ++i)
for (uint i = 0; i < m_Doc->m_Selection->count(); ++i)
{
PageItem* currItem=ScMW->doc->m_Selection->itemAt(i);
PageItem* currItem=m_Doc->m_Selection->itemAt(i);
if (currItem == NULL)
continue;
if (!currItem->asTextFrame())
215,7 → 217,7
continue;
if (currItem->itemText.length() != 0)
{
ScMW->doc->itemSelection_ClearItem();
m_Doc->itemSelection_ClearItem();
/* ClearItem() doesn't return true or false so
the following test has to be done */
if (currItem->itemText.length() != 0)
233,9 → 235,9
{
done = true;
ss->Objekt = lp->createLorem(paraCount);
int st = findParagraphStyle(currItem->document(), currItem->document()->currentStyle);
int st = findParagraphStyle(m_Doc, m_Doc->currentStyle);
if (st > 5)
ss->GetText(currItem, st, currItem->document()->docParagraphStyles[st].charStyle().font()->scName(), currItem->document()->docParagraphStyles[st].charStyle().fontSize(), true);
ss->GetText(currItem, st, m_Doc->docParagraphStyles[st].charStyle().font()->scName(), m_Doc->docParagraphStyles[st].charStyle().fontSize(), true);
else
ss->GetText(currItem, st, currItem->currentCharStyle().font()->scName(), currItem->currentCharStyle().fontSize(), true);
delete ss;
243,12 → 245,12
delete lp;
//if (ScMW->view->SelItem.at(i)->Doc->docHyphenator->AutoCheck)
// ScMW->view->SelItem.at(i)->Doc->docHyphenator->slotHyphenate(ScMW->view->SelItem.at(i));
if (currItem->document()->docHyphenator->AutoCheck)
currItem->document()->docHyphenator->slotHyphenate(currItem);
if (m_Doc->docHyphenator->AutoCheck)
m_Doc->docHyphenator->slotHyphenate(currItem);
}
if (done)
{
ScMW->view->updateContents();
ScMW->slotDocCh();
m_Doc->view()->updateContents();
m_Doc->changed();
}
}
/branches/Version13x/Scribus/scribus/seiten.h
24,6 → 24,7
#include "scribusapi.h"
#include "scrpalettebase.h"
class ScribusView;
class ScribusMainWindow;
class DynamicTip;
class PageLayouts;
 
191,6 → 192,7
SeList* masterPageList;
SeView* pageView;
ScribusView *currView;
ScribusMainWindow *m_scMW;
QPixmap pix;
DynamicTip* dynTip;
};
/branches/Version13x/Scribus/scribus/checkDocument.cpp
19,7 → 19,7
#include <qlabel.h>
 
#include "sccombobox.h"
#include "scribus.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "page.h"
#include "documentchecker.h"
119,7 → 119,7
};
 
CheckDocument::CheckDocument( QWidget* parent, bool modal ) : ScrPaletteBase( parent, "checkDocument", modal, 0 ),
document(0)
m_Doc(0)
{
QImage img;
img.loadFromData( image0_data, sizeof( image0_data ), "PNG" );
184,13 → 184,13
{
if (itemMap.contains(ite))
{
ScMW->closeActiveWindowMasterPageEditor();
emit selectElement(document->DocItems.at(itemMap[ite])->OwnPage, itemMap[ite]);
ScCore->primaryMainWindow()->closeActiveWindowMasterPageEditor();
emit selectElement(m_Doc->DocItems.at(itemMap[ite])->OwnPage, itemMap[ite]);
return;
}
if (pageMap.contains(ite))
{
ScMW->closeActiveWindowMasterPageEditor();
ScCore->primaryMainWindow()->closeActiveWindowMasterPageEditor();
emit selectPage(pageMap[ite]);
return;
}
201,8 → 201,8
}
if (masterPageItemMap.contains(ite))
{
if (!document->masterPageMode())
emit selectMasterPage(document->MasterItems.at(masterPageItemMap[ite])->OnMasterPage);
if (!m_Doc->masterPageMode())
emit selectMasterPage(m_Doc->MasterItems.at(masterPageItemMap[ite])->OnMasterPage);
emit selectElement(-1, masterPageItemMap[ite]);
return;
}
210,22 → 210,23
 
void CheckDocument::doReScan()
{
clearErrorList();
if (document==0)
return;
document->curCheckProfile = curCheckProfile->currentText();;
DocumentChecker::checkDocument(document);
buildErrorList(document);
newScan(curCheckProfile->currentText());
// clearErrorList();
// if (m_Doc==0)
// return;
// m_Doc->curCheckProfile = curCheckProfile->currentText();
// DocumentChecker::checkDocument(m_Doc);
// buildErrorList(m_Doc);
}
 
void CheckDocument::newScan(const QString& name)
{
clearErrorList();
if (document==0)
if (m_Doc==0)
return;
document->curCheckProfile = name;
DocumentChecker::checkDocument(document);
buildErrorList(document);
m_Doc->curCheckProfile = name;
DocumentChecker::checkDocument(m_Doc);
buildErrorList(m_Doc);
}
 
void CheckDocument::clearErrorList()
242,12 → 243,12
void CheckDocument::buildErrorList(ScribusDoc *doc)
{
bool resultError = false;
document = doc;
m_Doc = doc;
disconnect(curCheckProfile, SIGNAL(activated(const QString&)), this, SLOT(newScan(const QString&)));
curCheckProfile->clear();
clearErrorList();
 
if (document==0)
if (m_Doc==0)
return;
 
CheckerPrefsList::Iterator it;
/branches/Version13x/Scribus/scribus/prefs.cpp
182,14 → 182,15
ProPfad = new QLineEdit( GroupBox200, "Datei1" );
ProPfad->setMinimumSize( QSize( 268, 22 ) );
//ProPfad->setText(prefsData->ProfileDir);
if (ScMW->HaveDoc)
ProPfad->setEnabled(false);
PfadText2 = new QLabel( ProPfad, tr("&ICC Profiles:"), GroupBox200, "Pfadtext1" );
FileC2 = new QToolButton( GroupBox200, "FileC1" );
FileC2->setMinimumSize( QSize( 88, 24 ) );
FileC2->setText( tr( "C&hange..." ) );
if (ScMW->HaveDoc)
if (ScCore->primaryMainWindow()->HaveDoc)
{
ProPfad->setEnabled(false);
FileC2->setEnabled(false);
}
GroupBox200Layout->addWidget( PfadText2, 1, 0 );
GroupBox200Layout->addWidget( ProPfad, 1, 1 );
GroupBox200Layout->addWidget( FileC2, 1, 2 );
1591,7 → 1592,7
prefsManager->appPrefs.AutoSave = GroupAS->isChecked();
prefsManager->appPrefs.AutoSaveTime = ASTime->value() * 60 * 1000;
prefsManager->appPrefs.MinWordLen = tabHyphenator->wordLen->value();
prefsManager->appPrefs.Language = ScMW->GetLang(tabHyphenator->language->currentText());
prefsManager->appPrefs.Language = ScCore->primaryMainWindow()->GetLang(tabHyphenator->language->currentText());
prefsManager->appPrefs.Automatic = !tabHyphenator->verbose->isChecked();
prefsManager->appPrefs.AutoCheck = tabHyphenator->input->isChecked();
prefsManager->appPrefs.HyCount = tabHyphenator->maxCount->value();
1701,7 → 1702,7
 
void Preferences::applyChangesButton_clicked()
{
ScMW->prefsOrg(this);
ScCore->primaryMainWindow()->prefsOrg(this);
}
 
void Preferences::backToDefaults_clicked()
/branches/Version13x/Scribus/scribus/page.h
74,7 → 74,7
// PV - guides refactoring
//QValueList<double> XGuides;
//QValueList<double> YGuides;
ScribusDoc* document() const { return m_Doc; }
ScribusDoc* doc() const { return m_Doc; }
void setDocument(ScribusDoc* doc);
uint pageNr() const { return m_pageNr; }
void setPageNr(int pageNr);
/branches/Version13x/Scribus/scribus/preview.cpp
33,6 → 33,7
#include <qtable.h>
#include "pslib.h"
#include "checkDocument.h"
#include "cmsettings.h"
#include "prefsfile.h"
#include "prefscontext.h"
#include "prefsmanager.h"
700,28 → 701,29
q++;
}
}
CMSettings cms(doc, "");
if (flagsVisible["Cyan"]->isChecked())
{
if (GsMinor < 54)
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.tif.Cyan.tif", "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.tif.Cyan.tif", cms, 0, false, false, ScImage::RGBData, 72, &mode);
else
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.Cyan.tif", "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.Cyan.tif", cms, 0, false, false, ScImage::RGBData, 72, &mode);
blendImages(image, im, ScColor(255, 0, 0, 0));
}
if (flagsVisible["Magenta"]->isChecked())
{
if (GsMinor < 54)
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.tif.Magenta.tif", "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.tif.Magenta.tif", cms, 0, false, false, ScImage::RGBData, 72, &mode);
else
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.Magenta.tif", "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.Magenta.tif", cms, 0, false, false, ScImage::RGBData, 72, &mode);
blendImages(image, im, ScColor(0, 255, 0, 0));
}
if (flagsVisible["Yellow"]->isChecked())
{
if (GsMinor < 54)
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.tif.Yellow.tif", "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.tif.Yellow.tif", cms, 0, false, false, ScImage::RGBData, 72, &mode);
else
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.Yellow.tif", "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.Yellow.tif", cms, 0, false, false, ScImage::RGBData, 72, &mode);
blendImages(image, im, ScColor(0, 0, 255, 0));
}
QMap<QString, int>::Iterator sepit;
734,16 → 736,17
fnam = QString(prefsManager->preferencesLocation()+"/sc.tif.s%1.tif").arg(sepit.data());
else
fnam = QString(prefsManager->preferencesLocation()+"/sc.s%1.tif").arg(sepit.data());
im.LoadPicture(fnam, "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(fnam, cms, 0, false, false, ScImage::RGBData, 72, &mode);
blendImages(image, im, doc->PageColors[sepit.key()]);
}
}
if (flagsVisible["Black"]->isChecked())
{
CMSettings cms(doc, "");
if (GsMinor < 54)
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.tif.Black.tif", "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.tif.Black.tif", cms, 0, false, false, ScImage::RGBData, 72, &mode);
else
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.Black.tif", "", 0, false, false, ScImage::RGBData, 72, &mode);
im.LoadPicture(prefsManager->preferencesLocation()+"/sc.Black.tif", cms, 0, false, false, ScImage::RGBData, 72, &mode);
blendImages(image, im, ScColor(0, 0, 0, 255));
}
for( int yi=0; yi < h2; ++yi )
/branches/Version13x/Scribus/scribus/scribuscore.cpp
109,7 → 109,7
return(EXIT_FAILURE);
ScMWList.append(scribus);
m_currScMW=0;
ScMW=scribus;
// ScMW=scribus;
int retVal=initScribusCore(showSplash, showFontInfo, newGuiLanguage, prefsUserFile);
if (retVal == 1)
return(EXIT_FAILURE);
507,3 → 507,11
return 0;
return mw;
}
 
 
bool ScribusCore::fileWatcherActive() const
{
if (fileWatcher!=NULL)
return fileWatcher->isActive();
return false;
}
/branches/Version13x/Scribus/scribus/muster.h
58,9 → 58,7
void selectMasterPage(QListBoxItem *item);
 
signals:
//void createNew(int);
void removePage(int);
//void loadPage(QString, int, bool);
void finished();
};
 
/branches/Version13x/Scribus/scribus/menumanager.cpp
29,9 → 29,9
 
 
 
MenuManager::MenuManager(QMenuBar *scrMenuBar, QObject *parent, const char *name) : QObject(parent, name)
MenuManager::MenuManager(QMenuBar* mb, QObject *parent, const char *name) : QObject(parent, name)
{
scribusMenuBar=scrMenuBar;
scribusMenuBar=mb;
menuList.clear();
}
 
254,14 → 254,14
{
ScrAction *actionFromName=NULL;
//quick hack to make this work for existing plugins for now
if (parent=="File" && afterMenuName=="New")
actionFromName=ScMW->scrActions["fileNew"];
if (parent=="File" && afterMenuName=="Print")
actionFromName=ScMW->scrActions["filePrint"];
if (parent=="File" && afterMenuName=="SaveAs")
actionFromName=ScMW->scrActions["fileSaveAs"];
if (parent=="Help" && afterMenuName=="Manual")
actionFromName=ScMW->scrActions["helpManual"];
// if (parent=="File" && afterMenuName=="New")
// actionFromName=m_ScMW->scrActions["fileNew"];
// if (parent=="File" && afterMenuName=="Print")
// actionFromName=m_ScMW->scrActions["filePrint"];
// if (parent=="File" && afterMenuName=="SaveAs")
// actionFromName=m_ScMW->scrActions["fileSaveAs"];
// if (parent=="Help" && afterMenuName=="Manual")
// actionFromName=m_ScMW->scrActions["helpManual"];
bool retVal=false;
if (menuList.contains(parent) && menuList[parent]!=NULL)
retVal=menuList[parent]->insertMenuItemAfter(menuAction, actionFromName);
/branches/Version13x/Scribus/scribus/gtwriter.cpp
29,19 → 29,19
#include "pageitem.h"
#include "scribusstructs.h"
 
gtWriter::gtWriter(bool append)
{
action = new gtAction(append);
errorSet = false;
action->setProgressInfo();
setDefaultStyle();
unsetCharacterStyle();
unsetParagraphStyle();
// if (!append)
// action->clearFrame();
// else
// this->append("\n");
}
// gtWriter::gtWriter(bool append)
// {
// action = new gtAction(append, ScMW->doc->m_Selection->itemAt(0));
// errorSet = false;
// action->setProgressInfo();
// setDefaultStyle();
// unsetCharacterStyle();
// unsetParagraphStyle();
// // if (!append)
// // action->clearFrame();
// // else
// // this->append("\n");
// }
 
gtWriter::gtWriter(bool append, PageItem *pageitem)
{
/branches/Version13x/Scribus/scribus/werktoolb.cpp
38,7 → 38,7
extern QPixmap loadIcon(QString nam);
 
 
ModeToolBar::ModeToolBar(QMainWindow* parent) : ScToolBar(tr("Tools"), "Tools", parent, QDockWindow::Vertical)
ModeToolBar::ModeToolBar(ScribusMainWindow* parent) : ScToolBar(tr("Tools"), "Tools", parent, QDockWindow::Vertical)
{
SubMode = 0;
ValCount = 32;
46,18 → 46,18
100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 0.0, 100.0, 0.0, 100.0,
0.0, 100.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0};
ShapeVals = AutoShapes0;
 
ScMW->scrActions["toolsSelect"]->addTo(this);
ScMW->scrActions["toolsInsertTextFrame"]->addTo(this);
ScMW->scrActions["toolsInsertImageFrame"]->addTo(this);
ScMW->scrActions["toolsInsertTableFrame"]->addTo(this);
m_ScMW=parent;
m_ScMW->scrActions["toolsSelect"]->addTo(this);
m_ScMW->scrActions["toolsInsertTextFrame"]->addTo(this);
m_ScMW->scrActions["toolsInsertImageFrame"]->addTo(this);
m_ScMW->scrActions["toolsInsertTableFrame"]->addTo(this);
ScMW->scrActions["toolsInsertShape"]->addTo(this);
ScMW->scrMenuMgr->createMenu("insertShapeButtonMenu", "insertShapeButtonMenu");
insertShapeButtonMenu=ScMW->scrMenuMgr->getLocalPopupMenu("insertShapeButtonMenu");
ScMW->scrMenuMgr->addMenuToWidgetOfAction("insertShapeButtonMenu", ScMW->scrActions["toolsInsertShape"]);
m_ScMW->scrActions["toolsInsertShape"]->addTo(this);
m_ScMW->scrMenuMgr->createMenu("insertShapeButtonMenu", "insertShapeButtonMenu");
insertShapeButtonMenu=m_ScMW->scrMenuMgr->getLocalPopupMenu("insertShapeButtonMenu");
m_ScMW->scrMenuMgr->addMenuToWidgetOfAction("insertShapeButtonMenu", m_ScMW->scrActions["toolsInsertShape"]);
QToolButton *insertShapeButton = dynamic_cast<QToolButton*>(ScMW->scrActions["toolsInsertShape"]->getWidgetAddedTo());
QToolButton *insertShapeButton = dynamic_cast<QToolButton*>(m_ScMW->scrActions["toolsInsertShape"]->getWidgetAddedTo());
if (insertShapeButton)
insertShapeButton->setPopupDelay(0);
Rechteck = new AutoformButtonGroup( NULL );
64,30 → 64,30
insertShapeButtonMenu->insertItem( Rechteck );
//QImage newShapeIcon = Rechteck->getIconPixmap(0).convertToImage();
//newShapeIcon.smoothScale(16,16);
ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(Rechteck->getIconPixmap(0,16),Rechteck->getIconPixmap(0)));
m_ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(Rechteck->getIconPixmap(0,16),Rechteck->getIconPixmap(0)));
 
ScMW->scrActions["toolsInsertPolygon"]->addTo(this);
ScMW->scrMenuMgr->createMenu("insertPolygonButtonMenu", "insertPolygonButtonMenu");
insertPolygonButtonMenu=ScMW->scrMenuMgr->getLocalPopupMenu("insertPolygonButtonMenu");
ScMW->scrMenuMgr->addMenuToWidgetOfAction("insertPolygonButtonMenu", ScMW->scrActions["toolsInsertPolygon"]);
m_ScMW->scrActions["toolsInsertPolygon"]->addTo(this);
m_ScMW->scrMenuMgr->createMenu("insertPolygonButtonMenu", "insertPolygonButtonMenu");
insertPolygonButtonMenu=m_ScMW->scrMenuMgr->getLocalPopupMenu("insertPolygonButtonMenu");
m_ScMW->scrMenuMgr->addMenuToWidgetOfAction("insertPolygonButtonMenu", m_ScMW->scrActions["toolsInsertPolygon"]);
idInsertPolygonButtonMenu=insertPolygonButtonMenu->insertItem( "Properties...", this, SLOT(GetPolyProps()));
QToolButton *insertPolygonButton = dynamic_cast<QToolButton*>(ScMW->scrActions["toolsInsertPolygon"]->getWidgetAddedTo());
QToolButton *insertPolygonButton = dynamic_cast<QToolButton*>(m_ScMW->scrActions["toolsInsertPolygon"]->getWidgetAddedTo());
if (insertPolygonButton)
insertPolygonButton->setPopupDelay(0);
ScMW->scrActions["toolsInsertLine"]->addTo(this);
ScMW->scrActions["toolsInsertBezier"]->addTo(this);
ScMW->scrActions["toolsInsertFreehandLine"]->addTo(this);
ScMW->scrActions["toolsRotate"]->addTo(this);
ScMW->scrActions["toolsZoom"]->addTo(this);
ScMW->scrActions["toolsEditContents"]->addTo(this);
ScMW->scrActions["toolsEditWithStoryEditor"]->addTo(this);
ScMW->scrActions["toolsLinkTextFrame"]->addTo(this);
ScMW->scrActions["toolsUnlinkTextFrame"]->addTo(this);
ScMW->scrActions["toolsMeasurements"]->addTo(this);
ScMW->scrActions["toolsCopyProperties"]->addTo(this);
ScMW->scrActions["toolsEyeDropper"]->addTo(this);
m_ScMW->scrActions["toolsInsertLine"]->addTo(this);
m_ScMW->scrActions["toolsInsertBezier"]->addTo(this);
m_ScMW->scrActions["toolsInsertFreehandLine"]->addTo(this);
m_ScMW->scrActions["toolsRotate"]->addTo(this);
m_ScMW->scrActions["toolsZoom"]->addTo(this);
m_ScMW->scrActions["toolsEditContents"]->addTo(this);
m_ScMW->scrActions["toolsEditWithStoryEditor"]->addTo(this);
m_ScMW->scrActions["toolsLinkTextFrame"]->addTo(this);
m_ScMW->scrActions["toolsUnlinkTextFrame"]->addTo(this);
m_ScMW->scrActions["toolsMeasurements"]->addTo(this);
m_ScMW->scrActions["toolsCopyProperties"]->addTo(this);
m_ScMW->scrActions["toolsEyeDropper"]->addTo(this);
 
languageChange();
connect(Rechteck, SIGNAL(FormSel(int, int, double *)), this, SLOT(SelShape(int, int, double *)));
95,9 → 95,9
 
void ModeToolBar::GetPolyProps()
{
PolygonProps* dia = new PolygonProps(this, ScMW->doc->toolSettings.polyC, ScMW->doc->toolSettings.polyFd, ScMW->doc->toolSettings.polyF, ScMW->doc->toolSettings.polyS, ScMW->doc->toolSettings.polyR);
PolygonProps* dia = new PolygonProps(this, m_ScMW->doc->toolSettings.polyC, m_ScMW->doc->toolSettings.polyFd, m_ScMW->doc->toolSettings.polyF, m_ScMW->doc->toolSettings.polyS, m_ScMW->doc->toolSettings.polyR);
if (dia->exec())
dia->getValues(&ScMW->doc->toolSettings.polyC, &ScMW->doc->toolSettings.polyFd, &ScMW->doc->toolSettings.polyF, &ScMW->doc->toolSettings.polyS, &ScMW->doc->toolSettings.polyR);
dia->getValues(&m_ScMW->doc->toolSettings.polyC, &m_ScMW->doc->toolSettings.polyFd, &m_ScMW->doc->toolSettings.polyF, &m_ScMW->doc->toolSettings.polyS, &m_ScMW->doc->toolSettings.polyR);
delete dia;
}
 
106,13 → 106,13
//const QPixmap* newIcon = Rechteck->find(s)->pixmap();
//QImage newShapeIcon = Rechteck->find(s)->pixmap()->convertToImage();
//newShapeIcon.smoothScale(16,16);
//ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(newShapeIcon, *newIcon));
ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(Rechteck->getIconPixmap(s,16),Rechteck->getIconPixmap(s)));
//m_ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(newShapeIcon, *newIcon));
m_ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(Rechteck->getIconPixmap(s,16),Rechteck->getIconPixmap(s)));
insertShapeButtonMenu->hide();
SubMode = s;
ValCount = c;
ShapeVals = vals;
ScMW->scrActions["toolsInsertShape"]->setOn(true);
m_ScMW->scrActions["toolsInsertShape"]->setOn(true);
}
 
void ModeToolBar::languageChange()
122,13 → 122,13
}
 
 
PDFToolBar::PDFToolBar(QMainWindow* parent) : ScToolBar( tr("PDF Tools"), "PDF_Tools", parent)
PDFToolBar::PDFToolBar(ScribusMainWindow* parent) : ScToolBar( tr("PDF Tools"), "PDF_Tools", parent)
{
ScMW->scrActions["toolsPDFPushButton"]->addTo(this);
ScMW->scrActions["toolsPDFTextField"]->addTo(this);
ScMW->scrActions["toolsPDFCheckBox"]->addTo(this);
ScMW->scrActions["toolsPDFComboBox"]->addTo(this);
ScMW->scrActions["toolsPDFListBox"]->addTo(this);
ScMW->scrActions["toolsPDFAnnotText"]->addTo(this);
ScMW->scrActions["toolsPDFAnnotLink"]->addTo(this);
parent->scrActions["toolsPDFPushButton"]->addTo(this);
parent->scrActions["toolsPDFTextField"]->addTo(this);
parent->scrActions["toolsPDFCheckBox"]->addTo(this);
parent->scrActions["toolsPDFComboBox"]->addTo(this);
parent->scrActions["toolsPDFListBox"]->addTo(this);
parent->scrActions["toolsPDFAnnotText"]->addTo(this);
parent->scrActions["toolsPDFAnnotLink"]->addTo(this);
}
/branches/Version13x/Scribus/scribus/undogui.cpp
39,7 → 39,7
#include "prefsmanager.h"
#include "prefsfile.h"
#include "prefscontext.h"
#include "scribus.h"
#include "scribuscore.h"
#include "menumanager.h"
#include "scraction.h"
 
81,16 → 81,16
redoButton->setAutoRaise(true);
*/
//Scribus action based toolbar button construction
ScMW->scrActions["editUndoAction"]->addTo(parent);
ScMW->scrActions["editRedoAction"]->addTo(parent);
ScMW->scrMenuMgr->createMenu("undoButtonMenu", "undoButtonMenu");
ScMW->scrMenuMgr->createMenu("redoButtonMenu", "redoButtonMenu");
undoMenu=ScMW->scrMenuMgr->getLocalPopupMenu("undoButtonMenu");
redoMenu=ScMW->scrMenuMgr->getLocalPopupMenu("redoButtonMenu");
ScMW->scrMenuMgr->addMenuToWidgetOfAction("undoButtonMenu", ScMW->scrActions["editUndoAction"]);
ScMW->scrMenuMgr->addMenuToWidgetOfAction("redoButtonMenu", ScMW->scrActions["editRedoAction"]);
QToolButton *undoButton = dynamic_cast<QToolButton*>(ScMW->scrActions["editUndoAction"]->getWidgetAddedTo());
QToolButton *redoButton = dynamic_cast<QToolButton*>(ScMW->scrActions["editRedoAction"]->getWidgetAddedTo());
ScCore->primaryMainWindow()->scrActions["editUndoAction"]->addTo(parent);
ScCore->primaryMainWindow()->scrActions["editRedoAction"]->addTo(parent);
ScCore->primaryMainWindow()->scrMenuMgr->createMenu("undoButtonMenu", "undoButtonMenu");
ScCore->primaryMainWindow()->scrMenuMgr->createMenu("redoButtonMenu", "redoButtonMenu");
undoMenu=ScCore->primaryMainWindow()->scrMenuMgr->getLocalPopupMenu("undoButtonMenu");
redoMenu=ScCore->primaryMainWindow()->scrMenuMgr->getLocalPopupMenu("redoButtonMenu");
ScCore->primaryMainWindow()->scrMenuMgr->addMenuToWidgetOfAction("undoButtonMenu", ScCore->primaryMainWindow()->scrActions["editUndoAction"]);
ScCore->primaryMainWindow()->scrMenuMgr->addMenuToWidgetOfAction("redoButtonMenu", ScCore->primaryMainWindow()->scrActions["editRedoAction"]);
QToolButton *undoButton = dynamic_cast<QToolButton*>(ScCore->primaryMainWindow()->scrActions["editUndoAction"]->getWidgetAddedTo());
QToolButton *redoButton = dynamic_cast<QToolButton*>(ScCore->primaryMainWindow()->scrActions["editRedoAction"]->getWidgetAddedTo());
if (undoButton && redoButton)
{
undoButton->setPopupDelay(0);
97,9 → 97,9
redoButton->setPopupDelay(0);
}
ScMW->scrActions["editCut"]->addTo(parent);
ScMW->scrActions["editCopy"]->addTo(parent);
ScMW->scrActions["editPaste"]->addTo(parent);
ScCore->primaryMainWindow()->scrActions["editCut"]->addTo(parent);
ScCore->primaryMainWindow()->scrActions["editCopy"]->addTo(parent);
ScCore->primaryMainWindow()->scrActions["editPaste"]->addTo(parent);
/* BnF Undo buttons
connect(undoButton, SIGNAL(clicked()), this, SLOT(undoClicked()));
114,13 → 114,13
undoMenu->clear();
undoItems.clear();
//Scribus disable
ScMW->scrActions["editUndoAction"]->setEnabled(false);
ScCore->primaryMainWindow()->scrActions["editUndoAction"]->setEnabled(false);
// BnF disable
//undoButton->setEnabled(false);
redoMenu->clear();
redoItems.clear();
//Scribus disable;
ScMW->scrActions["editRedoAction"]->setEnabled(false);
ScCore->primaryMainWindow()->scrActions["editRedoAction"]->setEnabled(false);
// BnF disable
//redoButton->setEnabled(false);
}
198,8 → 198,8
 
void UndoWidget::updateUndoActions()
{
ScMW->scrActions["editUndoAction"]->setEnabled(undoMenu->count() != 0);
ScMW->scrActions["editRedoAction"]->setEnabled(redoMenu->count() != 0);
ScCore->primaryMainWindow()->scrActions["editUndoAction"]->setEnabled(undoMenu->count() != 0);
ScCore->primaryMainWindow()->scrActions["editRedoAction"]->setEnabled(redoMenu->count() != 0);
}
 
void UndoWidget::updateUndo(int steps)
275,10 → 275,10
connect(undoList, SIGNAL(onItem(QListBoxItem*)), this, SLOT(showToolTip(QListBoxItem*)));
connect(undoList, SIGNAL(onViewport()), this, SLOT(removeToolTip()));
connect(objectBox, SIGNAL(toggled(bool)), this, SLOT(objectCheckBoxClicked(bool)));
connect(ScMW->scrActions["editActionMode"], SIGNAL(toggled(bool)),
connect(ScCore->primaryMainWindow()->scrActions["editActionMode"], SIGNAL(toggled(bool)),
objectBox, SLOT(setChecked(bool)));
connect(objectBox, SIGNAL(toggled(bool)),
ScMW->scrActions["editActionMode"], SLOT(setOn(bool)));
ScCore->primaryMainWindow()->scrActions["editActionMode"], SLOT(setOn(bool)));
}
 
void UndoPalette::clear()
291,8 → 291,8
 
void UndoPalette::updateFromPrefs()
{
undoButton->setAccel(ScMW->scrActions["editUndoAction"]->accel());
redoButton->setAccel(ScMW->scrActions["editRedoAction"]->accel());
undoButton->setAccel(ScCore->primaryMainWindow()->scrActions["editUndoAction"]->accel());
redoButton->setAccel(ScCore->primaryMainWindow()->scrActions["editRedoAction"]->accel());
}
 
void UndoPalette::languageChange()
/branches/Version13x/Scribus/scribus/Makefile.am
41,6 → 41,7
checkDocument.cpp \
cmserrorhandling.cpp \
cmsprefs.cpp \
cmsettings.cpp \
cmykfw.cpp \
collect4output.cpp \
colorchart.cpp \
/branches/Version13x/Scribus/scribus/newfile.cpp
17,7 → 17,7
#include "pagesize.h"
#include "marginWidget.h"
#include "scconfig.h"
#include "scribus.h"
#include "scribuscore.h"
#include "prefsmanager.h"
#include "pagelayout.h"
#include "pagestructs.h"
30,7 → 30,7
extern QPixmap loadIcon(QString nam);
 
 
NewDoc::NewDoc( QWidget* parent, bool startUp ) : QDialog( parent, "newDoc", true, 0 )
NewDoc::NewDoc( QWidget* parent, const QStringList& recentDocs, bool startUp ) : QDialog( parent, "newDoc", true, 0 )
{
prefsManager=PrefsManager::instance();
tabSelected = 0;
53,6 → 53,7
tabWidget->addTab(newDocFrame, tr("&New Document"));
createOpenDocPage();
tabWidget->addTab(openDocFrame, tr("Open &Existing Document"));
recentDocList=recentDocs;
createRecentDocPage();
tabWidget->addTab(recentDocFrame, tr("Open Recent &Document"));
TabbedNewDocLayout->addWidget(tabWidget);
101,7 → 102,7
connect(ComboBox3, SIGNAL(activated(int)), this, SLOT(setUnit(int)));
connect(Distance, SIGNAL(valueChanged(int)), this, SLOT(setDist(int)));
if (startUp)
connect(recentDocList, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(recentDocList_doubleClicked(QListBoxItem*)));
connect(recentDocListBox, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(recentDocListBox_doubleClicked(QListBoxItem*)));
 
setMinimumSize(minimumSizeHint());
setMaximumSize(minimumSizeHint());
302,13 → 303,11
{
recentDocFrame = new QFrame(this, "recentDocFrame");
recentDocLayout = new QVBoxLayout(recentDocFrame, 5, 5, "recentDocLayout");
recentDocList = new QListBox(recentDocFrame, "recentDocList");
recentDocLayout->addWidget(recentDocList);
uint max = QMIN(prefsManager->appPrefs.RecentDCount, ScMW->RecentDocs.count());
recentDocListBox = new QListBox(recentDocFrame, "recentDocListBox");
recentDocLayout->addWidget(recentDocListBox);
uint max = QMIN(prefsManager->appPrefs.RecentDCount, recentDocList.count());
for (uint m = 0; m < max; ++m)
{
recentDocList->insertItem(ScMW->RecentDocs[m]);
}
recentDocListBox->insertItem(recentDocList[m]);
}
 
void NewDoc::setWidth(int)
477,7 → 476,7
docLayout->firstPage->setCurrentItem(prefsManager->appPrefs.pageSets[choosenLayout].FirstPage);
}
 
void NewDoc::recentDocList_doubleClicked(QListBoxItem * /*item*/)
void NewDoc::recentDocListBox_doubleClicked(QListBoxItem * /*item*/)
{
/* Yep. There is nothing to solve. ScribusMainWindow handles all
openings etc. It's Franz's programming style ;) */
/branches/Version13x/Scribus/scribus/scraction.h
24,7 → 24,7
 
#include <qaction.h>
#include "scribusapi.h"
 
class ScribusDoc;
/**
@author Craig Bradney
*/
33,7 → 33,7
Q_OBJECT
 
public:
typedef enum {Normal, DataInt, DataDouble, DataQString, RecentFile, DLL, Window, RecentScript, UnicodeChar, Layer } ActionType;
typedef enum {Normal, DataInt, DataDouble, DataQString, RecentFile, DLL, Window, RecentScript, UnicodeChar, Layer, ActionDLL } ActionType;
/*!
\author Craig Bradney
178,6 → 178,7
void activatedData(int);
void activatedData(double);
void activatedData(QString);
void activatedData(ScribusDoc*);
void toggledData(bool, int);
void toggledData(bool, double);
void toggledData(bool, QString);
/branches/Version13x/Scribus/scribus/search.cpp
343,12 → 343,12
void SearchReplace::slotSearch()
{
if (SMode)
ScMW->view->slotDoCurs(false);
Doc->view()->slotDoCurs(false);
slotDoSearch();
if (SMode)
{
ScMW->view->slotDoCurs(true);
ScMW->view->RefreshItem(Item);
Doc->view()->slotDoCurs(true);
Doc->view()->RefreshItem(Item);
}
}
 
513,7 → 513,7
if ((!found) || (a == Item->itemText.length()))
{
Doc->DoDrawing = true;
ScMW->view->RefreshItem(Item);
Doc->view()->RefreshItem(Item);
DoReplace->setEnabled(false);
AllReplace->setEnabled(false);
QMessageBox::information(this, tr("Search/Replace"), tr("Search finished"), CommonStrings::tr_OK);
523,21 → 523,21
}
else
{
if (ScMW->CurrStED != NULL)
if (Doc->scMW()->CurrStED != NULL)
{
int p, i;
ScMW->CurrStED->Editor->getCursorPosition(&p, &i);
Doc->scMW()->CurrStED->Editor->getCursorPosition(&p, &i);
uint inde = 0;
int as = i;
uint fpa = p;
int fch = i;
found = false;
if (ScMW->CurrStED->Editor->StyledText.count() != 0)
if (Doc->scMW()->CurrStED->Editor->StyledText.count() != 0)
{
for (uint pa = p; pa < ScMW->CurrStED->Editor->StyledText.count(); ++pa)
for (uint pa = p; pa < Doc->scMW()->CurrStED->Editor->StyledText.count(); ++pa)
{
SEditor::ChList *chars;
chars = ScMW->CurrStED->Editor->StyledText.at(pa);
chars = Doc->scMW()->CurrStED->Editor->StyledText.at(pa);
if (SText->isChecked())
{
if (Word->isChecked())
544,16 → 544,16
{
QRegExp rx( "(\\b"+sText+"\\b)" );
if (CaseIgnore->isChecked())
as = rx.search( ScMW->CurrStED->Editor->text(pa).lower(), i );
as = rx.search( Doc->scMW()->CurrStED->Editor->text(pa).lower(), i );
else
as = rx.search( ScMW->CurrStED->Editor->text(pa), i );
as = rx.search( Doc->scMW()->CurrStED->Editor->text(pa), i );
}
else
{
if (CaseIgnore->isChecked())
as = ScMW->CurrStED->Editor->text(pa).lower().find(sText, i);
as = Doc->scMW()->CurrStED->Editor->text(pa).lower().find(sText, i);
else
as = ScMW->CurrStED->Editor->text(pa).find(sText, i);
as = Doc->scMW()->CurrStED->Editor->text(pa).find(sText, i);
}
if (as != -1)
{
632,9 → 632,9
}
if (found)
{
ScMW->CurrStED->Editor->setSelection(fpa, fch, fpa, fch+inde);
ScMW->CurrStED->updateProps(fpa, fch);
ScMW->CurrStED->Editor->setCursorPosition(fpa, fch+inde);
Doc->scMW()->CurrStED->Editor->setSelection(fpa, fch, fpa, fch+inde);
Doc->scMW()->CurrStED->updateProps(fpa, fch);
Doc->scMW()->CurrStED->Editor->setCursorPosition(fpa, fch+inde);
if (rep)
{
DoReplace->setEnabled(true);
649,8 → 649,8
CommonStrings::tr_OK);
matchesFound = 0;
NotFound = false;
ScMW->CurrStED->Editor->removeSelection();
ScMW->CurrStED->Editor->setCursorPosition(0, 0);
Doc->scMW()->CurrStED->Editor->removeSelection();
Doc->scMW()->CurrStED->Editor->setCursorPosition(0, 0);
}
}
}
660,12 → 660,12
void SearchReplace::slotReplace()
{
if (SMode)
ScMW->view->slotDoCurs(false);
Doc->view()->slotDoCurs(false);
slotDoReplace();
if (SMode)
{
ScMW->view->slotDoCurs(true);
ScMW->view->RefreshItem(Item);
Doc->view()->slotDoCurs(true);
Doc->view()->RefreshItem(Item);
}
}
 
675,7 → 675,7
{
QString repl, sear;
uint cs, cx;
ScText *hg;
// ScText *hg;
if (RText->isChecked())
{
repl = RTextVal->text();
790,36 → 790,37
}
else
{
if (ScMW->CurrStED != NULL)
if (Doc->scMW()->CurrStED != NULL)
{
StoryEditor* se=Doc->scMW()->CurrStED;
if (RStyle->isChecked())
ScMW->CurrStED->newAlign(RStyleVal->currentItem());
se->newAlign(RStyleVal->currentItem());
if (RFill->isChecked())
ScMW->CurrStED->newTxFill(RFillVal->currentItem(), -1);
se->newTxFill(RFillVal->currentItem(), -1);
if (RFillS->isChecked())
ScMW->CurrStED->newTxFill(-1, RFillSVal->getValue());
se->newTxFill(-1, RFillSVal->getValue());
if (RStroke->isChecked())
ScMW->CurrStED->newTxStroke(RStrokeVal->currentItem(), -1);
se->newTxStroke(RStrokeVal->currentItem(), -1);
if (RStrokeS->isChecked())
ScMW->CurrStED->newTxStroke(-1, RStrokeSVal->getValue());
se->newTxStroke(-1, RStrokeSVal->getValue());
if (RFont->isChecked())
ScMW->CurrStED->newTxFont(RFontVal->currentText());
se->newTxFont(RFontVal->currentText());
if (RSize->isChecked())
ScMW->CurrStED->newTxSize(RSizeVal->value());
se->newTxSize(RSizeVal->value());
if (REffect->isChecked())
ScMW->CurrStED->newTxStyle(REffVal->getStyle());
se->newTxStyle(REffVal->getStyle());
if (RText->isChecked())
{
disconnect(ScMW->CurrStED->Editor, SIGNAL(cursorPositionChanged(int, int)), ScMW->CurrStED, SLOT(updateProps(int, int)));
disconnect(se->Editor, SIGNAL(cursorPositionChanged(int, int)), se, SLOT(updateProps(int, int)));
int PStart, PEnd, SelStart, SelEnd;
ScMW->CurrStED->Editor->getSelection(&PStart, &SelStart, &PEnd, &SelEnd);
ScMW->CurrStED->Editor->insChars(RTextVal->text());
ScMW->CurrStED->Editor->setSelection(PStart, SelStart, PEnd, SelEnd);
ScMW->CurrStED->Editor->removeSelectedText();
ScMW->CurrStED->Editor->setStyle(ScMW->CurrStED->Editor->CurrentStyle);
ScMW->CurrStED->Editor->insert(RTextVal->text());
connect(ScMW->CurrStED->Editor, SIGNAL(cursorPositionChanged(int, int)), ScMW->CurrStED, SLOT(updateProps(int, int)));
ScMW->CurrStED->newAlign(ScMW->CurrStED->Editor->currentParaStyle);
se->Editor->getSelection(&PStart, &SelStart, &PEnd, &SelEnd);
se->Editor->insChars(RTextVal->text());
se->Editor->setSelection(PStart, SelStart, PEnd, SelEnd);
se->Editor->removeSelectedText();
se->Editor->setStyle(se->Editor->CurrentStyle);
se->Editor->insert(RTextVal->text());
connect(se->Editor, SIGNAL(cursorPositionChanged(int, int)), se, SLOT(updateProps(int, int)));
se->newAlign(se->Editor->currentParaStyle);
}
}
}
832,7 → 833,7
{
if (SMode)
{
ScMW->view->slotDoCurs(false);
Doc->view()->slotDoCurs(false);
Doc->DoDrawing = false;
}
do
844,8 → 845,8
if (SMode)
{
Doc->DoDrawing = true;
ScMW->view->slotDoCurs(true);
ScMW->view->RefreshItem(Item);
Doc->view()->slotDoCurs(true);
Doc->view()->RefreshItem(Item);
}
}
 
/branches/Version13x/Scribus/scribus/scplugin.h
16,6 → 16,7
#include "scribusapi.h"
 
class QWidget;
class ScribusDoc;
class ScribusMainWindow;
class DeferredTask;
class PrefsPanel;
287,7 → 288,7
* @returns bool True for success.
*
*/
virtual bool run(QString target = QString::null) = 0;
virtual bool run(ScribusDoc* doc, QString target = QString::null) = 0;
 
/**
* @brief Run the plugin on a QIODevice
304,7 → 305,7
* Remember that not all QIODevice*s are seekable, and try to write
* your code to handle a non-seekable stream.
*/
virtual bool run(QIODevice* target);
virtual bool run(ScribusDoc* doc, QIODevice* target);
 
/**
* @brief Run the plugin asynchronously
370,6 → 371,7
ActionInfo m_actionInfo;
// Obsolete - see runResult()
QString m_runResult;
ScribusDoc* m_Doc;
};
 
/**
/branches/Version13x/Scribus/scribus/effectsdialog.cpp
18,6 → 18,7
#include <qwidgetstack.h>
#include <qwidget.h>
#include <qslider.h>
#include "cmsettings.h"
#include "sccombobox.h"
#include "scribusdoc.h"
#include "shadebutton.h"
36,7 → 37,8
doc = docc;
currentOptions = 0;
bool mode = false;
image.LoadPicture(currItem->Pfile, "", 0, false, false, ScImage::RGBData, 72, &mode);
CMSettings cms(docc, "");
image.LoadPicture(currItem->Pfile, cms, 0, false, false, ScImage::RGBData, 72, &mode);
int ix = image.width();
int iy = image.height();
if ((ix > 220) || (iy > 220))
/branches/Version13x/Scribus/scribus/serializer.cpp
59,7 → 59,7
{
PageItem *nextItem;
PageItem *it = Item;
ScribusDoc* doku = it->document();
ScribusDoc* doku = it->doc();
if (!Append)
{
#if 0
/branches/Version13x/Scribus/scribus/page.cpp
291,33 → 291,33
if (!state)
return;
PageItem *ite = state->getItem();
bool oldMPMode=ScMW->doc->masterPageMode();
ScMW->doc->setMasterPageMode(!ite->OnMasterPage.isEmpty());
bool oldMPMode=m_Doc->masterPageMode();
m_Doc->setMasterPageMode(!ite->OnMasterPage.isEmpty());
if (isUndo)
{
if (ScMW->doc->m_Selection->findItem(ite)!=-1)
if (m_Doc->m_Selection->findItem(ite)!=-1)
{
if (ScMW->doc->appMode == modeEdit)
ScMW->setAppMode(modeNormal);
ScMW->doc->m_Selection->removeItem(ite);
if (m_Doc->appMode == modeEdit)
m_Doc->scMW()->setAppMode(modeNormal);
m_Doc->m_Selection->removeItem(ite);
}
Selection tempSelection(ScMW->doc, false);
Selection tempSelection(m_Doc, false);
tempSelection.addItem(ite);
ScMW->doc->itemSelection_DeleteItem(&tempSelection);
m_Doc->itemSelection_DeleteItem(&tempSelection);
/*
ScMW->doc->m_Selection->clear();
ScMW->doc->m_Selection->addItem(ite, true);
ScMW->doc->itemSelection_DeleteItem();
ScMW->doc->m_Selection->clear();
m_Doc->m_Selection->clear();
m_Doc->m_Selection->addItem(ite, true);
m_Doc->itemSelection_DeleteItem();
m_Doc->m_Selection->clear();
*/
}
else
{
ScMW->doc->Items->append(ite);
ite->ItemNr = ScMW->doc->Items->count()-1;
ScMW->view->updateContents();
m_Doc->Items->append(ite);
ite->ItemNr = m_Doc->Items->count()-1;
m_Doc->view()->updateContents();
}
ScMW->doc->setMasterPageMode(oldMPMode);
m_Doc->setMasterPageMode(oldMPMode);
}
 
void Page::restorePageItemDeletion(ItemState<PageItem*> *state, bool isUndo)
325,33 → 325,33
if (!state)
return;
PageItem *ite = state->getItem();
bool oldMPMode=ScMW->doc->masterPageMode();
ScMW->doc->setMasterPageMode(!ite->OnMasterPage.isEmpty());
bool oldMPMode=m_Doc->masterPageMode();
m_Doc->setMasterPageMode(!ite->OnMasterPage.isEmpty());
if (isUndo)
{
ScMW->doc->Items->append(ite);
ite->ItemNr = ScMW->doc->Items->count()-1;
ScMW->view->updateContents();
m_Doc->Items->append(ite);
ite->ItemNr = m_Doc->Items->count()-1;
m_Doc->view()->updateContents();
}
else
{
if (ScMW->doc->m_Selection->findItem(ite)!=-1)
if (m_Doc->m_Selection->findItem(ite)!=-1)
{
if (ScMW->doc->appMode == modeEdit)
ScMW->setAppMode(modeNormal);
ScMW->doc->m_Selection->removeItem(ite);
if (m_Doc->appMode == modeEdit)
m_Doc->scMW()->setAppMode(modeNormal);
m_Doc->m_Selection->removeItem(ite);
}
Selection tempSelection(ScMW->doc, false);
Selection tempSelection(m_Doc, false);
tempSelection.addItem(ite);
ScMW->doc->itemSelection_DeleteItem(&tempSelection);
m_Doc->itemSelection_DeleteItem(&tempSelection);
/*
ScMW->doc->m_Selection->clear();
ScMW->doc->m_Selection->addItem(ite, true);
ScMW->doc->itemSelection_DeleteItem();
ScMW->doc->m_Selection->clear();
m_Doc->m_Selection->clear();
m_Doc->m_Selection->addItem(ite, true);
m_Doc->itemSelection_DeleteItem();
m_Doc->m_Selection->clear();
*/
}
ScMW->doc->setMasterPageMode(oldMPMode);
m_Doc->setMasterPageMode(oldMPMode);
}
 
void Page::restorePageItemConversion(ItemState<std::pair<PageItem*, PageItem*> >*state, bool isUndo)
361,23 → 361,23
 
PageItem *oldItem=state->getItem().first;
PageItem *newItem=state->getItem().second;
bool oldMPMode=ScMW->doc->masterPageMode();
ScMW->doc->setMasterPageMode(!oldItem->OnMasterPage.isEmpty());
bool oldMPMode=m_Doc->masterPageMode();
m_Doc->setMasterPageMode(!oldItem->OnMasterPage.isEmpty());
if (isUndo)
{
ScMW->doc->Items->take(newItem->ItemNr);
ScMW->doc->Items->append(oldItem);
oldItem->ItemNr = ScMW->doc->Items->count()-1;
m_Doc->Items->take(newItem->ItemNr);
m_Doc->Items->append(oldItem);
oldItem->ItemNr = m_Doc->Items->count()-1;
oldItem->updatePolyClip();
ScMW->view->AdjustItemSize(oldItem);
m_Doc->view()->AdjustItemSize(oldItem);
}
else
{
ScMW->doc->Items->take(oldItem->ItemNr);
ScMW->doc->Items->append(newItem);
newItem->ItemNr = ScMW->doc->Items->count()-1;
m_Doc->Items->take(oldItem->ItemNr);
m_Doc->Items->append(newItem);
newItem->ItemNr = m_Doc->Items->count()-1;
}
ScMW->doc->setMasterPageMode(oldMPMode);
m_Doc->setMasterPageMode(oldMPMode);
}
 
void Page::setXOffset(const double newCanvasXOffset)
/branches/Version13x/Scribus/scribus/annot.cpp
7,12 → 7,14
#include "scfonts.h"
#include "annot.h"
#include "annot.moc"
#include "annotation.h"
#include "cmsettings.h"
#include "editor.h"
#include "selfield.h"
#include "customfdialog.h"
#include "buttonicon.h"
#include "annotation.h"
 
#include "mpalette.h"
#include "selfield.h"
#include <qstringlist.h>
#include <qdatetime.h>
#include <qpixmap.h>
353,9 → 355,10
{
QPixmap pmI1;
ScImage im;
CMSettings cms(view->Doc, "");
if (!item->Pfile.isEmpty())
{
im.LoadPicture(item->Pfile, "", 0, false, false, ScImage::RGBData, 72);
im.LoadPicture(item->Pfile, cms, 0, false, false, ScImage::RGBData, 72);
pmI1.convertFromImage(im.qImage());
NiconPrev->setPixmap(pmI1);
IconNR->setEnabled(true);
362,7 → 365,7
}
if (!item->Pfile2.isEmpty())
{
im.LoadPicture(item->Pfile2, "", 0, false, false, ScImage::RGBData, 72);
im.LoadPicture(item->Pfile2, cms, 0, false, false, ScImage::RGBData, 72);
pmI1.convertFromImage(im.qImage());
PiconPrev->setPixmap(pmI1);
IconPR->setEnabled(true);
369,7 → 372,7
}
if (!item->Pfile3.isEmpty())
{
im.LoadPicture(item->Pfile3, "", 0, false, false, ScImage::RGBData, 72);
im.LoadPicture(item->Pfile3, cms, 0, false, false, ScImage::RGBData, 72);
pmI1.convertFromImage(im.qImage());
RiconPrev->setPixmap(pmI1);
IconRR->setEnabled(true);
1204,7 → 1207,8
{
dirs->set("icon", fileName.left(fileName.findRev("/")));
QPixmap pmI1;
item->pixm.LoadPicture(fileName, "", 0, false, false, ScImage::RGBData, 72);
CMSettings cms(view->Doc, "");
item->pixm.LoadPicture(fileName, cms, 0, false, false, ScImage::RGBData, 72);
pmI1.convertFromImage(item->pixm.qImage());
NiconPrev->setPixmap(pmI1);
item->Pfile = fileName;
1235,7 → 1239,8
dirs->set("icon", fileName.left(fileName.findRev("/")));
QPixmap pmI1;
ScImage im;
im.LoadPicture(fileName, "", 0, false, false, ScImage::RGBData, 72);
CMSettings cms(view->Doc, "");
im.LoadPicture(fileName, cms, 0, false, false, ScImage::RGBData, 72);
pmI1.convertFromImage(im.qImage());
PiconPrev->setPixmap(pmI1);
item->Pfile2 = fileName;
1258,7 → 1263,8
dirs->set("icon", fileName.left(fileName.findRev("/")));
QPixmap pmI1;
ScImage im;
im.LoadPicture(fileName, "", 0, false, false, ScImage::RGBData, 72);
CMSettings cms(view->Doc, "");
im.LoadPicture(fileName, cms, 0, false, false, ScImage::RGBData, 72);
pmI1.convertFromImage(im.qImage());
RiconPrev->setPixmap(pmI1);
item->Pfile3 = fileName;
/branches/Version13x/Scribus/scribus/reformdoc.cpp
977,7 → 977,7
tabColorManagement->setValues();
if (tabColorManagement->changed)
{
ScMW->mainWindowStatusLabel->setText( tr("Adjusting Colors"));
ScMW->setStatusBarInfoText( tr("Adjusting Colors"));
ScMW->mainWindowProgressBar->reset();
int cc = currDoc->PageColors.count() + currDoc->Items->count();
ScMW->mainWindowProgressBar->setTotalSteps(cc);
1046,7 → 1046,7
#endif
ScMW->mainWindowProgressBar->setProgress(cc);
qApp->setOverrideCursor(QCursor(arrowCursor), true);
ScMW->mainWindowStatusLabel->setText("");
ScMW->setStatusBarInfoText("");
ScMW->mainWindowProgressBar->reset();
}
}
/branches/Version13x/Scribus/scribus/collect4output.cpp
7,7 → 7,7
#include "collect4output.h"
#include "collect4output.moc"
 
#include "scribus.h"
#include "scribusdoc.h"
#include "scribuscore.h"
#include "util.h"
#include "prefscontext.h"
25,9 → 25,11
#include <qmap.h>
#include <qdir.h>
 
CollectForOutput::CollectForOutput(bool withFonts, bool compressDoc)
: QObject(ScCore, 0)
CollectForOutput::CollectForOutput(ScribusDoc* doc, bool withFonts, bool compressDoc)
: QObject(ScCore, 0),
m_Doc(0)
{
m_Doc=doc;
outputDirectory = QString();
compressDoc = compressDoc;
withFonts = withFonts;
46,7 → 48,7
wdir = dirs->get("collect", prefsDocDir);
else
wdir = dirs->get("collect", ".");
outputDirectory = ScMW->CFileDialog(wdir, tr("Choose a Directory"), "", "", false, false, false, false, true, &compressDoc, &withFonts);
outputDirectory = ScCore->primaryMainWindow()->CFileDialog(wdir, tr("Choose a Directory"), "", "", false, false, false, false, true, &compressDoc, &withFonts);
}
if (outputDirectory.isEmpty())
return false;
62,11 → 64,11
ScCore->fileWatcher->forceScan();
ScCore->fileWatcher->stop();
dirs->set("collect", outputDirectory.left(outputDirectory.findRev("/",-2)));
ScMW->mainWindowStatusLabel->setText(tr("Collecting..."));
ScCore->primaryMainWindow()->setStatusBarInfoText(tr("Collecting..."));
 
if (!collectItems())
{
QMessageBox::warning(ScMW, CommonStrings::trWarning,
QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning,
"<qt>" + tr("Cannot collect all files for output for file:\n%1").arg(newName) + "</qt>",
CommonStrings::tr_OK);
return "";
79,18 → 81,18
in collectItems() */
if (!collectDocument())
{
QMessageBox::warning(ScMW, CommonStrings::trWarning, "<qt>" + tr("Cannot collect the file: \n%1").arg(newName) + "</qt>", CommonStrings::tr_OK);
QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, "<qt>" + tr("Cannot collect the file: \n%1").arg(newName) + "</qt>", CommonStrings::tr_OK);
return "";
}
 
QDir::setCurrent(outputDirectory);
ScMW->updateActiveWindowCaption(newName);
ScCore->primaryMainWindow()->updateActiveWindowCaption(newName);
UndoManager::instance()->renameStack(newName);
ScMW->scrActions["fileSave"]->setEnabled(false);
ScMW->scrActions["fileRevert"]->setEnabled(false);
ScMW->updateRecent(newName);
ScMW->mainWindowStatusLabel->setText("");
ScMW->mainWindowProgressBar->reset();
ScCore->primaryMainWindow()->scrActions["fileSave"]->setEnabled(false);
ScCore->primaryMainWindow()->scrActions["fileRevert"]->setEnabled(false);
ScCore->primaryMainWindow()->updateRecent(newName);
ScCore->primaryMainWindow()->setStatusBarInfoText("");
ScCore->primaryMainWindow()->mainWindowProgressBar->reset();
ScCore->fileWatcher->start();
collectedFiles.clear();
return newName;
105,15 → 107,15
if (!fi.isDir() || !fi.isWritable())
return false;
 
if (ScMW->doc->hasName)
if (m_Doc->hasName)
{
QFileInfo fis(ScMW->doc->DocName);
QFileInfo fis(m_Doc->DocName);
newName += fis.fileName();
}
else
newName += ScMW->doc->DocName+".sla";
newName += m_Doc->DocName+".sla";
 
ScMW->doc->hasName = true;
m_Doc->hasName = true;
if (compressDoc)
{
if (!newName.endsWith(".gz"))
125,9 → 127,9
}
}
 
if (!overwrite(ScMW, newName))
if (!overwrite(ScCore->primaryMainWindow(), newName))
return false;
if (!ScMW->DoFileSave(newName))
if (!ScCore->primaryMainWindow()->DoFileSave(newName))
return false;
return true;
}
141,13 → 143,13
switch (lc)
{
case 0:
counter = ScMW->doc->MasterItems.count();
counter = m_Doc->MasterItems.count();
break;
case 1:
counter = ScMW->doc->DocItems.count();
counter = m_Doc->DocItems.count();
break;
case 2:
counter = ScMW->doc->FrameItems.count();
counter = m_Doc->FrameItems.count();
break;
}
for (uint b = 0; b < counter; ++b)
155,13 → 157,13
switch (lc)
{
case 0:
ite = ScMW->doc->MasterItems.at(b);
ite = m_Doc->MasterItems.at(b);
break;
case 1:
ite = ScMW->doc->DocItems.at(b);
ite = m_Doc->DocItems.at(b);
break;
case 2:
ite = ScMW->doc->FrameItems.at(b);
ite = m_Doc->FrameItems.at(b);
break;
}
if (ite->asImageFrame())
179,7 → 181,7
{
QString oldFile = ofName;
ite->Pfile = collectFile(oldFile, itf.fileName());
if (ScMW->fileWatcherActive())
if (ScCore->fileWatcherActive())
{
ScCore->fileWatcher->removeFile(oldFile);
ScCore->fileWatcher->addFile(ite->Pfile);
198,7 → 200,7
{
QString oldFile = ite->Pfile;
ite->Pfile = collectFile(oldFile, itf.fileName());
if (ScMW->fileWatcherActive())
if (ScCore->fileWatcherActive())
{
ScCore->fileWatcher->removeFile(oldFile);
ScCore->fileWatcher->addFile(ite->Pfile);
228,8 → 230,8
{
PrefsManager *prefsManager = PrefsManager::instance();
QMap<QString,int>::Iterator it3;
QMap<QString,int>::Iterator it3end = ScMW->doc->UsedFonts.end();
for (it3 = ScMW->doc->UsedFonts.begin(); it3 != it3end; ++it3)
QMap<QString,int>::Iterator it3end = m_Doc->UsedFonts.end();
for (it3 = m_Doc->UsedFonts.begin(); it3 != it3end; ++it3)
{
QFileInfo itf = QFileInfo(prefsManager->appPrefs.AvailFonts[it3.key()]->fontFilePath());
copyFile(prefsManager->appPrefs.AvailFonts[it3.key()]->fontFilePath(), outputDirectory + itf.fileName());
/branches/Version13x/Scribus/scribus/pdflib.cpp
115,7 → 115,7
KeyGen[a] = kg_array[a];
if (usingGUI)
{
progressDialog = new MultiProgressDialog(tr("Saving PDF"), CommonStrings::tr_Cancel, ScMW, "pdfexportprogress");
progressDialog = new MultiProgressDialog(tr("Saving PDF"), CommonStrings::tr_Cancel, doc.scMW(), "pdfexportprogress");
Q_CHECK_PTR(progressDialog);
QStringList barNames, barTexts;
barNames << "EMP" << "EP" << "ECPI";
149,7 → 149,7
QMap<QString, QMap<uint, FPointArray> > usedFonts;
usedFonts.clear();
doc.getUsedFonts(usedFonts);
if (PDF_Begin_Doc(fn, PrefsManager::instance()->appPrefs.AvailFonts, usedFonts, ScMW->bookmarkPalette->BView))
if (PDF_Begin_Doc(fn, PrefsManager::instance()->appPrefs.AvailFonts, usedFonts, doc.scMW()->bookmarkPalette->BView))
{
QMap<int, int> pageNsMpa;
for (uint a = 0; a < pageNs.size(); ++a)
4288,7 → 4288,8
}
if (!ite->Pfile2.isEmpty())
{
img.LoadPicture(ite->Pfile2, "", 0, false, false, ScImage::RGBData, 72);
CMSettings cms(ite->doc(), "");
img.LoadPicture(ite->Pfile2, cms, 0, false, false, ScImage::RGBData, 72);
QByteArray im;
im = img3.getAlpha(ite->Pfile2, true, false);
IconOb += !im.isEmpty() ? 3 : 2;
4297,7 → 4298,8
}
if (!ite->Pfile3.isEmpty())
{
img2.LoadPicture(ite->Pfile3, "", 0, false, false, ScImage::RGBData, 72);
CMSettings cms(ite->doc(), "");
img2.LoadPicture(ite->Pfile3, cms, 0, false, false, ScImage::RGBData, 72);
QByteArray im;
im = img3.getAlpha(ite->Pfile3, true, false);
IconOb += !im.isEmpty() ? 3 : 2;
4751,20 → 4753,21
afl = Options.Resolution;
if (ext == "pdf")
{
CMSettings cms(c->doc(), Profil);
if (Options.UseRGB)
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RGBProof, afl);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RGBProof, afl);
else
{
#ifdef HAVE_CMS
if ((CMSuse) && (Options.UseProfiles2))
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RGBData, afl);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RGBData, afl);
else
{
#endif
if (Options.isGrayscale)
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RGBData, afl);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RGBData, afl);
else
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::CMYKData, afl);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::CMYKData, afl);
#ifdef HAVE_CMS
}
#endif
4805,20 → 4808,21
f.close();
if (found)
{
CMSettings cms(c->doc(), Profil);
if (Options.UseRGB)
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RGBProof, afl);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RGBProof, afl);
else
{
#ifdef HAVE_CMS
if ((CMSuse) && (Options.UseProfiles2))
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RGBData, afl);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RGBData, afl);
else
{
#endif
if (Options.isGrayscale)
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RGBData, afl);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RGBData, afl);
else
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::CMYKData, afl);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::CMYKData, afl);
#ifdef HAVE_CMS
}
#endif
4840,20 → 4844,21
img.imgInfo.layerInfo.clear();
img.imgInfo.RequestProps = c->pixm.imgInfo.RequestProps;
img.imgInfo.isRequest = c->pixm.imgInfo.isRequest;
CMSettings cms(c->doc(), Profil);
if (Options.UseRGB)
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RGBProof, 72, &realCMYK);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RGBProof, 72, &realCMYK);
else
{
#ifdef HAVE_CMS
if ((CMSuse) && (Options.UseProfiles2))
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RawData, 72, &realCMYK);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RawData, 72, &realCMYK);
else
{
#endif
if (Options.isGrayscale)
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::RGBData, 72, &realCMYK);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::RGBData, 72, &realCMYK);
else
img.LoadPicture(fn, Profil, Intent, Embedded, true, ScImage::CMYKData, 72, &realCMYK);
img.LoadPicture(fn, cms, Intent, Embedded, true, ScImage::CMYKData, 72, &realCMYK);
#ifdef HAVE_CMS
}
#endif
4964,7 → 4969,7
else
imgE = true;
}
img.applyEffect(c->effectsInUse, c->document()->PageColors, imgE);
img.applyEffect(c->effectsInUse, c->doc()->PageColors, imgE);
if (!((Options.RecalcPic) && (Options.PicRes < (QMAX(72.0 / c->imageXScale(), 72.0 / c->imageYScale())))))
{
sxn = sx * (1.0 / aufl);
/branches/Version13x/Scribus/scribus/scribusdoc.cpp
98,6 → 98,8
docUnitRatio(unitGetRatioFromIndex(docUnitIndex)),
automaticTextFrames(0),
m_masterPageMode(false),
m_ScMW(0),
m_View(0),
is12doc(false),
NrItems(0),
First(1), Last(0),
181,11 → 183,10
docToCSetups(prefsData.defaultToCSetups),
// sections
symReturn(), symNewLine(), symTab(), symNonBreak(), symNewCol(), symNewFrame(),
docHyphenator(new Hyphenator(ScMW, this)), // MUST be constructed late
docHyphenator(0),
_itemCreationTransactionStarted(false)
{
Q_CHECK_PTR(m_Selection);
Q_CHECK_PTR(docHyphenator);
Q_CHECK_PTR(autoSaveTimer);
 
AddFont(prefsData.toolSettings.defFont);//, prefsData.AvailFonts[prefsData.toolSettings.defFont]->Font);
416,6 → 417,14
}
}
 
void ScribusDoc::setGUI(ScribusMainWindow* mw, ScribusView* view)
{
m_ScMW=mw;
m_View=view;
docHyphenator=new Hyphenator(m_ScMW, this);
Q_CHECK_PTR(docHyphenator);
}
 
void ScribusDoc::setLoading(const bool docLoading)
{
loading = docLoading;
428,7 → 437,8
 
ScribusView* ScribusDoc::view() const
{
return (WinHan ? (((ScribusWin*) WinHan)->view()) : 0);
// return (WinHan ? (((ScribusWin*) WinHan)->view()) : 0);
return m_View;
}
 
void ScribusDoc::CloseCMSProfiles()
498,7 → 508,7
CMSSettings.CMSinUse = CMSuse = false;
QString message = tr("An error occurred while opening icc profiles, color management is not enabled." );
if (ScCore->usingGUI())
QMessageBox::warning(ScMW, CommonStrings::trWarning, message, QMessageBox::Ok, 0, 0);
QMessageBox::warning(m_ScMW, CommonStrings::trWarning, message, QMessageBox::Ok, 0, 0);
else
qWarning( "%s", message.local8Bit().data() );
return false;
784,8 → 794,8
{
if (ScCore->usingGUI())
{
ScMW->changeLayer(ss->getInt("ACTIVE"));
ScMW->layerPalette->rebuildList();
m_ScMW->changeLayer(ss->getInt("ACTIVE"));
m_ScMW->layerPalette->rebuildList();
}
}
}
1422,6 → 1432,8
break;
}
}
if (found)
changed();
return found;
}
 
1451,6 → 1463,8
break;
}
}
if (found)
changed();
return found;
}
 
1480,6 → 1494,8
break;
}
}
if (found)
changed();
return found;
}
 
1509,6 → 1525,8
break;
}
}
if (found)
changed();
return found;
}
 
1538,6 → 1556,8
break;
}
}
if (found)
changed();
return found;
}
 
1567,6 → 1587,8
break;
}
}
if (found)
changed();
return found;
}
 
1596,6 → 1618,8
break;
}
}
if (found)
changed();
return found;
}
 
1625,6 → 1649,8
break;
}
}
if (found)
changed();
return found;
}
 
1774,6 → 1800,8
break;
}
}
if (found)
changed();
return found;
}
 
2305,7 → 2333,7
QProgressBar* mainWindowProgressBar=NULL;
if (ScCore->usingGUI())
{
mainWindowProgressBar=ScMW->mainWindowProgressBar;
mainWindowProgressBar=m_ScMW->mainWindowProgressBar;
mainWindowProgressBar->reset();
}
FileLoader fl(fileName);
2481,7 → 2509,7
BufferT.Groups.push((*nx));
}
}
ScMW->view->PasteItem(&BufferT, true, true);
m_View->PasteItem(&BufferT, true, true);
PageItem* newItem = Items->at(Items->count()-1);
newItem->OnMasterPage = masterPageName;
newItem->OwnPage=MasterNames[masterPageName];
2683,7 → 2711,7
newItem->SetRectFrame();
//TODO one day hopefully, if(ScCore->usingGUI())
newItem->setRedrawBounding();
//ScMW->view->setRedrawBounding(newItem);
//m_View->setRedrawBounding(newItem);
newItem->ContourLine = newItem->PoLine.copy();
}
 
2692,7 → 2720,7
newItem->SetOvalFrame();
//TODO one day hopefully, if(ScCore->usingGUI())
newItem->setRedrawBounding();
//ScMW->view->setRedrawBounding(newItem);
//m_View->setRedrawBounding(newItem);
newItem->ContourLine = newItem->PoLine.copy();
}
 
2765,7 → 2793,7
{
//TODO: Make this a signal again one day
//emit RasterPic(pageItem->isRaster);
ScMW->HaveRaster(pageItem->isRaster);
m_ScMW->HaveRaster(pageItem->isRaster);
//TODO: Previously commented out.. unsure why, remove later
//emit UpdtObj(PageNr, ItNr);
changed();
3159,7 → 3187,7
polyLineItem->FrameType = 3;
polyLineItem->setRotation(currItem->rotation());
polyLineItem->setPolyClip(qRound(QMAX(polyLineItem->lineWidth() / 2, 1)));
ScMW->view->AdjustItemSize(polyLineItem);
view()->AdjustItemSize(polyLineItem);
 
newItem->setLineColor(CommonStrings::None);
newItem->SetRectFrame();
3189,7 → 3217,7
newItem->convertTo(PageItem::PolyLine);
newItem->ClipEdited = true;
newItem->setPolyClip(qRound(QMAX(newItem->lineWidth() / 2, 1)));
ScMW->view->AdjustItemSize(newItem);
m_View->AdjustItemSize(newItem);
break;
case PageItem::PathText:
{
3205,11 → 3233,11
/* if (!Doc->loading)
emit UpdtObj(Doc->currentPage->pageNr(), b->ItemNr); */
//FIXME: Stop using the view here
ScMW->view->AdjustItemSize(newItem);
m_View->AdjustItemSize(newItem);
newItem->updatePolyClip();
double dx = secondaryItem->xPos() - newItem->xPos();
double dy = secondaryItem->yPos() - newItem->yPos();
ScMW->view->MoveItem(dx, dy, newItem);
m_View->MoveItem(dx, dy, newItem);
newItem->setRotation(secondaryItem->rotation());
newItem->FrameType = 3;
}
3231,10 → 3259,10
if (newType==PageItem::PathText)
{
//FIXME: Stop using the view here
ScMW->view->SelectItem(secondaryItem);
m_View->SelectItem(secondaryItem);
itemSelection_DeleteItem();
emit updateContents();
ScMW->view->Deselect(true);
m_View->Deselect(true);
}
//Create the undo action for the new item
if (UndoManager::undoEnabled())
3510,7 → 3538,7
destination->initialMargins.Bottom = from->Margins.Bottom;
destination->initialMargins.Left = from->Margins.Left;
destination->initialMargins.Right = from->Margins.Right;
ScMW->view->reformPages();
m_View->reformPages();
QMap<int,int> TableID;
QPtrList<PageItem> TableItems;
TableID.clear();
3544,11 → 3572,11
Buffer.Groups.push((*nx));
}
}
ScMW->view->PasteItem(&Buffer, true, true);
m_View->PasteItem(&Buffer, true, true);
PageItem* Neu = Items->at(Items->count()-1);
Neu->OnMasterPage = "";
if (itemToCopy->isBookmark)
ScMW->AddBookMark(Neu);
m_ScMW->AddBookMark(Neu);
if (Neu->isTableItem)
{
TableItems.append(Neu);
3990,7 → 4018,7
if (currItem->asPathText())
{
currItem->updatePolyClip();
ScMW->view->AdjustItemSize(currItem);
view()->AdjustItemSize(currItem);
}
/* if (!Doc->loading)
emit UpdtObj(Doc->currentPage->pageNr(), currItem->ItemNr); */
4752,7 → 4780,7
{
SimpleState *ss = new SimpleState(s > 4 ? Um::SetStyle : Um::AlignText, "", Um::IFont);
ss->set("PSTYLE", "pstyle");
int oldPStyle = findParagraphStyle(currItem->document(), currItem->currentStyle());
int oldPStyle = findParagraphStyle(currItem->doc(), currItem->currentStyle());
ss->set("OLD_STYLE", oldPStyle);
ss->set("NEW_STYLE", s);
undoManager->action(currItem, ss);
4820,7 → 4848,7
#else
ParagraphStyle newPStyle;
if (s > 4) {
newPStyle.setParent( & currItem->document()->docParagraphStyles[s] );
newPStyle.setParent( & currItem->doc()->docParagraphStyles[s] );
}
else {
newPStyle.setAlignment(s);
4849,25 → 4877,25
if (appMode == modeEdit)
{
const ParagraphStyle& pstyle(currItem->currentStyle());
ScMW->view->horizRuler->setItem(currItem);
view()->horizRuler->setItem(currItem);
if (currItem->lineColor() != CommonStrings::None)
ScMW->view->horizRuler->lineCorr = currItem->lineWidth() / 2.0;
m_View->horizRuler->lineCorr = currItem->lineWidth() / 2.0;
else
ScMW->view->horizRuler->lineCorr = 0;
ScMW->view->horizRuler->ColGap = currItem->ColGap;
ScMW->view->horizRuler->Cols = currItem->Cols;
ScMW->view->horizRuler->Extra = currItem->textToFrameDistLeft();
ScMW->view->horizRuler->RExtra = currItem->textToFrameDistRight();
ScMW->view->horizRuler->First = pstyle.firstIndent();
ScMW->view->horizRuler->Indent = pstyle.leftMargin();
m_View->horizRuler->lineCorr = 0;
m_View->horizRuler->ColGap = currItem->ColGap;
m_View->horizRuler->Cols = currItem->Cols;
m_View->horizRuler->Extra = currItem->textToFrameDistLeft();
m_View->horizRuler->RExtra = currItem->textToFrameDistRight();
m_View->horizRuler->First = pstyle.firstIndent();
m_View->horizRuler->Indent = pstyle.leftMargin();
double columnWidth = (currItem->width() - (currItem->columnGap() * (currItem->columns() - 1))
- currItem->textToFrameDistLeft() - currItem->textToFrameDistLeft()
- 2*ScMW->view->horizRuler->lineCorr) / currItem->columns();
ScMW->view->horizRuler->RMargin = columnWidth - pstyle.rightMargin();
ScMW->view->horizRuler->Revers = (currItem->imageFlippedH() || (currItem->reversed()));
ScMW->view->horizRuler->ItemPosValid = true;
ScMW->view->horizRuler->TabValues = pstyle.tabValues();
ScMW->view->horizRuler->repaint();
- 2*m_View->horizRuler->lineCorr) / currItem->columns();
m_View->horizRuler->RMargin = columnWidth - pstyle.rightMargin();
m_View->horizRuler->Revers = (currItem->imageFlippedH() || (currItem->reversed()));
m_View->horizRuler->ItemPosValid = true;
m_View->horizRuler->TabValues = pstyle.tabValues();
m_View->horizRuler->repaint();
}
}
 
5004,7 → 5032,7
if (currItem->asPathText())
{
currItem->updatePolyClip();
ScMW->view->AdjustItemSize(currItem);
view()->AdjustItemSize(currItem);
}
emit refreshItem(currItem);
}
5043,7 → 5071,7
if (currItem->asPathText())
{
currItem->updatePolyClip();
ScMW->view->AdjustItemSize(currItem);
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
}
5134,7 → 5162,7
*/
currItem->ClipEdited = true;
QWMatrix ma;
if (ScMW->view->EditContour)
if (view()->EditContour)
{
if (UndoManager::undoEnabled())
{
5153,7 → 5181,7
currItem->Tinput = true;
currItem->paintObj();
currItem->FrameOnly = false;
ScMW->view->MarkClip(currItem, currItem->ContourLine, true);
m_View->MarkClip(currItem, currItem->ContourLine, true);
changed();
return;
}
5198,7 → 5226,7
*/
currItem->ClipEdited = true;
QWMatrix ma;
if (ScMW->view->EditContour)
if (view()->EditContour)
{
if (UndoManager::undoEnabled())
{
5217,7 → 5245,7
currItem->Tinput = true;
currItem->paintObj();
currItem->FrameOnly = false;
ScMW->view->MarkClip(currItem, currItem->ContourLine, true);
m_View->MarkClip(currItem, currItem->ContourLine, true);
changed();
return;
}
5275,7 → 5303,7
|| (newMinX != minCanvasCoordinate.x()) || (newMinY != minCanvasCoordinate.y()))
{
//CB TODO Make a list of views we belong to and make this the doc's active view via an internal*
if (ScCore->usingGUI() && !ScMW->view->operItemMoving)
if (ScCore->usingGUI() && !m_View->operItemMoving)
{
//Save the old values for the emit, but update now to ensure we are all ready
double oldMinX=minCanvasCoordinate.x();
5291,9 → 5319,9
{
if (ScCore->usingGUI())
{
connect(this, SIGNAL(setApplicationMode(int)), ScMW, SLOT(setAppMode(int)));
connect(this, SIGNAL(docChanged()), ScMW, SLOT(slotDocCh()));
connect(this, SIGNAL(firstSelectedItemType(int)), ScMW, SLOT(HaveNewSel(int)));
connect(this, SIGNAL(setApplicationMode(int)), m_ScMW, SLOT(setAppMode(int)));
connect(this, SIGNAL(docChanged()), m_ScMW, SLOT(slotDocCh()));
connect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel(int)));
connect(autoSaveTimer, SIGNAL(timeout()), WinHan, SLOT(slotAutoSave()));
connect(this, SIGNAL(refreshItem(PageItem*)), view(), SLOT(RefreshItem(PageItem*)));
connect(this, SIGNAL(updateContents()), view(), SLOT(slotUpdateContents()));
5458,7 → 5486,7
//TODO replace with the ScribusDoc::deleteTaggedItems
void ScribusDoc::removeLayer(int l, bool dl)
{
ScMW->view->Deselect();
m_View->Deselect();
for (uint b = 0; b < MasterItems.count(); ++b)
{
if (MasterItems.at(b)->LayerNr == l)
5491,8 → 5519,8
if (m_Selection->count() != 0)
itemSelection_DeleteItem();
//FIXME signal these
ScMW->rebuildLayersList();
ScMW->view->updateLayerMenu();
m_ScMW->rebuildLayersList();
m_View->updateLayerMenu();
}
 
void ScribusDoc::itemSelection_ToggleLock( )
5554,7 → 5582,7
if (imageItem==NULL)
continue;
imageItem->setImageShown(!imageItem->imageShown());
ScMW->scrActions["itemImageIsVisible"]->setOn(imageItem->imageShown());
m_ScMW->scrActions["itemImageIsVisible"]->setOn(imageItem->imageShown());
emit refreshItem(imageItem);
}
changed();
5731,15 → 5759,15
if (!found) //No image frames in the current selection!
return;
updatePic();
disconnect( ScMW->scrActions["itemPreviewLow"], SIGNAL(activatedData(int)) , 0, 0 );
disconnect( ScMW->scrActions["itemPreviewNormal"], SIGNAL(activatedData(int)) , 0, 0 );
disconnect( ScMW->scrActions["itemPreviewFull"], SIGNAL(activatedData(int)) , 0, 0 );
ScMW->scrActions["itemPreviewLow"]->setOn(id==ScMW->scrActions["itemPreviewLow"]->actionInt());
ScMW->scrActions["itemPreviewNormal"]->setOn(id==ScMW->scrActions["itemPreviewNormal"]->actionInt());
ScMW->scrActions["itemPreviewFull"]->setOn(id==ScMW->scrActions["itemPreviewFull"]->actionInt());
connect( ScMW->scrActions["itemPreviewLow"], SIGNAL(activatedData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) );
connect( ScMW->scrActions["itemPreviewNormal"], SIGNAL(activatedData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) );
connect( ScMW->scrActions["itemPreviewFull"], SIGNAL(activatedData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) );
disconnect( m_ScMW->scrActions["itemPreviewLow"], SIGNAL(activatedData(int)) , 0, 0 );
disconnect( m_ScMW->scrActions["itemPreviewNormal"], SIGNAL(activatedData(int)) , 0, 0 );
disconnect( m_ScMW->scrActions["itemPreviewFull"], SIGNAL(activatedData(int)) , 0, 0 );
m_ScMW->scrActions["itemPreviewLow"]->setOn(id==m_ScMW->scrActions["itemPreviewLow"]->actionInt());
m_ScMW->scrActions["itemPreviewNormal"]->setOn(id==m_ScMW->scrActions["itemPreviewNormal"]->actionInt());
m_ScMW->scrActions["itemPreviewFull"]->setOn(id==m_ScMW->scrActions["itemPreviewFull"]->actionInt());
connect( m_ScMW->scrActions["itemPreviewLow"], SIGNAL(activatedData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) );
connect( m_ScMW->scrActions["itemPreviewNormal"], SIGNAL(activatedData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) );
connect( m_ScMW->scrActions["itemPreviewFull"], SIGNAL(activatedData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) );
}
}
 
5764,7 → 5792,7
{
if (currItem->itemText.length() != 0 && (currItem->NextBox == 0 || currItem->BackBox == 0))
{
int t = ScMessageBox::warning(ScMW, CommonStrings::trWarning,
int t = ScMessageBox::warning(m_ScMW, CommonStrings::trWarning,
tr("Do you really want to clear all your text?"),
QMessageBox::Yes, QMessageBox::No | QMessageBox::Default);
if (t == QMessageBox::No)
5801,9 → 5829,9
continue;
}
//CB FIXME remove this and include of story.h too
if ((currItem->asTextFrame() || currItem->asPathText()) && currItem==ScMW->storyEditor->currentItem() && this==ScMW->storyEditor->currentDocument())
if ((currItem->asTextFrame() || currItem->asPathText()) && currItem==m_ScMW->storyEditor->currentItem() && this==m_ScMW->storyEditor->currentDocument())
{
QMessageBox::critical(ScMW, tr("Cannot Delete In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The delete operation will be cancelled").arg(currItem->itemName()), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
QMessageBox::critical(m_ScMW, tr("Cannot Delete In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The delete operation will be cancelled").arg(currItem->itemName()), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
return;
}
tooltip += "\t" + currItem->getUName() + "\n";
5856,7 → 5884,7
}
if (currItem->isBookmark)
//CB From view emit DelBM(currItem);
ScMW->DelBookMark(currItem);
m_ScMW->DelBookMark(currItem);
Items->remove(currItem);
delItems.removeLast();
// send the undo action to the UndoManager
5883,7 → 5911,7
updateContents();
qApp->setOverrideCursor(QCursor(ArrowCursor), true);
//CB FIXME remove this and tree.h too
ScMW->outlinePalette->BuildTree();
m_ScMW->outlinePalette->BuildTree();
 
if (itemSelection->isGUISelection())
{
5971,7 → 5999,7
docHyphenator->slotNewDict(currItem->itemText.charStyle(0).language());
docHyphenator->slotHyphenate(currItem);
}
ScMW->view->DrawNew(); //CB draw new until NLS for redraw through text chains
m_View->DrawNew(); //CB draw new until NLS for redraw through text chains
changed();
}
}
5986,7 → 6014,7
PageItem *currItem = m_Selection->itemAt(i);
docHyphenator->slotDeHyphenate(currItem);
}
ScMW->view->DrawNew(); //CB draw new until NLS for redraw through text chains
m_View->DrawNew(); //CB draw new until NLS for redraw through text chains
changed();
}
}
6016,7 → 6044,7
 
//CB why not just the following as we are calling for updatecontents anyway and we arent reflowing text
//Doc->m_Selection->clear();
ScMW->view->Deselect(true);
m_View->Deselect(true);
emit updateContents();
changed();
}
6045,7 → 6073,7
s > 4 ? Um::SetStyle : Um::AlignText,
tooltip,
Um::IFont);
ScMW->view->DrawNew(); //CB draw new until NLS for redraw through text chains
view()->DrawNew(); //CB draw new until NLS for redraw through text chains
}
}
 
6235,7 → 6263,7
int t = 2;
if (oneLocked)
{
t = ScMessageBox::warning(ScMW, CommonStrings::trWarning, tr("Some objects are locked."),
t = ScMessageBox::warning(m_ScMW, CommonStrings::trWarning, tr("Some objects are locked."),
tr("&Unlock All"), tr("&Skip locked objects"), CommonStrings::tr_Cancel, 0, 0);
if (t == 2)
return false;
6259,11 → 6287,11
void ScribusDoc::endAlign()
{
changed();
ScMW->HaveNewSel(m_Selection->itemAt(0)->itemType());
m_ScMW->HaveNewSel(m_Selection->itemAt(0)->itemType());
for (uint i = 0; i < m_Selection->count(); ++i)
setRedrawBounding(m_Selection->itemAt(i));
undoManager->commit(); // commit and send the action to the UndoManager
ScMW->view->updateContents();
m_View->updateContents();
}
 
 
7065,5 → 7093,6
void ScribusDoc::setCurrentPage(Page *newPage)
{
_currentPage = newPage;
ScMW->guidePalette->setupPage();
if (m_ScMW)
m_ScMW->guidePalette->setupPage();
}
/branches/Version13x/Scribus/scribus/prefsmanager.cpp
42,7 → 42,7
#include "scfonts.h"
#include "scmessagebox.h"
#include "scpaths.h"
#include "scribus.h"
#include "scribuscore.h"
#include "scribusstructs.h"
#include "scribuscore.h"
#include "gsutil.h"
625,7 → 625,7
bool splashShown=ScCore->splashShowing();
if (splashShown)
ScCore->showSplash(false);
if ( (ScMessageBox::question( ScMW, tr("Migrate Old Scribus Settings?"),
if ( (ScMessageBox::question( ScCore->primaryMainWindow(), tr("Migrate Old Scribus Settings?"),
tr("Scribus has detected existing Scribus 1.2 preferences files.\n"
"Do you want to migrate them to the new Scribus version?"),
QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::NoButton))==QMessageBox::Yes )
705,7 → 705,7
mw->move(appPrefs.mainWinSettings.xPosition, appPrefs.mainWinSettings.yPosition);
mw->resize(appPrefs.mainWinSettings.width, appPrefs.mainWinSettings.height);
if (appPrefs.mainWinSettings.maximized)
mw->setWindowState(ScMW->windowState() & ~Qt::WindowMinimized | Qt::WindowMaximized);
mw->setWindowState(ScCore->primaryMainWindow()->windowState() & ~Qt::WindowMinimized | Qt::WindowMaximized);
ReadPrefsXML();
if (appPrefs.checkerProfiles.count() == 0)
{
735,19 → 735,19
// The caller is responsible for ensuring we aren't called under those
// conditions.
Q_ASSERT(!emergencyActivated);
appPrefs.mainWinSettings.xPosition = abs(ScMW->pos().x());
appPrefs.mainWinSettings.yPosition = abs(ScMW->pos().y());
appPrefs.mainWinSettings.width = ScMW->size().width();
appPrefs.mainWinSettings.height = ScMW->size().height();
appPrefs.mainWinSettings.maximized = ScMW->isMaximized();
appPrefs.mainWinSettings.xPosition = abs(ScCore->primaryMainWindow()->pos().x());
appPrefs.mainWinSettings.yPosition = abs(ScCore->primaryMainWindow()->pos().y());
appPrefs.mainWinSettings.width = ScCore->primaryMainWindow()->size().width();
appPrefs.mainWinSettings.height = ScCore->primaryMainWindow()->size().height();
appPrefs.mainWinSettings.maximized = ScCore->primaryMainWindow()->isMaximized();
 
appPrefs.RecentDocs.clear();
uint max = QMIN(appPrefs.RecentDCount, ScMW->RecentDocs.count());
uint max = QMIN(appPrefs.RecentDCount, ScCore->primaryMainWindow()->RecentDocs.count());
for (uint m = 0; m < max; ++m)
{
appPrefs.RecentDocs.append(ScMW->RecentDocs[m]);
appPrefs.RecentDocs.append(ScCore->primaryMainWindow()->RecentDocs[m]);
}
ScMW->getDefaultPrinter(&appPrefs.PrinterName, &appPrefs.PrinterFile, &appPrefs.PrinterCommand);
ScCore->primaryMainWindow()->getDefaultPrinter(&appPrefs.PrinterName, &appPrefs.PrinterFile, &appPrefs.PrinterCommand);
SavePrefsXML();
QString realFile;
if (fname.isNull())
848,7 → 848,7
Keys ke;
if (!actName.isEmpty())
{
if (ScMW->scrActions[actName])
if (ScCore->primaryMainWindow()->scrActions[actName])
{
ke.actionName=actName;
ke.keySequence = keyseq;
1905,7 → 1905,7
// triggered by a signal sent from here and displayed by ScribusMainWindow.
void PrefsManager::alertSavePrefsFailed() const
{
QMessageBox::critical(ScMW, tr("Error Writing Preferences"),
QMessageBox::critical(ScCore->primaryMainWindow(), tr("Error Writing Preferences"),
"<qt>" +
tr("Scribus was not able to save its preferences:<br>"
"%1<br>"
1924,7 → 1924,7
bool splashShowing = ScCore->splashShowing();
if (splashShowing)
ScCore->showSplash(false);
QMessageBox::critical(ScMW, tr("Error Loading Preferences"),
QMessageBox::critical(ScCore->primaryMainWindow(), tr("Error Loading Preferences"),
"<qt>" +
tr("Scribus was not able to load its preferences:<br>"
"%1<br>"
/branches/Version13x/Scribus/scribus/scribusview.h
54,10 → 54,10
class Vruler;
class UndoManager;
class RulerMover;
//#include "pageselector.h"
class PageSelector;
class ScribusWin;
class ScribusMainWindow;
 
 
/**
* This class provides an incomplete base for your application view.
*/
67,7 → 67,7
Q_OBJECT
 
public:
ScribusView(QWidget *parent=0, ScribusDoc *doc=0);
ScribusView(QWidget* win=0, ScribusMainWindow* mw=0, ScribusDoc* doc=0);
~ScribusView() {};
/** Vergroesserungseingabefeld */
MSpinBox* zoomSpinBox; //zoom spinbox at bottom of view
355,6 → 355,7
//The width of vertical ruler/height of horizontal ruler, set to 17 in scribusview.cpp
int m_vhRulerHW;
bool m_cursorVisible;
ScribusMainWindow* m_ScMW;
 
signals:
void changeUN(int);
/branches/Version13x/Scribus/scribus/loadsaveplugin.cpp
13,6 → 13,7
: ScPlugin(),
m_Doc(0),
m_View(0),
m_ScMW(0),
m_mwProgressBar(0),
m_AvailableFonts(0)
{
192,10 → 193,11
}
 
 
void LoadSavePlugin::setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts)
void LoadSavePlugin::setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, ScribusMainWindow* targetMW, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts)
{
m_Doc=targetDoc;
m_View=targetView;
m_ScMW=targetMW;
m_mwProgressBar=targetMWPRogressBar;
m_AvailableFonts=targetAvailableFonts;
}
239,10 → 241,10
return (plug && save) ? plug->saveFile(fileName, *this) : false;
}
 
void FileFormat::setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts) const
void FileFormat::setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, ScribusMainWindow* targetMW, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts) const
{
if (plug)
plug->setupTargets(targetDoc, targetView, targetMWPRogressBar, targetAvailableFonts);
plug->setupTargets(targetDoc, targetView, targetMW, targetMWPRogressBar, targetAvailableFonts);
}
 
void FileFormat::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois) const
/branches/Version13x/Scribus/scribus/gtaction.h
41,11 → 41,15
#include "gtparagraphstyle.h"
#include "gtstyle.h"
 
class ScribusDoc;
class ScribusMainWindow;
 
typedef QMap<QString, QString> FontFamilyMap;
 
class SCRIBUS_API gtAction
{
private:
ScribusMainWindow* m_ScMW;
PageItem *textFrame;
PageItem *it;
int lastParagraphStyle;
71,7 → 75,7
void finalize();
PrefsManager *prefsManager;
public:
gtAction(bool append);
// gtAction(bool append);
gtAction(bool append, PageItem *pageitem);
~gtAction();
void setTextFrame(PageItem* frame);
/branches/Version13x/Scribus/scribus/charselect.cpp
19,7 → 19,7
#include <qpopupmenu.h>
#include <qwidget.h>
 
#include "scribus.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "scribusview.h"
#include "fontcombo.h"
66,7 → 66,7
p.end();
}
 
ChTable::ChTable(CharSelect* parent, ScribusMainWindow *pl) : QTable(parent)
ChTable::ChTable(CharSelect* parent, PageItem* pi) : QTable(parent)
{
watchTimer = new QTimer(this);
// connect(watchTimer, SIGNAL(timeout()), this, SLOT(showAlternate()));
74,7 → 74,7
alternate = false;
rowA = 0;
colA = 0;
ap = pl;
m_Item = pi;
par = parent;
dia = 0;
QToolTip::add(this, "<qt>" + tr("You can see a thumbnail if you press and hold down the right mouse button. The Insert key inserts a Glyph into the Selection below and the Delete key removes the last inserted one") + "</qt>");
83,7 → 83,7
 
QRect ChTable::cellGeometry ( int /*row*/, int /*col*/ ) const
{
int widthHeight = QMAX(18 + qRound(-(*ap->doc->AllFonts)[par->fontInUse]->descent() * 18) + 5, 18);
int widthHeight = QMAX(18 + qRound(-(*m_Item->doc()->AllFonts)[par->fontInUse]->descent() * 18) + 5, 18);
return QRect(0, 0, widthHeight, widthHeight+20);
 
}
110,13 → 110,13
fo.setPixelSize(9);
qp->setFont(fo);
static FPointArray gly;
int len = (*ap->doc->AllFonts)[par->fontInUse]->outline(par->characters[cc]).size();
int len = (*m_Item->doc()->AllFonts)[par->fontInUse]->outline(par->characters[cc]).size();
gly.resize(len);
gly.putPoints(0, len, (*ap->doc->AllFonts)[par->fontInUse]->outline(par->characters[cc]) );
gly.putPoints(0, len, (*m_Item->doc()->AllFonts)[par->fontInUse]->outline(par->characters[cc]) );
if (gly.size() > 4)
{
gly.map(chma);
double ww = sz.width() - (*ap->doc->AllFonts)[par->fontInUse]->charWidth(par->characters[cc])*16;
double ww = sz.width() - (*m_Item->doc()->AllFonts)[par->fontInUse]->charWidth(par->characters[cc])*16;
p->translate(ww / 2, 1);
p->setBrush(black);
p->setFillMode(1);
164,7 → 164,7
if ((e->button() == RightButton) && ((r*16+c) < maxCount))
{
watchTimer->stop();
int bh = 48 + qRound(-(*ap->doc->AllFonts)[font]->descent() * 48) + 3;
int bh = 48 + qRound(-(*m_Item->doc()->AllFonts)[font]->descent() * 48) + 3;
QPixmap pixm(bh,bh);
ScPainter *p = new ScPainter(&pixm, bh, bh);
p->clear();
171,8 → 171,8
pixm.fill(white);
QWMatrix chma;
chma.scale(4.8, 4.8);
FPointArray gly = (*ap->doc->AllFonts)[font]->outline(par->characters[r*16+c]).copy();
double ww = bh - (*ap->doc->AllFonts)[font]->charWidth(par->characters[r*16+c])*48;
FPointArray gly = (*m_Item->doc()->AllFonts)[font]->outline(par->characters[r*16+c]).copy();
double ww = bh - (*m_Item->doc()->AllFonts)[font]->charWidth(par->characters[r*16+c])*48;
if (gly.size() > 4)
{
gly.map(chma);
231,11 → 231,11
{
QPopupMenu *pmen = new QPopupMenu();
chToIns = QChar(par->characters[baseChar]);
pmen->insertItem(FontSample((*ap->doc->AllFonts)[font], 20, chToIns, paletteBackgroundColor(), true));
if ((*ap->doc->AllFonts)[font]->CharWidth.contains(par->characters[baseChar] + 0xF720))
pmen->insertItem(FontSample((*m_Item->doc()->AllFonts)[font], 20, chToIns, paletteBackgroundColor(), true));
if ((*m_Item->doc()->AllFonts)[font]->CharWidth.contains(par->characters[baseChar] + 0xF720))
{
chToIns = QChar(par->characters[baseChar] + 0xF720);
pmen->insertItem(FontSample((*ap->doc->AllFonts)[font], 20, chToIns, paletteBackgroundColor(), true));
pmen->insertItem(FontSample((*m_Item->doc()->AllFonts)[font], 20, chToIns, paletteBackgroundColor(), true));
}
int re = pmen->indexOf(pmen->exec(QCursor::pos()));
delete pmen;
244,10 → 244,10
 
CharSelect::CharSelect( QWidget* parent, PageItem *item) : QDialog( parent, "CharSelect", true, 0 )
{
fontInUse = ScMW->doc->currentStyle.charStyle().font()->scName();
fontInUse = item->doc()->currentStyle.charStyle().font()->scName();
needReturn = false;
installEventFilter(this);
run(parent, item, ScMW);
run(parent, item);
}
 
CharSelect::CharSelect( QWidget* parent, PageItem *item, QString font, bool modal)
256,7 → 256,7
fontInUse = font;
needReturn = true;
installEventFilter(this);
run(parent, item, ScMW);
run(parent, item);
}
 
 
266,11 → 266,10
}
 
 
void CharSelect::run( QWidget* /*parent*/, PageItem *item, ScribusMainWindow *pl)
void CharSelect::run( QWidget* /*parent*/, PageItem *item)
{
setCaption( tr( "Select Character:" )+" "+fontInUse );
ite = item;
ap = pl;
m_Item = item;
setIcon(loadIcon("AppIcon.png"));
zAuswahlLayout = new QVBoxLayout( this );
zAuswahlLayout->setSpacing( 6 );
297,7 → 296,7
QSpacerItem* spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
selectionsLayout->addItem( spacer2 );
zAuswahlLayout->addLayout(selectionsLayout);
zTabelle = new ChTable( this, pl);
zTabelle = new ChTable( this, m_Item);
zTabelle->setNumCols( 16 );
zTabelle->setLeftMargin(0);
zTabelle->verticalHeader()->hide();
406,7 → 405,7
charactersArabicPresentationFormsA.clear();
charactersArabicPresentationFormsB.clear();
charactersHebrew.clear();
face = (*ap->doc->AllFonts)[fontInUse]->ftFace();
face = (*m_Item->doc()->AllFonts)[fontInUse]->ftFace();
if (!face) {
return;
}
682,7 → 681,7
characters.clear();
zTabelle->setNumRows( 0 );
characters = allClasses[charClass];
face = (*ap->doc->AllFonts)[fontInUse]->ftFace();
face = (*m_Item->doc()->AllFonts)[fontInUse]->ftFace();
if (!face) {
maxCount = 0;
return;
709,17 → 708,17
zTabelle->maxCount = 0;
QString oldFont = fontInUse;
fontInUse = fontSelector->text(font);
(*ap->doc->AllFonts)[fontInUse]->increaseUsage();
if ((*ap->doc->AllFonts)[oldFont])
(*ap->doc->AllFonts)[oldFont]->decreaseUsage();
(*m_Item->doc()->AllFonts)[fontInUse]->increaseUsage();
if ((*m_Item->doc()->AllFonts)[oldFont])
(*m_Item->doc()->AllFonts)[oldFont]->decreaseUsage();
delEdit();
setCaption( tr( "Select Character:" )+" "+fontInUse );
ap->SetNewFont(fontInUse);
if (ScMW->doc->currentStyle.charStyle().font()->scName() != fontInUse)
ScCore->primaryMainWindow()->SetNewFont(fontInUse);
if (m_Item->doc()->currentStyle.charStyle().font()->scName() != fontInUse)
{
disconnect(fontSelector, SIGNAL(activated(int)), this, SLOT(newFont(int)));
fontSelector->RebuildList(ScMW->doc);
fontInUse = ScMW->doc->currentStyle.charStyle().font()->scName();
fontSelector->RebuildList(m_Item->doc());
fontInUse = m_Item->doc()->currentStyle.charStyle().font()->scName();
setCaption( tr( "Select Character:" )+" "+fontInUse );
fontSelector->setCurrentText(fontInUse);
connect(fontSelector, SIGNAL(activated(int)), this, SLOT(newFont(int)));
739,7 → 738,7
if ((ok) && (code > 31))
{
chToIns += QChar(code);
sample->setPixmap(FontSample((*ap->doc->AllFonts)[fontInUse], 28, chToIns, paletteBackgroundColor(), true));
sample->setPixmap(FontSample((*m_Item->doc()->AllFonts)[fontInUse], 28, chToIns, paletteBackgroundColor(), true));
insertButton->setEnabled(true);
}
}
749,7 → 748,7
if ((r*16+c) < maxCount)
{
chToIns += QChar(characters[r*16+c]);
sample->setPixmap(FontSample((*ap->doc->AllFonts)[fontInUse], 28, chToIns, paletteBackgroundColor(), true));
sample->setPixmap(FontSample((*m_Item->doc()->AllFonts)[fontInUse], 28, chToIns, paletteBackgroundColor(), true));
insertButton->setEnabled(true);
QString tmp;
tmp.sprintf("%04X", characters[r*16+c]);
767,7 → 766,7
return;
}
chToIns.truncate(chToIns.length() - 1);
sample->setPixmap(FontSample((*ap->doc->AllFonts)[fontInUse], 28, chToIns, paletteBackgroundColor(), true));
sample->setPixmap(FontSample((*m_Item->doc()->AllFonts)[fontInUse], 28, chToIns, paletteBackgroundColor(), true));
insertButton->setEnabled(true);
}
 
789,8 → 788,9
emit insertSpecialChar();
return;
}
if (ite->HasSel)
ite->asTextFrame()->deleteSelectedTextFromFrame();
if (m_Item->HasSel)
m_Item->asTextFrame()->deleteSelectedTextFromFrame();
//CB: Avox please make text->insertchar(char) so none of this happens in gui code, and item can tell doc its changed so the view and mainwindow slotdocch are not necessary
for (uint a=0; a<chToIns.length(); ++a)
{
QChar ch = chToIns.at(a);
798,11 → 798,11
ch = QChar(13);
if (ch == QChar(9))
ch = QChar(32);
ite->itemText.insertChars(ite->CPos, ch);
ite->CPos += 1;
m_Item->itemText.insertChars(m_Item->CPos, ch);
m_Item->CPos += 1;
}
ap->view->DrawNew();
ap->slotDocCh();
m_Item->doc()->view()->DrawNew();
m_Item->doc()->changed();
delEdit();
}
 
/branches/Version13x/Scribus/scribus/gtgettext.h
43,6 → 43,9
#include "scfonts.h"
#include "pageitem.h"
 
 
class ScribusDoc;
 
struct ImporterData {
QString soFilePath;
QString fileFormatName;
65,8 → 68,9
void createMap();
gtDialogs* dias;
QStringList ilist;
ScribusDoc* m_Doc;
public:
gtGetText();
gtGetText(ScribusDoc* doc);
~gtGetText();
void run(bool append);
};
/branches/Version13x/Scribus/scribus/newfile.h
16,6 → 16,7
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <qstringlist.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qtabwidget.h>
39,7 → 40,7
Q_OBJECT
 
public:
NewDoc( QWidget* parent, bool startUp = false );
NewDoc( QWidget* parent, const QStringList& recentDocs, bool startUp = false );
~NewDoc() {};
void createNewDocPage();
void createOpenDocPage();
75,7 → 76,7
QFrame* openDocFrame;
CustomFDialog *fileDialog;
QFrame* recentDocFrame;
QListBox* recentDocList;
QListBox* recentDocListBox;
QPushButton* OKButton;
QPushButton* CancelB;
double unitRatio;
103,7 → 104,7
\param item QListViewItem sent by signall caller
\author Petr Vanek <petr@yarpen.cz
*/
void recentDocList_doubleClicked(QListBoxItem * item);
void recentDocListBox_doubleClicked(QListBoxItem * item);
void openFile(const QString &);
 
protected:
122,6 → 123,7
QVBoxLayout* recentDocLayout;
QString customText, customTextTR;
PrefsManager* prefsManager;
QStringList recentDocList;
};
 
#endif // NEWDOC_H
/branches/Version13x/Scribus/scribus/layers.cpp
75,7 → 75,8
}
 
LayerPalette::LayerPalette(QWidget* parent)
: ScrPaletteBase( parent, "Layers", false, 0 )
: ScrPaletteBase( parent, "Layers", false, 0 ),
m_Doc(0)
{
setIcon(loadIcon("AppIcon.png"));
LayerPaletteLayout = new QVBoxLayout( this, 1, 2, "LayerPaletteLayout");
202,7 → 203,7
void LayerPalette::updateName(int r)
{
changeName(r, 6);
ScMW->changeLayer(ScMW->doc->activeLayer());
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
}
 
void LayerPalette::ClearInhalt()
224,14 → 225,26
lowerLayerButton->setEnabled(false);
}
 
void LayerPalette::setLayers(QValueList<Layer> *layin, int act)
void LayerPalette::setDoc(ScribusDoc* doc)
{
layers = layin;
rebuildList();
m_Doc=doc;
disconnect(blendMode, SIGNAL(activated(int)), this, SLOT(changeBlendMode(int)));
disconnect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeOpacity()));
disconnect(Table, SIGNAL(currentChanged(int, int)), this, SLOT(setActiveLayer(int)));
markActiveLayer(act);
if (!m_Doc)
{
layers=0;
newLayerButton->setEnabled(false);
deleteLayerButton->setEnabled(false);
raiseLayerButton->setEnabled(false);
lowerLayerButton->setEnabled(false);
 
markActiveLayer(0);
}
layers=&m_Doc->Layers;
rebuildList();
 
markActiveLayer(m_Doc->activeLayer());
newLayerButton->setEnabled(true);
deleteLayerButton->setEnabled(true);
raiseLayerButton->setEnabled(true);
253,20 → 266,20
flagsMarker.clear();
QString tmp;
QValueList<Layer>::iterator it;
int layerCount=ScMW->doc->layerCount();
int layerCount=m_Doc->layerCount();
Table->setNumRows(layerCount);
for (it = layers->begin(); it != layers->end(); ++it)
{
int layerNumber=(*it).LNr;
//TODO once "layers" is not set anymore, need to get layer number differently
int layerLevel=ScMW->doc->layerLevelFromNumber(layerNumber);
int layerLevel=m_Doc->layerLevelFromNumber(layerNumber);
int row=layerCount-layerLevel-1;
Table->setText(row, 6, ScMW->doc->layerName(layerNumber));
Table->setText(row, 6, m_Doc->layerName(layerNumber));
QToolButton *pb = new QToolButton(this, tmp.setNum(layerLevel));
pb->setAutoRaise(true);
pb->setText( "" );
QPixmap pm(20,15);
pm.fill(ScMW->doc->layerMarker(layerNumber));
pm.fill(m_Doc->layerMarker(layerNumber));
QIconSet ic;
ic.setPixmap(pm, QIconSet::Small, QIconSet::Normal);
ic.setPixmap(pm, QIconSet::Small, QIconSet::Active);
275,27 → 288,27
flagsMarker.append(pb);
connect(pb, SIGNAL(clicked()), this, SLOT(markLayer()));
QCheckBox *cp2 = new QCheckBox(this, tmp.setNum(layerLevel));
cp2->setChecked(ScMW->doc->layerVisible(layerNumber));
cp2->setChecked(m_Doc->layerVisible(layerNumber));
flagsVisible.append(cp2);
connect(cp2, SIGNAL(clicked()), this, SLOT(visibleLayer()));
Table->setCellWidget(row, 1, cp2);
QCheckBox *cp = new QCheckBox(this, tmp.setNum(layerLevel));
cp->setChecked(ScMW->doc->layerPrintable(layerNumber));
cp->setChecked(m_Doc->layerPrintable(layerNumber));
Table->setCellWidget(row, 2, cp);
flagsPrintable.append(cp);
connect(cp, SIGNAL(clicked()), this, SLOT(printLayer()));
QCheckBox *cp3 = new QCheckBox(this, tmp.setNum(layerLevel));
cp3->setChecked(ScMW->doc->layerLocked(layerNumber));
cp3->setChecked(m_Doc->layerLocked(layerNumber));
flagsLocked.append(cp3);
connect(cp3, SIGNAL(clicked()), this, SLOT(lockLayer()));
Table->setCellWidget(row, 3, cp3);
QCheckBox *cp4 = new QCheckBox(this, tmp.setNum(layerLevel));
cp4->setChecked(ScMW->doc->layerFlow(layerNumber));
cp4->setChecked(m_Doc->layerFlow(layerNumber));
flagsFlow.append(cp4);
connect(cp4, SIGNAL(clicked()), this, SLOT(flowToggleLayer()));
Table->setCellWidget(row, 4, cp4);
QCheckBox *cp5 = new QCheckBox(this, tmp.setNum(layerLevel));
cp5->setChecked(ScMW->doc->layerOutline(layerNumber));
cp5->setChecked(m_Doc->layerOutline(layerNumber));
flagsOutline.append(cp5);
connect(cp5, SIGNAL(clicked()), this, SLOT(outlineToggleLayer()));
Table->setCellWidget(row, 5, cp5);
310,22 → 323,22
 
void LayerPalette::addLayer()
{
ScMW->doc->addLayer(QString::null, true);
m_Doc->addLayer(QString::null, true);
rebuildList();
markActiveLayer();
ScMW->changeLayer(ScMW->doc->activeLayer());
ScMW->slotDocCh();
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
m_Doc->changed();
}
 
void LayerPalette::removeLayer()
{
int layerCount=ScMW->doc->layerCount();
int layerCount=m_Doc->layerCount();
if (layerCount < 2)
return;
int level = layerCount-1-Table->currentRow();
int layerNumber=ScMW->doc->layerNumberFromLevel(level);
int layerNumber=m_Doc->layerNumberFromLevel(level);
bool delToo = false;
if (ScMW->doc->layerContainsItems(layerNumber))
if (m_Doc->layerContainsItems(layerNumber))
{
int scmReturn=ScMessageBox::warning(this, tr("Delete Layer"),
tr("Do you want to delete all objects on this layer too?"),
338,41 → 351,41
delToo = true;
}
 
if (!ScMW->doc->deleteLayer(layerNumber, delToo))
if (!m_Doc->deleteLayer(layerNumber, delToo))
return;
rebuildList();
markActiveLayer();
ScMW->changeLayer(ScMW->doc->activeLayer());
ScMW->slotDocCh();
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
m_Doc->changed();
}
 
void LayerPalette::upLayer()
{
int layerCount=ScMW->doc->layerCount();
int layerCount=m_Doc->layerCount();
if ((layerCount < 2) || (Table->currentRow() == 0))
return;
int layerLevel = layerCount-1-Table->currentRow();
ScMW->doc->raiseLayerByLevel(layerLevel);
m_Doc->raiseLayerByLevel(layerLevel);
rebuildList();
markActiveLayer();
ScMW->changeLayer(ScMW->doc->activeLayer());
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
emit LayerChanged();
ScMW->slotDocCh();
m_Doc->changed();
}
 
void LayerPalette::downLayer()
{
int layerCount=ScMW->doc->layerCount();
int layerCount=m_Doc->layerCount();
if ((layerCount < 2) || (Table->currentRow() == static_cast<int>(layerCount) - 1))
return;
int layerLevel = layerCount-1-Table->currentRow();
ScMW->doc->lowerLayerByLevel(layerLevel);
m_Doc->lowerLayerByLevel(layerLevel);
rebuildList();
ScMW->changeLayer(ScMW->doc->activeLayer());
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
emit LayerChanged();
markActiveLayer();
ScMW->slotDocCh();
m_Doc->changed();
}
 
void LayerPalette::changeName(int row, int col)
379,13 → 392,10
{
if (col == 6)
{
int layerLevel = ScMW->doc->layerCount()-1-row;
int layerNumber=ScMW->doc->layerNumberFromLevel(layerLevel);
int layerLevel = m_Doc->layerCount()-1-row;
int layerNumber=m_Doc->layerNumberFromLevel(layerLevel);
if (layerNumber!=-1)
{
if (ScMW->doc->changeLayerName(layerNumber, Table->text(row, col)))
ScMW->slotDocCh();
}
m_Doc->changeLayerName(layerNumber, Table->text(row, col));
}
}
 
392,15 → 402,14
void LayerPalette::visibleLayer()
{
int level = QString(sender()->name()).toInt();
int layerNumber=ScMW->doc->layerNumberFromLevel(level);
int layerNumber=m_Doc->layerNumberFromLevel(level);
if (layerNumber==-1)
return;
const QObject* senderBox=sender();
if (senderBox->isA("QCheckBox"))
{
ScMW->doc->setLayerVisible(layerNumber,((QCheckBox*)(senderBox))->isChecked());
m_Doc->setLayerVisible(layerNumber,((QCheckBox*)(senderBox))->isChecked());
emit LayerChanged();
ScMW->slotDocCh();
}
}
 
407,58 → 416,47
void LayerPalette::printLayer()
{
int level = QString(sender()->name()).toInt();
int layerNumber=ScMW->doc->layerNumberFromLevel(level);
int layerNumber=m_Doc->layerNumberFromLevel(level);
if (layerNumber==-1)
return;
const QObject* senderBox=sender();
if (senderBox->isA("QCheckBox"))
{
ScMW->doc->setLayerPrintable(layerNumber,((QCheckBox*)(senderBox))->isChecked());
ScMW->slotDocCh();
}
m_Doc->setLayerPrintable(layerNumber,((QCheckBox*)(senderBox))->isChecked());
}
 
void LayerPalette::lockLayer()
{
int level = QString(sender()->name()).toInt();
int layerNumber=ScMW->doc->layerNumberFromLevel(level);
int layerNumber=m_Doc->layerNumberFromLevel(level);
if (layerNumber==-1)
return;
const QObject* senderBox=sender();
if (senderBox->isA("QCheckBox"))
{
ScMW->doc->setLayerLocked(layerNumber,((QCheckBox*)(senderBox))->isChecked());
ScMW->slotDocCh();
}
m_Doc->setLayerLocked(layerNumber,((QCheckBox*)(senderBox))->isChecked());
}
 
void LayerPalette::flowToggleLayer()
{
int level = QString(sender()->name()).toInt();
int layerNumber=ScMW->doc->layerNumberFromLevel(level);
int layerNumber=m_Doc->layerNumberFromLevel(level);
if (layerNumber==-1)
return;
const QObject* senderBox=sender();
if (senderBox->isA("QCheckBox"))
{
ScMW->doc->setLayerFlow(layerNumber,((QCheckBox*)(senderBox))->isChecked());
emit LayerChanged();
ScMW->slotDocCh();
}
m_Doc->setLayerFlow(layerNumber,((QCheckBox*)(senderBox))->isChecked());
}
 
void LayerPalette::outlineToggleLayer()
{
int level = QString(sender()->name()).toInt();
int layerNumber=ScMW->doc->layerNumberFromLevel(level);
int layerNumber=m_Doc->layerNumberFromLevel(level);
if (layerNumber==-1)
return;
const QObject* senderBox=sender();
if (senderBox->isA("QCheckBox"))
{
ScMW->doc->setLayerOutline(layerNumber,((QCheckBox*)(senderBox))->isChecked());
m_Doc->setLayerOutline(layerNumber,((QCheckBox*)(senderBox))->isChecked());
emit LayerChanged();
ScMW->slotDocCh();
}
}
 
465,7 → 463,7
void LayerPalette::markLayer()
{
int level = QString(sender()->name()).toInt();
int layerNumber=ScMW->doc->layerNumberFromLevel(level);
int layerNumber=m_Doc->layerNumberFromLevel(level);
if (layerNumber==-1)
return;
const QObject* senderBox=sender();
472,7 → 470,7
if (senderBox->isA("QToolButton"))
{
QColor neu = QColor();
neu = QColorDialog::getColor(ScMW->doc->layerMarker(layerNumber), this);
neu = QColorDialog::getColor(m_Doc->layerMarker(layerNumber), this);
QPixmap pm(20,15);
pm.fill(neu);
QIconSet ic;
479,24 → 477,21
ic.setPixmap(pm, QIconSet::Small, QIconSet::Normal);
ic.setPixmap(pm, QIconSet::Small, QIconSet::Active);
((QToolButton*)(senderBox))->setIconSet(ic);
ScMW->doc->setLayerMarker(layerNumber,neu);
m_Doc->setLayerMarker(layerNumber,neu);
emit LayerChanged();
ScMW->slotDocCh();
}
}
 
void LayerPalette::changeOpacity()
{
ScMW->doc->setLayerTransparency(ScMW->doc->activeLayer(), opacitySpinBox->value() / 100.0);
m_Doc->setLayerTransparency(m_Doc->activeLayer(), opacitySpinBox->value() / 100.0);
emit LayerChanged();
ScMW->slotDocCh();
}
 
void LayerPalette::changeBlendMode(int blend)
{
ScMW->doc->setLayerBlendMode(ScMW->doc->activeLayer(), blend);
m_Doc->setLayerBlendMode(m_Doc->activeLayer(), blend);
emit LayerChanged();
ScMW->slotDocCh();
}
 
void LayerPalette::markActiveLayer(int layerNumber)
506,10 → 501,10
disconnect(Table, SIGNAL(currentChanged(int, int)), this, SLOT(setActiveLayer(int)));
int layerToMark=layerNumber;
if (layerNumber==-1)
layerToMark=ScMW->doc->activeLayer();
Table->setCurrentCell(ScMW->doc->layerCount()-1-ScMW->doc->layerLevelFromNumber(layerToMark), 6);
opacitySpinBox->setValue(qRound(ScMW->doc->layerTransparency(layerToMark) * 100));
blendMode->setCurrentItem(ScMW->doc->layerBlendMode(layerToMark));
layerToMark=m_Doc->activeLayer();
Table->setCurrentCell(m_Doc->layerCount()-1-m_Doc->layerLevelFromNumber(layerToMark), 6);
opacitySpinBox->setValue(qRound(m_Doc->layerTransparency(layerToMark) * 100));
blendMode->setCurrentItem(m_Doc->layerBlendMode(layerToMark));
connect(Table, SIGNAL(currentChanged(int, int)), this, SLOT(setActiveLayer(int)));
connect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeOpacity()));
connect(blendMode, SIGNAL(activated(int)), this, SLOT(changeBlendMode(int)));
519,13 → 514,13
{
disconnect(blendMode, SIGNAL(activated(int)), this, SLOT(changeBlendMode(int)));
disconnect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeOpacity()));
int layerNumber=ScMW->doc->layerNumberFromLevel(ScMW->doc->layerCount()-1-row);
bool found=ScMW->doc->setActiveLayer(layerNumber);
int layerNumber=m_Doc->layerNumberFromLevel(m_Doc->layerCount()-1-row);
bool found=m_Doc->setActiveLayer(layerNumber);
if (found)
{
ScMW->changeLayer(ScMW->doc->activeLayer());
opacitySpinBox->setValue(qRound(ScMW->doc->layerTransparency(ScMW->doc->activeLayer()) * 100));
blendMode->setCurrentItem(ScMW->doc->layerBlendMode(ScMW->doc->activeLayer()));
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
opacitySpinBox->setValue(qRound(m_Doc->layerTransparency(m_Doc->activeLayer()) * 100));
blendMode->setCurrentItem(m_Doc->layerBlendMode(m_Doc->activeLayer()));
}
connect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeOpacity()));
connect(blendMode, SIGNAL(activated(int)), this, SLOT(changeBlendMode(int)));
/branches/Version13x/Scribus/scribus/collect4output.h
11,7 → 11,7
#include <qmap.h>
 
class QString;
class ScribusMainWindow;
class ScribusDoc;
class PrefsContext;
 
 
30,7 → 30,7
\param withFonts collect/move fonts into output directory too
\param compressDoc use gzipped document
*/
CollectForOutput(bool withFonts=false, bool compressDoc=false);
CollectForOutput(ScribusDoc* doc, bool withFonts=false, bool compressDoc=false);
~CollectForOutput(){};
 
/*! \brief Main method doing everything.
39,6 → 39,8
QString collect();
 
private:
/*! Doc to collect */
ScribusDoc* m_Doc;
/*! Use compressed document. See the constructor */
bool compressDoc;
/*! Collect fonts too. See the constructor */
/branches/Version13x/Scribus/scribus/sampleitem.cpp
4,7 → 4,7
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "scribus.h"
#include "scribuscore.h"
#include "sampleitem.h"
#include "sampleitem.moc"
#include "loremipsum.h"
16,15 → 16,14
#include <qstring.h>
#include "text/nlsconfig.h"
 
extern ScribusMainWindow* ScMW;
 
 
SampleItem::SampleItem() : QObject()
SampleItem::SampleItem(ScribusDoc* doc) :
QObject(),
m_Doc(doc)
{
used = true;
if (ScMW->doc == NULL)
if (m_Doc == 0)
{
ScMW->doFileNew(//pageWidth, pageHeight,
m_Doc=ScCore->primaryMainWindow()->doFileNew(//pageWidth, pageHeight,
0,0,
//topMargin, leftMargin, rightMargin, bottomMargin,
1, 1, 1, 1,
35,20 → 34,22
1, 1, 1,
//orientation, firstPageNr, "Custom");
1, 1, "custom", 1, true);
ScMW->doc->pageSets[1/*pagesType*/].FirstPage = 1;//firstPageOrder;
if (!m_Doc)
return;
m_Doc->pageSets[1/*pagesType*/].FirstPage = 1;//firstPageOrder;
used = false;
}
doc = ScMW->doc;
 
// tmp colors. to be removed in descrictor
ScMW->doc->PageColors.insert("__blackforpreview__", ScColor(0, 0, 0, 255));
ScMW->doc->PageColors.insert("__whiteforpreview__", ScColor(0, 0, 0, 0));
ScMW->doc->PageColors.insert("__whiteforpreviewbg__", ScColor(0, 0, 0, 0));
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((doc->toolSettings.defSize / 10.0)
* static_cast<double>(doc->typographicSettings.autoLineSpacing) / 100
+ (doc->toolSettings.defSize / 10.0));
tmpStyle.setLineSpacing((m_Doc->toolSettings.defSize / 10.0)
* static_cast<double>(m_Doc->typographicSettings.autoLineSpacing) / 100
+ (m_Doc->toolSettings.defSize / 10.0));
tmpStyle.setAlignment(0);
tmpStyle.setLeftMargin(0);
tmpStyle.setFirstIndent(0);
55,8 → 56,8
tmpStyle.setRightMargin(0);
tmpStyle.setGapBefore(0);
tmpStyle.setGapAfter(0);
tmpStyle.charStyle().setFont(PrefsManager::instance()->appPrefs.AvailFonts[doc->toolSettings.defFont]);
tmpStyle.charStyle().setFontSize(doc->toolSettings.defSize);
tmpStyle.charStyle().setFont(PrefsManager::instance()->appPrefs.AvailFonts[m_Doc->toolSettings.defFont]);
tmpStyle.charStyle().setFontSize(m_Doc->toolSettings.defSize);
tmpStyle.tabValues().clear();
tmpStyle.setHasDropCap(false);
tmpStyle.setDropCapLines(0);//2;
63,17 → 64,17
tmpStyle.setDropCapOffset(0);
tmpStyle.charStyle().setEffects(ScStyle_Default);
tmpStyle.charStyle().setFillColor("__blackforpreview__");
tmpStyle.charStyle().setFillShade(100); //doc->toolSettings.dShade;
tmpStyle.charStyle().setFillShade(100); //m_Doc->toolSettings.dShade;
tmpStyle.charStyle().setStrokeColor("__whiteforpreview__");
tmpStyle.charStyle().setStrokeShade(100); //doc->toolSettings.dShade2;
tmpStyle.charStyle().setStrokeShade(100); //m_Doc->toolSettings.dShade2;
tmpStyle.setUseBaselineGrid(false);
tmpStyle.charStyle().setShadowXOffset(50);
tmpStyle.charStyle().setShadowYOffset(-50);
tmpStyle.charStyle().setOutlineWidth(10);
tmpStyle.charStyle().setUnderlineOffset(0); //doc->typographicSettings.valueUnderlinePos;
tmpStyle.charStyle().setUnderlineWidth(0); //doc->typographicSettings.valueUnderlineWidth;
tmpStyle.charStyle().setStrikethruOffset(0); //doc->typographicSettings.valueStrikeThruPos;
tmpStyle.charStyle().setStrikethruWidth(0); //doc->typographicSettings.valueStrikeThruPos;
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);
86,8 → 87,8
// clean tmp document
if (used == false)
{
doc->setModified(false);
ScMW->slotFileClose();
m_Doc->setModified(false);
m_Doc->scMW()->slotFileClose();
}
}
 
111,7 → 112,7
 
void SampleItem::setBgColor(QColor c)
{
ScMW->doc->PageColors["__whiteforpreviewbg__"].fromQColor(c);
m_Doc->PageColors["__whiteforpreviewbg__"].fromQColor(c);
}
 
void SampleItem::setBgShade(int c)
121,7 → 122,7
 
void SampleItem::setTxColor(QColor c)
{
ScMW->doc->PageColors["__blackforpreview__"].fromQColor(c);
m_Doc->PageColors["__blackforpreview__"].fromQColor(c);
}
 
void SampleItem::setTxShade(int c)
173,7 → 174,7
{
tmpStyle.charStyle().setFontSize(fontSize);
if (autoLineSpa)
tmpStyle.setLineSpacing(((fontSize / 10) * (doc->typographicSettings.autoLineSpacing / 100) + (fontSize / 10)));
tmpStyle.setLineSpacing(((fontSize / 10) * (m_Doc->typographicSettings.autoLineSpacing / 100) + (fontSize / 10)));
}
 
/*void SampleItem::setTabValues(QValueList<PageItem::TabRecord> tabValues)
292,25 → 293,25
 
UndoManager::instance()->setUndoEnabled(false); // disable undo
 
PageItem_TextFrame *previewItem = new PageItem_TextFrame(doc, 0, 0, width, height, 0, "__whiteforpreviewbg__", "__whiteforpreview__");
PageItem_TextFrame *previewItem = new PageItem_TextFrame(m_Doc, 0, 0, width, height, 0, "__whiteforpreviewbg__", "__whiteforpreview__");
QPixmap pm(width, height);
ScPainter *painter = new ScPainter(&pm, width, height, 0, 0);
double sca = 1.0; // original scale to set back at the end...
int userAppMode = ScMW->doc->appMode; // We need to be in normal when creating/repainting items
ScMW->doc->appMode = modeNormal;
int userAppMode = m_Doc->appMode; // We need to be in normal when creating/repainting items
m_Doc->appMode = modeNormal;
 
if (ScMW->view != NULL)
if (m_Doc->view() != NULL)
{
sca = ScMW->view->scale();
ScMW->view->setScale(1.0);
sca = m_Doc->view()->scale();
m_Doc->view()->setScale(1.0);
}
 
if (doc->UsedFonts.contains(tmpStyle.charStyle().font()->scName()))
if (m_Doc->UsedFonts.contains(tmpStyle.charStyle().font()->scName()))
previouslyUsedFont = true;
 
doc->AddFont(tmpStyle.charStyle().font()->scName(), qRound(doc->toolSettings.defSize / 10.0));
doc->docParagraphStyles.append(tmpStyle);
int tmpIndex = doc->docParagraphStyles.count() - 1;
m_Doc->AddFont(tmpStyle.charStyle().font()->scName(), qRound(m_Doc->toolSettings.defSize / 10.0));
m_Doc->docParagraphStyles.append(tmpStyle);
int tmpIndex = m_Doc->docParagraphStyles.count() - 1;
 
previewItem->FrameType = PageItem::TextFrame;
previewItem->itemText.clear();
318,7 → 319,7
previewItem->Cols = 1;
text.replace(QChar(10),QChar(13)).replace(QChar(5),QChar(13));
previewItem->itemText.insertChars(0, text);
doc->chAbStyle(previewItem, tmpIndex);
m_Doc->chAbStyle(previewItem, tmpIndex);
previewItem->itemText.applyCharStyle(0, text.length(), tmpStyle.charStyle());
previewItem->setFillColor("__whiteforpreviewbg__");
previewItem->setFillShade(bgShade);
331,11 → 332,11
 
// cleanups and resets
if (!previouslyUsedFont)
doc->UsedFonts.remove(tmpStyle.charStyle().font()->scName());
if (ScMW->view != NULL)
ScMW->view->setScale(sca);
doc->appMode = userAppMode;
doc->docParagraphStyles.remove(doc->docParagraphStyles.fromLast());
m_Doc->UsedFonts.remove(tmpStyle.charStyle().font()->scName());
if (m_Doc->view() != NULL)
m_Doc->view()->setScale(sca);
m_Doc->appMode = userAppMode;
m_Doc->docParagraphStyles.remove(m_Doc->docParagraphStyles.fromLast());
UndoManager::instance()->setUndoEnabled(true);
return pm;
}
343,7 → 344,7
void SampleItem::cleanupTemporary()
{
// clear tmp colors
ScMW->doc->PageColors.remove("__blackforpreview__");
ScMW->doc->PageColors.remove("__whiteforpreview__");
ScMW->doc->PageColors.remove("__whiteforpreviewbg__");
m_Doc->PageColors.remove("__blackforpreview__");
m_Doc->PageColors.remove("__whiteforpreview__");
m_Doc->PageColors.remove("__whiteforpreviewbg__");
}
/branches/Version13x/Scribus/scribus/scplugin.cpp
69,7 → 69,7
}
 
// Stub for plugins that don't implement this method to inherit
bool ScActionPlugin::run(QIODevice* /* target */)
bool ScActionPlugin::run(ScribusDoc* /*doc*/, QIODevice* /* target */)
{
return false;
}
/branches/Version13x/Scribus/scribus/werktoolb.h
24,12 → 24,12
#ifndef WERKTOOLB_H
#define WERKTOOLB_H
 
#include <qmainwindow.h>
#include "scribusapi.h"
#include "sctoolbar.h"
class QToolButton;
class QPopupMenu;
class AutoformButtonGroup;
class ScribusMainWindow;
 
/**
*@author Franz Schmid
40,7 → 40,7
Q_OBJECT
 
public:
ModeToolBar(QMainWindow* parent);
ModeToolBar(ScribusMainWindow* parent);
~ModeToolBar() {};
 
int SubMode;
57,6 → 57,7
QPopupMenu* insertShapeButtonMenu;
QPopupMenu* insertPolygonButtonMenu;
int idInsertPolygonButtonMenu;
ScribusMainWindow* m_ScMW;
};
 
class SCRIBUS_API PDFToolBar : public ScToolBar
64,7 → 65,7
Q_OBJECT
 
public:
PDFToolBar(QMainWindow* parent);
PDFToolBar(ScribusMainWindow* parent);
~PDFToolBar() {};
};
 
/branches/Version13x/Scribus/scribus/scraction.cpp
22,8 → 22,9
#include <qiconset.h>
#include "scraction.h"
#include "scraction.moc"
#include "scribus.h"
#include "scribusdoc.h"
 
 
ScrAction::ScrAction( QObject * parent, const char * name ) : QAction( parent, name )
{
initScrAction();
86,8 → 87,8
{
_actionType=ScrAction::Normal;
menuIndex=-1;
widgetAddedTo=NULL;
containerWidgetAddedTo=NULL;
widgetAddedTo=0;
containerWidgetAddedTo=0;
savedKeySequence=QKeySequence("");
shortcutSaved=false;
fakeToggle=false;
127,6 → 128,8
activatedUnicodeShortcut(name(), _dataInt);
if (_actionType==ScrAction::Layer)
emit activatedData(layerID);
if (_actionType==ScrAction::ActionDLL)
emit activatedData(((ScribusMainWindow*)parent())->doc);
}
 
void ScrAction::toggledToToggledData(bool ison)
/branches/Version13x/Scribus/scribus/guidemanagercore.cpp
14,7 → 14,7
#include "undomanager.h"
#include "undostate.h"
#include "guidemanager.h"
#include "scribus.h"
#include "scribuscore.h"
 
 
GuideManagerCore::GuideManagerCore():
231,7 → 231,7
case Standard:
horizontalStdG.remove(horizontalStdG.find(from));
horizontalStdG.append(to);
ScMW->guidePalette->clearRestoreHorizontalList();
ScCore->primaryMainWindow()->guidePalette->clearRestoreHorizontalList();
if (UndoManager::undoEnabled())
{
SimpleState* ss = new SimpleState(Um::MoveVGuide, 0, Um::IGuides);
254,7 → 254,7
case Standard:
verticalStdG.remove(verticalStdG.find(from));
verticalStdG.append(to);
ScMW->guidePalette->clearRestoreVerticalList();
ScCore->primaryMainWindow()->guidePalette->clearRestoreVerticalList();
if (UndoManager::undoEnabled())
{
SimpleState* ss = new SimpleState(Um::MoveVGuide, 0, Um::IGuides);
308,21 → 308,21
if ((*it) >= 0 && (*it) <= m_page->height())
p->drawLine(FPoint(0, (*it)), FPoint(m_page->width(), (*it)));
// highlight selected standards
if (ScMW->guidePalette->tabWidget->currentPageIndex() == 0
&& m_page->pageNr() == ScMW->guidePalette->pageNr())
if (ScCore->primaryMainWindow()->guidePalette->tabWidget->currentPageIndex() == 0
&& m_page->pageNr() == ScCore->primaryMainWindow()->guidePalette->pageNr())
{
p->setPen(Qt::red, lineWidth, Qt::DashDotLine, Qt::FlatCap, Qt::MiterJoin);
Guides highlight = ScMW->guidePalette->selectedVerticals();
Guides highlight = ScCore->primaryMainWindow()->guidePalette->selectedVerticals();
for (it = highlight.begin(); it != highlight.end(); ++it)
if ((*it) >= 0 && (*it) <= m_page->width())
p->drawLine(FPoint((*it), 0), FPoint((*it), m_page->height()));
highlight = ScMW->guidePalette->selectedHorizontals();
highlight = ScCore->primaryMainWindow()->guidePalette->selectedHorizontals();
for (it = highlight.begin(); it != highlight.end(); ++it)
if ((*it) >= 0 && (*it) <= m_page->height())
p->drawLine(FPoint(0, (*it)), FPoint(m_page->width(), (*it)));
}
// all auto
if (ScMW->guidePalette->tabWidget->currentPageIndex() == 1)
if (ScCore->primaryMainWindow()->guidePalette->tabWidget->currentPageIndex() == 1)
color = Qt::red;
else
color = doc->guidesSettings.guideColor;
/branches/Version13x/Scribus/scribus/fileloader.h
31,14 → 31,14
~FileLoader() {};
int TestFile();
// int CheckScribus();
bool LoadPage(int PageToLoad, bool Mpage, QString renamedPageName=QString::null);
bool LoadFile();
bool LoadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName=QString::null);
bool LoadFile(ScribusDoc* currDoc);
bool SaveFile(const QString& fileName, ScribusDoc *doc, QProgressBar *dia2);
bool ReadStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles);
bool ReadPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
bool ReadColors(const QString& fileName, ColorList & colors);
bool ReadLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
bool postLoad();
bool postLoad(ScribusDoc* currDoc);
void informReplacementFonts();
QString FileName;
int FileType;
/branches/Version13x/Scribus/scribus/edit1format.cpp
38,7 → 38,7
AutoVal = au;
DocsEin = dEin;
 
sampleItem = new SampleItem();
sampleItem = new SampleItem(doc);
sampleItem->setLoremIpsum(2);
sampleItem->cleanupTemporary();
 
/branches/Version13x/Scribus/scribus/story.cpp
51,7 → 51,7
#include "prefsfile.h"
#include "scmessagebox.h"
#include "scraction.h"
#include "scribus.h"
#include "scribuscore.h"
#include "search.h"
#include "serializer.h"
#include "shadebutton.h"
747,7 → 747,7
if (ch == SpecialChars::OBJECT)
{
PageItem* embedded = chars->at(c)->cembedded;
currItem->document()->FrameItems.append(embedded);
currItem->doc()->FrameItems.append(embedded);
if (embedded->Groups.count() != 0)
{
for (uint ga=0; ga<FrameItems.count(); ++ga)
758,8 → 758,8
{
if (FrameItems.at(ga)->ItemNr != embedded->ItemNr)
{
if (currItem->document()->FrameItems.find(FrameItems.at(ga)) == -1)
currItem->document()->FrameItems.append(FrameItems.at(ga));
if (currItem->doc()->FrameItems.find(FrameItems.at(ga)) == -1)
currItem->doc()->FrameItems.append(FrameItems.at(ga));
}
}
}
1028,7 → 1028,7
if (tx[a] == QChar(13))
{
StyledText.append(chars);
ParagStyles.append(findParagraphStyle(currItem->document(), currItem->currentStyle()));
ParagStyles.append(findParagraphStyle(currItem->doc(), currItem->currentStyle()));
chars = new ChList;
chars->setAutoDelete(true);
chars->clear();
1047,7 → 1047,7
}
insert(Text);
StyledText.append(chars);
ParagStyles.append(findParagraphStyle(currItem->document(), currItem->currentStyle()));
ParagStyles.append(findParagraphStyle(currItem->doc(), currItem->currentStyle()));
if (StyledText.count() != 0)
emit setProps(0, 0);
setUpdatesEnabled(true);
2028,7 → 2028,7
 
void StoryEditor::buildMenus()
{
seMenuMgr = new MenuManager(this->menuBar());
seMenuMgr = new MenuManager(this->menuBar(), this->menuBar());
seMenuMgr->createMenu("File", tr("&File"));
seMenuMgr->addMenuItem(seActions["fileNew"], "File");
seMenuMgr->addMenuItem(seActions["fileRevert"], "File");
2695,7 → 2695,7
Editor->CurrFont = curstyle.font()->scName();
Editor->CurrFontSize = curstyle.fontSize();
Editor->CurrentStyle = curstyle.effects();
Editor->currentParaStyle = findParagraphStyle(currItem->document(), currItem->itemText.defaultStyle());
Editor->currentParaStyle = findParagraphStyle(currItem->doc(), currItem->itemText.defaultStyle());
Editor->CurrTextKern = curstyle.tracking();
Editor->CurrTextScale = curstyle.scaleH();
Editor->CurrTextScaleV = curstyle.scaleV();
2922,9 → 2922,9
charSelect = new CharSelect(this, currItem, Editor->CurrFont, false);
connect(charSelect, SIGNAL(insertSpecialChar()), this, SLOT(slot_insertSpecialChar()));
}
if (charSelect->ite != currItem)
if (charSelect->item() != currItem)
{
charSelect->ite = currItem;
charSelect->setItem(currItem);
rescan = true;
}
if (charSelect->fontInUse != Editor->CurrFont)
3027,7 → 3027,7
void StoryEditor::Do_saveDocument()
{
updateTextFrame();
ScMW->slotFileSave();
ScCore->primaryMainWindow()->slotFileSave();
}
 
bool StoryEditor::Do_new()
3214,7 → 3214,7
nb2->Dirty = false;
nb2 = nb2->NextBox;
}
ScMW->view->DrawNew();
ScCore->primaryMainWindow()->view->DrawNew();
textChanged = false;
seActions["fileRevert"]->setEnabled(false);
seActions["editUpdateFrame"]->setEnabled(false);
3246,10 → 3246,10
//emit EditSt();
 
StilFormate *dia = new StilFormate(this, currDoc);
connect(dia, SIGNAL(saveStyle(StilFormate *)), ScMW, SLOT(saveStyles(StilFormate *)));
connect(dia, SIGNAL(saveStyle(StilFormate *)), ScCore->primaryMainWindow(), SLOT(saveStyles(StilFormate *)));
if (dia->exec())
ScMW->saveStyles(dia);
disconnect(dia, SIGNAL(saveStyle(StilFormate *)), ScMW, SLOT(saveStyles(StilFormate *)));
ScCore->primaryMainWindow()->saveStyles(dia);
disconnect(dia, SIGNAL(saveStyle(StilFormate *)), ScCore->primaryMainWindow(), SLOT(saveStyles(StilFormate *)));
delete dia;
 
AlignTools->Spal->setFormats(currDoc);
3631,5 → 3631,5
void StoryEditor::updateUnicodeActions()
{
if (Editor->prevFont!=Editor->CurrFont)
ScMW->actionManager->enableUnicodeActions(&seActions, true, Editor->CurrFont);
ScCore->primaryMainWindow()->actionManager->enableUnicodeActions(&seActions, true, Editor->CurrFont);
}
/branches/Version13x/Scribus/scribus/tabtools.cpp
909,7 → 909,7
 
void TabTools::setSample()
{
SampleItem *si = new SampleItem();
SampleItem *si = new SampleItem(docu);
si->setText(tr("Woven silk pyjamas exchanged for blue quartz"));
if (colorComboTextBackground->currentText() != CommonStrings::NoneColor)
{
/branches/Version13x/Scribus/scribus/pageitem.h
830,7 → 830,7
/**
* @brief Get the document that this item belongs to
*/
ScribusDoc* document();
ScribusDoc* doc() const { return m_Doc; }
bool isAnnotation() const { return m_isAnnotation; }
void setIsAnnotation(bool);
/branches/Version13x/Scribus/scribus/menumanager.h
26,11 → 26,13
#include <qptrlist.h>
#include <qpoint.h>
 
class QMenuBar;
class QPopupMenu;
 
#include "scribusapi.h"
class ScrAction;
class ScrPopupMenu;
class ScribusMainWindow;
 
/**
@author Craig Bradney
39,7 → 41,7
{
Q_OBJECT
public:
MenuManager(QMenuBar *scrMenuBar, QObject *parent = 0, const char *name = 0);
MenuManager(QMenuBar* mb, QObject *parent = 0, const char *name = 0);
~MenuManager();
 
enum MenuType {Normal, DLL};
/branches/Version13x/Scribus/scribus/gtwriter.h
42,7 → 42,7
class SCRIBUS_API gtWriter
{
public:
gtWriter(bool append);
// gtWriter(bool append);
gtWriter(bool append, PageItem *pageitem);
~gtWriter();
gtFrameStyle* getDefaultStyle();
/branches/Version13x/Scribus/scribus/picstatus.cpp
36,7 → 36,7
#include "scribusview.h"
#include "pageitem.h"
#include "filesearch.h"
#include "scribus.h"
#include "scribuscore.h"
extern QPixmap loadIcon(QString nam);
 
 
228,7 → 228,7
QString pageText = PicTable->text(QString(sender()->name()).toInt(), 2);
bool ok = false;
int pageNum = pageText.toInt(&ok);
ScMW->closeActiveWindowMasterPageEditor();
ScCore->primaryMainWindow()->closeActiveWindowMasterPageEditor();
if (!ok)
emit selectMasterPage(pageText);
else
/branches/Version13x/Scribus/scribus/seiten.cpp
460,6 → 460,7
 
PagePalette::PagePalette(QWidget* parent) : ScrPaletteBase( parent, "SP", false, 0)
{
m_scMW=(ScribusMainWindow*)parent;
setIcon(loadIcon("AppIcon.png"));
PagePaletteLayout = new QVBoxLayout( this );
PagePaletteLayout->setSpacing( 5 );
531,13 → 532,12
connect(Trash, SIGNAL(DelMaster(QString)), this, SLOT(DelMPage(QString)));
connect(pageLayout, SIGNAL(selectedLayout(int )), this, SLOT(handlePageLayout(int )));
connect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
connect(this, SIGNAL(EditTemp(QString)), m_scMW, SLOT(manageMasterPages(QString)));
connect(pageView, SIGNAL(UseTemp(QString, int)), m_scMW, SLOT(Apply_MasterPage(QString, int)));
connect(pageView, SIGNAL(NewPage(int, QString)), m_scMW, SLOT(slotNewPageP(int, QString)));
connect(Trash, SIGNAL(DelPage(int)), m_scMW, SLOT(DeletePage2(int)));
connect(this, SIGNAL(GotoSeite(int)), m_scMW, SLOT(selectPagesFromOutlines(int)));
connect(this, SIGNAL(EditTemp(QString)), ScMW, SLOT(manageMasterPages(QString)));
connect(pageView, SIGNAL(UseTemp(QString, int)), ScMW, SLOT(Apply_MasterPage(QString, int)));
connect(pageView, SIGNAL(NewPage(int, QString)), ScMW, SLOT(slotNewPageP(int, QString)));
connect(Trash, SIGNAL(DelPage(int)), ScMW, SLOT(DeletePage2(int)));
connect(this, SIGNAL(GotoSeite(int)), ScMW, SLOT(selectPagesFromOutlines(int)));
QToolTip::add(Trash, "<qt>" + tr("Drag pages or master pages onto the trashbin to delete them") + "</qt>");
QToolTip::add(masterPageList, "<qt>" + tr("Here are all your master pages. To create a new page, drag a master page to the page view below") + "</qt>");
}
639,7 → 639,7
 
void PagePalette::RebuildTemp()
{
if (ScMW->ScriptRunning)
if (m_scMW->ScriptRunning)
return;
masterPageList->clear();
if (currView == 0)
660,7 → 660,7
 
void PagePalette::RebuildPage()
{
if (ScMW->ScriptRunning)
if (m_scMW->ScriptRunning)
return;
QString str;
disconnect(pageLayout, SIGNAL(selectedLayout(int )), this, SLOT(handlePageLayout(int )));
/branches/Version13x/Scribus/scribus/guidemanager.cpp
24,7 → 24,8
 
#include "guidemanager.h"
#include "guidemanager.moc"
#include "scribus.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "selection.h"
#include "page.h"
#include "units.h"
67,7 → 68,8
 
 
GuideManager::GuideManager(QWidget* parent) :
GuideManagerBase(parent, "GuideManager")//,
GuideManagerBase(parent, "GuideManager"),
m_Doc(0)//,
//ScrPaletteBase(parent, "GuideManager", false, 0)
{
setIcon(loadIcon("AppIcon.png"));
81,10 → 83,17
connect(verticalAutoGapSpin, SIGNAL(valueChanged(int)), this, SLOT(verticalAutoGapSpin_valueChanged(int)));
}
 
void GuideManager::setDoc(ScribusDoc* doc)
{
m_Doc=doc;
}
 
void GuideManager::setupPage()
{
if (!m_Doc)
return;
setEnabled(true);
currentPage = ScMW->doc->currentPage();
currentPage = m_Doc->currentPage();
unitChange();
resetMarginsForPage();
clearRestoreHorizontalList();
93,7 → 102,9
 
void GuideManager::unitChange()
{
docUnitIndex = ScMW->doc->unitIndex();
if (!m_Doc)
return;
docUnitIndex = m_Doc->unitIndex();
docUnitPrecision = unitGetPrecisionFromIndex(docUnitIndex);
docUnitRatio = unitGetRatioFromIndex(docUnitIndex);
docUnitDecimals = unitGetDecimalsFromIndex(docUnitIndex);
209,24 → 220,22
FPoint selectionTopLeft = FPoint(0, 0);
FPoint selectionBottomRight = FPoint(0, 0);
 
int docSelectionCount = ScMW->doc->m_Selection->count();
int docSelectionCount = m_Doc->m_Selection->count();
// allow the selection radio button?
(docSelectionCount > 0) ?
selectionAutoButton->setEnabled(false) :
selectionAutoButton->setEnabled(true);
selectionAutoButton->setEnabled((docSelectionCount <= 0));
 
// multiselection
if (docSelectionCount > 1)
{
selectionTopLeft.setXY(ScMW->view->GroupX - currentPage->xOffset(),
ScMW->view->GroupY - currentPage->yOffset());
selectionBottomRight.setXY(ScMW->view->GroupW,
ScMW->view->GroupH);
selectionTopLeft.setXY(m_Doc->view()->GroupX - currentPage->xOffset(),
m_Doc->view()->GroupY - currentPage->yOffset());
selectionBottomRight.setXY(m_Doc->view()->GroupW,
m_Doc->view()->GroupH);
}
// only one item selected
else if (docSelectionCount == 1)
{
PageItem *currItem = ScMW->doc->m_Selection->itemAt(0);
PageItem *currItem = m_Doc->m_Selection->itemAt(0);
selectionTopLeft.setXY(currItem->xPos() - currentPage->xOffset(),
currItem->yPos() - currentPage->yOffset());
selectionBottomRight.setXY(currItem->width(), currItem->height());
242,23 → 251,23
}
else selected = false;
 
locTop = ScMW->doc->pageMargins.Top;
locBottom = ScMW->doc->pageMargins.Bottom;
locTop = m_Doc->pageMargins.Top;
locBottom = m_Doc->pageMargins.Bottom;
 
PageLocation pageLocation = ScMW->doc->locationOfPage(ScMW->doc->currentPageNumber());
PageLocation pageLocation = m_Doc->locationOfPage(m_Doc->currentPageNumber());
switch (pageLocation)
{
case MiddlePage :
locLeft = ScMW->doc->pageMargins.Left;
locRight = ScMW->doc->pageMargins.Left;
locLeft = m_Doc->pageMargins.Left;
locRight = m_Doc->pageMargins.Left;
break;
case LeftPage:
locLeft = ScMW->doc->pageMargins.Right;
locRight = ScMW->doc->pageMargins.Left;
locLeft = m_Doc->pageMargins.Right;
locRight = m_Doc->pageMargins.Left;
break;
case RightPage:
locRight = ScMW->doc->pageMargins.Right;
locLeft = ScMW->doc->pageMargins.Left;
locRight = m_Doc->pageMargins.Right;
locLeft = m_Doc->pageMargins.Left;
break;
default:
locRight = 0;
285,12 → 294,12
 
void GuideManager::lockCheck_stateChanged( int )
{
ScMW->doc->lockGuides(lockCheck->isChecked());
m_Doc->lockGuides(lockCheck->isChecked());
}
 
void GuideManager::copyGuidesToAllPages(GuideManagerCore::GuideType t)
{
QPtrListIterator<Page> it(*ScMW->doc->Pages);
QPtrListIterator<Page> it(*m_Doc->Pages);
Page *tmpPage;
while ((tmpPage = it.current()) != 0 )
{
375,7 → 384,7
double rowSize;
if (horizontalAutoGapCheck->isChecked())
{
gapValue = value2pts(horizontalAutoGapSpin->value(), ScMW->doc->unitIndex());
gapValue = value2pts(horizontalAutoGapSpin->value(), m_Doc->unitIndex());
rowSize = (newPageHeight - (value - 1) * gapValue) / value;
}
else
421,7 → 430,7
double columnSize;
if (verticalAutoGapCheck->isChecked())
{
gapValue = value2pts(horizontalAutoGapSpin->value(), ScMW->doc->unitIndex());
gapValue = value2pts(horizontalAutoGapSpin->value(), m_Doc->unitIndex());
columnSize = (newPageWidth - (value - 1) * gapValue) / value;
}
else
513,7 → 522,7
 
void GuideManager::drawGuides()
{
ScMW->view->DrawNew();
ScCore->primaryMainWindow()->view->DrawNew();
}
 
void GuideManager::clearRestoreHorizontalList()
/branches/Version13x/Scribus/scribus/pageitem.cpp
2096,8 → 2096,8
bool PageItem::shouldCheck()
{
return ((!m_Doc->view()->mousePressed()) &&
(!ScMW->arrowKeyDown()) &&
(!ScMW->propertiesPalette->userActionOn()));
(!ScCore->primaryMainWindow()->arrowKeyDown()) &&
(!ScCore->primaryMainWindow()->propertiesPalette->userActionOn()));
}
 
void PageItem::moveUndoAction()
2613,7 → 2613,7
case Polygon: view->ToPolyFrame(); break;
case PolyLine: view->ToBezierFrame(); break;
}
ScMW->setAppMode(modeNormal);
m_Doc->scMW()->setAppMode(modeNormal);
}
 
void PageItem::restoreTextFlowing(SimpleState *state, bool isUndo)
3126,7 → 3126,8
if (gsResolution==-1) //If it wasn't supplied, get it from PrefsManager.
gsRes=PrefsManager::instance()->gsResolution();
bool dummy;
if (!pixm.LoadPicture(filename, IProfile, IRender, UseEmbedded, true, ScImage::RGBProof, gsRes, &dummy))
CMSettings cms(m_Doc, IProfile);
if (!pixm.LoadPicture(filename, cms, IRender, UseEmbedded, true, ScImage::RGBProof, gsRes, &dummy))
{
Pfile = fi.absFilePath();
PicAvail = false;
3416,52 → 3417,52
return false;
if (!m_Doc->m_Selection->primarySelectionIs(this))
return false;
 
connect(this, SIGNAL(myself(PageItem *)), ScMW->propertiesPalette, SLOT(SetCurItem(PageItem *)));
connect(this, SIGNAL(frameType(int)), ScMW, SLOT(HaveNewSel(int)));
Mpalette* pp=m_Doc->scMW()->propertiesPalette;
connect(this, SIGNAL(myself(PageItem *)), pp, SLOT(SetCurItem(PageItem *)));
connect(this, SIGNAL(frameType(int)), m_Doc->scMW(), SLOT(HaveNewSel(int)));
connect(this, SIGNAL(frameType(int)), m_Doc->view(), SLOT(selectionChanged()));
connect(this, SIGNAL(frameType(int)), ScMW->propertiesPalette, SLOT(NewSel(int)));
connect(this, SIGNAL(frameLocked(bool)), ScMW->propertiesPalette, SLOT(setLocked(bool)));
connect(this, SIGNAL(frameSizeLocked(bool)), ScMW->propertiesPalette, SLOT(setSizeLocked(bool)));
connect(this, SIGNAL(frameFlippedH(bool)), ScMW->propertiesPalette, SLOT(setFlippedH(bool)));
connect(this, SIGNAL(frameFlippedV(bool)), ScMW->propertiesPalette, SLOT(setFlippedV(bool)));
connect(this, SIGNAL(printEnabled(bool)), ScMW->propertiesPalette, SLOT(setPrintingEnabled(bool)));
connect(this, SIGNAL(position(double, double)), ScMW->propertiesPalette, SLOT(setXY(double, double)));
connect(this, SIGNAL(widthAndHeight(double, double)), ScMW->propertiesPalette, SLOT(setBH(double, double)));
connect(this, SIGNAL(colors(QString, QString, int, int)), ScMW, SLOT(setCSMenu(QString, QString, int, int)));
connect(this, SIGNAL(colors(QString, QString, int, int)), ScMW->propertiesPalette->Cpal, SLOT(setActFarben(QString, QString, int, int)));
connect(this, SIGNAL(gradientType(int)), ScMW->propertiesPalette->Cpal, SLOT(setActGradient(int)));
connect(this, SIGNAL(gradientColorUpdate(double, double, double, double, double, double)), ScMW->propertiesPalette->Cpal, SLOT(setSpecialGradient(double, double, double, double, double, double)));
connect(this, SIGNAL(rotation(double)), ScMW->propertiesPalette, SLOT(setR(double)));
connect(this, SIGNAL(transparency(double, double)), ScMW->propertiesPalette->Cpal, SLOT(setActTrans(double, double)));
connect(this, SIGNAL(blendmode(int, int)), ScMW->propertiesPalette->Cpal, SLOT(setActBlend(int, int)));
connect(this, SIGNAL(frameType(int)), pp, SLOT(NewSel(int)));
connect(this, SIGNAL(frameLocked(bool)), pp, SLOT(setLocked(bool)));
connect(this, SIGNAL(frameSizeLocked(bool)), pp, SLOT(setSizeLocked(bool)));
connect(this, SIGNAL(frameFlippedH(bool)), pp, SLOT(setFlippedH(bool)));
connect(this, SIGNAL(frameFlippedV(bool)), pp, SLOT(setFlippedV(bool)));
connect(this, SIGNAL(printEnabled(bool)), pp, SLOT(setPrintingEnabled(bool)));
connect(this, SIGNAL(position(double, double)), pp, SLOT(setXY(double, double)));
connect(this, SIGNAL(widthAndHeight(double, double)), pp, SLOT(setBH(double, double)));
connect(this, SIGNAL(colors(QString, QString, int, int)), m_Doc->scMW(), SLOT(setCSMenu(QString, QString, int, int)));
connect(this, SIGNAL(colors(QString, QString, int, int)), pp->Cpal, SLOT(setActFarben(QString, QString, int, int)));
connect(this, SIGNAL(gradientType(int)), pp->Cpal, SLOT(setActGradient(int)));
connect(this, SIGNAL(gradientColorUpdate(double, double, double, double, double, double)), pp->Cpal, SLOT(setSpecialGradient(double, double, double, double, double, double)));
connect(this, SIGNAL(rotation(double)), pp, SLOT(setR(double)));
connect(this, SIGNAL(transparency(double, double)), pp->Cpal, SLOT(setActTrans(double, double)));
connect(this, SIGNAL(blendmode(int, int)), pp->Cpal, SLOT(setActBlend(int, int)));
//Shape signals
//Not connected when transferring code: void columns(int, double); //Number, gap
connect(this, SIGNAL(cornerRadius(double)), ScMW->propertiesPalette, SLOT(setRR(double)));
connect(this, SIGNAL(cornerRadius(double)), pp, SLOT(setRR(double)));
// connect(view, SIGNAL(ItemTextCols(int, double)), propertiesPalette, SLOT(setCols(int, double)));
//Line signals
connect(this, SIGNAL(lineWidth(double)), ScMW->propertiesPalette, SLOT(setSvalue(double)));
connect(this, SIGNAL(imageOffsetScale(double, double, double, double)), ScMW->propertiesPalette, SLOT(setLvalue(double, double, double, double)));
connect(this, SIGNAL(lineStyleCapJoin(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)), ScMW->propertiesPalette, SLOT( setLIvalue(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)));
connect(this, SIGNAL(lineWidth(double)), pp, SLOT(setSvalue(double)));
connect(this, SIGNAL(imageOffsetScale(double, double, double, double)), pp, SLOT(setLvalue(double, double, double, double)));
connect(this, SIGNAL(lineStyleCapJoin(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)), pp, SLOT( setLIvalue(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)));
//Frame text signals
connect(this, SIGNAL(lineSpacing(double)), ScMW->propertiesPalette, SLOT(setLsp(double)));
connect(this, SIGNAL(textToFrameDistances(double, double, double, double)), ScMW->propertiesPalette, SLOT(setDvals(double, double, double, double)));
connect(this, SIGNAL(textKerning(int)), ScMW->propertiesPalette, SLOT(setExtra(int)));
connect(this, SIGNAL(textStyle(int)), ScMW->propertiesPalette, SLOT(setStil(int)));
connect(this, SIGNAL(textStyle(int)), ScMW, SLOT(setStilvalue(int)));
connect(this, SIGNAL(textFont(QString)), ScMW, SLOT(AdjustFontMenu(QString)));
connect(this, SIGNAL(textFont(QString)), ScMW->propertiesPalette, SLOT(setFontFace(QString)));
connect(this, SIGNAL(textSize(int)), ScMW->propertiesPalette, SLOT(setSize(int)));
connect(this, SIGNAL(textSize(int)), ScMW, SLOT(setFSizeMenu(int)));
connect(this, SIGNAL(textWidthScale(int)), ScMW->propertiesPalette, SLOT(setTScale(int)));
connect(this, SIGNAL(textHeightScale(int)), ScMW->propertiesPalette, SLOT(setTScaleV(int)));
connect(this, SIGNAL(textBaseLineOffset(int)), ScMW->propertiesPalette, SLOT(setTBase(int)));
connect(this, SIGNAL(textOutline(int)), ScMW->propertiesPalette, SLOT(setOutlineW(int)));
connect(this, SIGNAL(textShadow(int, int )), ScMW->propertiesPalette, SLOT(setShadowOffs(int, int )));
connect(this, SIGNAL(textUnderline(int, int)), ScMW->propertiesPalette, SLOT(setUnderline(int, int)));
connect(this, SIGNAL(textStrike(int, int)), ScMW->propertiesPalette, SLOT(setStrike(int, int)));
connect(this, SIGNAL(textColor(QString, QString, int, int)), ScMW->propertiesPalette, SLOT(setActFarben(QString, QString, int, int)));
// connect(this, SIGNAL(textFormatting(int)), ScMW->propertiesPalette, SLOT(setAli(int)));
connect(this, SIGNAL(lineSpacing(double)), pp, SLOT(setLsp(double)));
connect(this, SIGNAL(textToFrameDistances(double, double, double, double)), pp, SLOT(setDvals(double, double, double, double)));
connect(this, SIGNAL(textKerning(int)), pp, SLOT(setExtra(int)));
connect(this, SIGNAL(textStyle(int)), pp, SLOT(setStil(int)));
connect(this, SIGNAL(textStyle(int)), m_Doc->scMW(), SLOT(setStilvalue(int)));
connect(this, SIGNAL(textFont(QString)), m_Doc->scMW(), SLOT(AdjustFontMenu(QString)));
connect(this, SIGNAL(textFont(QString)), pp, SLOT(setFontFace(QString)));
connect(this, SIGNAL(textSize(int)), pp, SLOT(setSize(int)));
connect(this, SIGNAL(textSize(int)), m_Doc->scMW(), SLOT(setFSizeMenu(int)));
connect(this, SIGNAL(textWidthScale(int)), pp, SLOT(setTScale(int)));
connect(this, SIGNAL(textHeightScale(int)), pp, SLOT(setTScaleV(int)));
connect(this, SIGNAL(textBaseLineOffset(int)), pp, SLOT(setTBase(int)));
connect(this, SIGNAL(textOutline(int)), pp, SLOT(setOutlineW(int)));
connect(this, SIGNAL(textShadow(int, int )), pp, SLOT(setShadowOffs(int, int )));
connect(this, SIGNAL(textUnderline(int, int)), pp, SLOT(setUnderline(int, int)));
connect(this, SIGNAL(textStrike(int, int)), pp, SLOT(setStrike(int, int)));
connect(this, SIGNAL(textColor(QString, QString, int, int)), pp, SLOT(setActFarben(QString, QString, int, int)));
// connect(this, SIGNAL(textFormatting(int)), pp, SLOT(setAli(int)));
// connect(this, SIGNAL(textFormatting(int)), ScMW, SLOT(setAbsValue(int)));
 
return true;
3525,11 → 3526,6
}
}
 
ScribusDoc* PageItem::document()
{
return m_Doc;
}
 
void PageItem::setIsAnnotation(bool isAnnot)
{
m_isAnnotation=isAnnot;
/branches/Version13x/Scribus/scribus/scribusdoc.h
64,6 → 64,7
class Hyphenator;
class Selection;
class ScribusView;
class ScribusMainWindow;
 
class QProgressBar;
 
90,6 → 91,8
* @brief Return the view associated with the document
*/
ScribusView* view() const;
ScribusMainWindow* scMW() const {return m_ScMW;}
void setGUI(ScribusMainWindow* mw, ScribusView* view);
// Add, delete and move pages
660,6 → 663,10
void recalcPicturesRes();
void connectDocSignals();
void removeLayer(int l, bool dl = false); //FIXME: Make protected once scripter function no longer uses this directly
/*! \brief We call changed() whenever the document needs to know it has been changed.
* If the document is the primary document in a main window, it will signal to enable/disable
* certain operations.
*/
void changed();
/*! \brief Get pointer to the current page
\retval Page* current page object */
680,6 → 687,8
bool automaticTextFrames; // Flag for automatic Textframes
bool m_masterPageMode;
QMap<QString, double> m_constants;
ScribusMainWindow* m_ScMW;
ScribusView* m_View;
public: // Public attributes
bool is12doc; //public for now, it will be removed later
843,7 → 852,7
FPointArray symNewCol;
FPointArray symNewFrame;
Hyphenator * const docHyphenator;
Hyphenator * docHyphenator;
private:
bool _itemCreationTransactionStarted;
Page* _currentPage;
/branches/Version13x/Scribus/scribus/scribusview.cpp
106,8 → 106,8
 
 
 
ScribusView::ScribusView(QWidget *parent, ScribusDoc *doc) :
QScrollView(parent, "s", WRepaintNoErase | WNorthWestGravity),
ScribusView::ScribusView(QWidget* win, ScribusMainWindow* mw, ScribusDoc *doc) :
QScrollView(win, "s", WRepaintNoErase | WNorthWestGravity),
Doc(doc),
Prefs(&(PrefsManager::instance()->appPrefs)),
undoManager(UndoManager::instance()),
148,7 → 148,8
forceRedraw(false),
Scale(Prefs->DisScale),
m_vhRulerHW(17),
m_cursorVisible(false)
m_cursorVisible(false),
m_ScMW(mw)
{
setHScrollBarMode(QScrollView::AlwaysOn);
setVScrollBarMode(QScrollView::AlwaysOn);
219,7 → 220,7
storedFramesShown = Doc->guidesSettings.framesShown;
viewAsPreview = false;
#ifdef HAVE_CAIRO
ScMW->scrActions["viewFit20"]->setOn(viewAsPreview);
m_ScMW->scrActions["viewFit20"]->setOn(viewAsPreview);
#endif
connect(zoomOutToolbarButton, SIGNAL(clicked()), this, SLOT(slotZoomOut()));
connect(zoomInToolbarButton, SIGNAL(clicked()), this, SLOT(slotZoomIn()));
257,16 → 258,16
}
else
Doc->guidesSettings.framesShown = storedFramesShown;
ScMW->scrActions["viewFit20"]->setOn(viewAsPreview);
ScMW->scrActions["viewShowMargins"]->setEnabled(!viewAsPreview);
ScMW->scrActions["viewShowFrames"]->setEnabled(!viewAsPreview);
ScMW->scrActions["viewShowLayerMarkers"]->setEnabled(!viewAsPreview);
ScMW->scrActions["viewShowGrid"]->setEnabled(!viewAsPreview);
ScMW->scrActions["viewShowGuides"]->setEnabled(!viewAsPreview);
ScMW->scrActions["viewShowColumnBorders"]->setEnabled(!viewAsPreview);
ScMW->scrActions["viewShowBaseline"]->setEnabled(!viewAsPreview);
ScMW->scrActions["viewShowTextChain"]->setEnabled(!viewAsPreview);
ScMW->scrActions["viewShowTextControls"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewFit20"]->setOn(viewAsPreview);
m_ScMW->scrActions["viewShowMargins"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowFrames"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowLayerMarkers"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowGrid"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowGuides"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowColumnBorders"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowBaseline"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowTextChain"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowTextControls"]->setEnabled(!viewAsPreview);
updateContents();
}
 
1065,7 → 1066,7
/*<< #3524
setActiveWindow();
raise();
ScMW->newActWin(Doc->WinHan);
m_ScMW->newActWin(Doc->WinHan);
updateContents();
>>*/
// SeleItemPos(e->pos());
1180,7 → 1181,7
//<<#3524
setActiveWindow();
raise();
ScMW->newActWin(Doc->WinHan);
m_ScMW->newActWin(Doc->WinHan);
updateContents();
//>>
QUrl ur(text);
1624,7 → 1625,7
{
if ((m->state() & Qt::RightButton) && (m->state() & Qt::ControlButton))
{
ScMW->setAppMode(modeNormal);
m_ScMW->setAppMode(modeNormal);
}
return;
}
1877,7 → 1878,7
if ((!GetItem(&currItem)) && (m->button() == RightButton) && (!Doc->DragP) && (Doc->appMode == modeNormal))
{
QPopupMenu *pmen = new QPopupMenu();
if (ScMW->Buffer2.startsWith("<SCRIBUSELEM"))
if (m_ScMW->Buffer2.startsWith("<SCRIBUSELEM"))
{
Mxp = m->x();
Myp = m->y();
1885,27 → 1886,27
pmen->insertSeparator();
}
setObjectUndoMode();
ScMW->scrActions["editUndoAction"]->addTo(pmen);
ScMW->scrActions["editRedoAction"]->addTo(pmen);
m_ScMW->scrActions["editUndoAction"]->addTo(pmen);
m_ScMW->scrActions["editRedoAction"]->addTo(pmen);
pmen->insertSeparator();
ScMW->scrActions["viewShowMargins"]->addTo(pmen);
ScMW->scrActions["viewShowFrames"]->addTo(pmen);
ScMW->scrActions["viewShowLayerMarkers"]->addTo(pmen);
ScMW->scrActions["viewShowImages"]->addTo(pmen);
ScMW->scrActions["viewShowGrid"]->addTo(pmen);
ScMW->scrActions["viewShowGuides"]->addTo(pmen);
ScMW->scrActions["viewShowBaseline"]->addTo(pmen);
ScMW->scrActions["viewShowTextChain"]->addTo(pmen);
ScMW->scrActions["viewRulerMode"]->addTo(pmen);
m_ScMW->scrActions["viewShowMargins"]->addTo(pmen);
m_ScMW->scrActions["viewShowFrames"]->addTo(pmen);
m_ScMW->scrActions["viewShowLayerMarkers"]->addTo(pmen);
m_ScMW->scrActions["viewShowImages"]->addTo(pmen);
m_ScMW->scrActions["viewShowGrid"]->addTo(pmen);
m_ScMW->scrActions["viewShowGuides"]->addTo(pmen);
m_ScMW->scrActions["viewShowBaseline"]->addTo(pmen);
m_ScMW->scrActions["viewShowTextChain"]->addTo(pmen);
m_ScMW->scrActions["viewRulerMode"]->addTo(pmen);
pmen->insertSeparator();
// pmen->insertItem( tr("Unit"), unitSwitcher);
// pmen->insertSeparator();
ScMW->scrActions["viewSnapToGrid"]->addTo(pmen);
ScMW->scrActions["viewSnapToGuides"]->addTo(pmen);
m_ScMW->scrActions["viewSnapToGrid"]->addTo(pmen);
m_ScMW->scrActions["viewSnapToGuides"]->addTo(pmen);
pmen->insertSeparator();
ScMW->scrActions["pageApplyMasterPage"]->addTo(pmen);
ScMW->scrActions["pageManageGuides"]->addTo(pmen);
ScMW->scrActions["pageManageMargins"]->addTo(pmen);
m_ScMW->scrActions["pageApplyMasterPage"]->addTo(pmen);
m_ScMW->scrActions["pageManageGuides"]->addTo(pmen);
m_ScMW->scrActions["pageManageMargins"]->addTo(pmen);
pmen->exec(QCursor::pos());
setGlobalUndoMode();
delete pmen;
2053,12 → 2054,12
 
pmen4->insertItem(InfoGroup);
if ((currItem->itemType() == PageItem::ImageFrame) && (currItem->pixm.imgInfo.exifDataValid))
ScMW->scrActions["itemImageInfo"]->addTo(pmen4);
m_ScMW->scrActions["itemImageInfo"]->addTo(pmen4);
pmen->insertItem( tr("In&fo"), pmen4);
}
pmen->insertSeparator();
ScMW->scrActions["editUndoAction"]->addTo(pmen);
ScMW->scrActions["editRedoAction"]->addTo(pmen);
m_ScMW->scrActions["editUndoAction"]->addTo(pmen);
m_ScMW->scrActions["editRedoAction"]->addTo(pmen);
if (currItem->itemType() == PageItem::ImageFrame ||
currItem->itemType() == PageItem::TextFrame ||
currItem->itemType() == PageItem::PathText)
2066,58 → 2067,58
pmen->insertSeparator();
if (currItem->itemType() == PageItem::ImageFrame)
{
ScMW->scrActions["fileImportImage"]->addTo(pmen);
ScMW->scrActions["itemImageIsVisible"]->addTo(pmen);
m_ScMW->scrActions["fileImportImage"]->addTo(pmen);
m_ScMW->scrActions["itemImageIsVisible"]->addTo(pmen);
pmen->insertItem( tr("Preview Settings"), pmenResolution);
ScMW->scrActions["itemPreviewLow"]->addTo(pmenResolution);
ScMW->scrActions["itemPreviewNormal"]->addTo(pmenResolution);
ScMW->scrActions["itemPreviewFull"]->addTo(pmenResolution);
m_ScMW->scrActions["itemPreviewLow"]->addTo(pmenResolution);
m_ScMW->scrActions["itemPreviewNormal"]->addTo(pmenResolution);
m_ScMW->scrActions["itemPreviewFull"]->addTo(pmenResolution);
if ((currItem->PicAvail) && (currItem->pixm.imgInfo.valid))
ScMW->scrActions["itemExtendedImageProperties"]->addTo(pmen);
m_ScMW->scrActions["itemExtendedImageProperties"]->addTo(pmen);
if (currItem->PicAvail && currItem->isRaster)
{
ScMW->scrActions["styleImageEffects"]->addTo(pmen);
ScMW->scrActions["editEditWithImageEditor"]->addTo(pmen);
m_ScMW->scrActions["styleImageEffects"]->addTo(pmen);
m_ScMW->scrActions["editEditWithImageEditor"]->addTo(pmen);
}
if (currItem->PicAvail)
ScMW->scrActions["itemUpdateImage"]->addTo(pmen);
m_ScMW->scrActions["itemUpdateImage"]->addTo(pmen);
if ((currItem->PicAvail) && (!currItem->isTableItem))
ScMW->scrActions["itemAdjustFrameToImage"]->addTo(pmen);
m_ScMW->scrActions["itemAdjustFrameToImage"]->addTo(pmen);
}
if (currItem->itemType() == PageItem::TextFrame)
{
ScMW->scrActions["fileImportText"]->addTo(pmen);
ScMW->scrActions["fileImportAppendText"]->addTo(pmen);
ScMW->scrActions["toolsEditWithStoryEditor"]->addTo(pmen);
ScMW->scrActions["insertSampleText"]->addTo(pmen);
m_ScMW->scrActions["fileImportText"]->addTo(pmen);
m_ScMW->scrActions["fileImportAppendText"]->addTo(pmen);
m_ScMW->scrActions["toolsEditWithStoryEditor"]->addTo(pmen);
m_ScMW->scrActions["insertSampleText"]->addTo(pmen);
}
if (currItem->itemType() == PageItem::PathText)
ScMW->scrActions["toolsEditWithStoryEditor"]->addTo(pmen);
m_ScMW->scrActions["toolsEditWithStoryEditor"]->addTo(pmen);
}
pmen->insertSeparator();
ScMW->scrActions["itemAttributes"]->addTo(pmen);
m_ScMW->scrActions["itemAttributes"]->addTo(pmen);
if (currItem->itemType() == PageItem::TextFrame)
{
if (Doc->currentPage()->pageName().isEmpty())
{
ScMW->scrActions["itemPDFIsAnnotation"]->addTo(pmenPDF);
ScMW->scrActions["itemPDFIsBookmark"]->addTo(pmenPDF);
m_ScMW->scrActions["itemPDFIsAnnotation"]->addTo(pmenPDF);
m_ScMW->scrActions["itemPDFIsBookmark"]->addTo(pmenPDF);
if (currItem->isAnnotation())
{
if ((currItem->annotation().Type() == 0) || (currItem->annotation().Type() == 1) || (currItem->annotation().Type() > 9))
ScMW->scrActions["itemPDFAnnotationProps"]->addTo(pmenPDF);
m_ScMW->scrActions["itemPDFAnnotationProps"]->addTo(pmenPDF);
else
ScMW->scrActions["itemPDFFieldProps"]->addTo(pmenPDF);
m_ScMW->scrActions["itemPDFFieldProps"]->addTo(pmenPDF);
}
}
pmen->insertItem( tr("&PDF Options"), pmenPDF);
}
pmen->insertSeparator();
ScMW->scrActions["itemLock"]->addTo(pmen);
ScMW->scrActions["itemLockSize"]->addTo(pmen);
m_ScMW->scrActions["itemLock"]->addTo(pmen);
m_ScMW->scrActions["itemLockSize"]->addTo(pmen);
if (!currItem->isSingleSel)
{
ScMW->scrActions["itemSendToScrapbook"]->addTo(pmen);
m_ScMW->scrActions["itemSendToScrapbook"]->addTo(pmen);
if (Doc->layerCount() > 1)
{
QMap<int,int> layerMap;
2127,10 → 2128,10
while (i>=0)
{
if (Doc->layerLocked(layerMap[i]))
ScMW->scrLayersActions[QString::number(layerMap[i])]->setEnabled(false);
m_ScMW->scrLayersActions[QString::number(layerMap[i])]->setEnabled(false);
else
ScMW->scrLayersActions[QString::number(layerMap[i])]->setEnabled(true);
ScMW->scrLayersActions[QString::number(layerMap[i--])]->addTo(pmen3);
m_ScMW->scrLayersActions[QString::number(layerMap[i])]->setEnabled(true);
m_ScMW->scrLayersActions[QString::number(layerMap[i--])]->addTo(pmen3);
}
 
pmen->insertItem( tr("Send to La&yer"), pmen3);
2155,17 → 2156,17
isGroup = false;
}
if (!isGroup)
ScMW->scrActions["itemGroup"]->addTo(pmen);
m_ScMW->scrActions["itemGroup"]->addTo(pmen);
}
if (currItem->Groups.count() != 0)
ScMW->scrActions["itemUngroup"]->addTo(pmen);
m_ScMW->scrActions["itemUngroup"]->addTo(pmen);
if ((!currItem->isTableItem) && (!currItem->isSingleSel))
{
pmen->insertItem( tr("Le&vel"), pmenLevel);
ScMW->scrActions["itemRaiseToTop"]->addTo(pmenLevel);
ScMW->scrActions["itemRaise"]->addTo(pmenLevel);
ScMW->scrActions["itemLower"]->addTo(pmenLevel);
ScMW->scrActions["itemLowerToBottom"]->addTo(pmenLevel);
m_ScMW->scrActions["itemRaiseToTop"]->addTo(pmenLevel);
m_ScMW->scrActions["itemRaise"]->addTo(pmenLevel);
m_ScMW->scrActions["itemLower"]->addTo(pmenLevel);
m_ScMW->scrActions["itemLowerToBottom"]->addTo(pmenLevel);
}
}
if (Doc->appMode != modeEdit) //Create convertTo Menu
2175,16 → 2176,16
{
insertConvertToMenu=true;
if (currItem->itemType() == PageItem::PathText)
ScMW->scrActions["itemConvertToOutlines"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToOutlines"]->addTo(pmen2);
else
{
if (currItem->isTableItem)
ScMW->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
if ((!currItem->isTableItem) && (currItem->BackBox == 0) && (currItem->NextBox == 0))
{
ScMW->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
ScMW->scrActions["itemConvertToOutlines"]->addTo(pmen2);
ScMW->scrActions["itemConvertToPolygon"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToOutlines"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToPolygon"]->addTo(pmen2);
}
}
}
2191,16 → 2192,16
if (currItem->itemType() == PageItem::ImageFrame)
{
insertConvertToMenu=true;
ScMW->scrActions["itemConvertToTextFrame"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToTextFrame"]->addTo(pmen2);
if (!currItem->isTableItem)
ScMW->scrActions["itemConvertToPolygon"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToPolygon"]->addTo(pmen2);
}
if (currItem->itemType() == PageItem::Polygon)
{
insertConvertToMenu=true;
ScMW->scrActions["itemConvertToBezierCurve"]->addTo(pmen2);
ScMW->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
ScMW->scrActions["itemConvertToTextFrame"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToBezierCurve"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
m_ScMW->scrActions["itemConvertToTextFrame"]->addTo(pmen2);
}
if (insertConvertToMenu)
pmen->insertItem( tr("Conve&rt to"), pmen2);
2207,11 → 2208,11
}
pmen->insertSeparator();
if (!currItem->locked() && !(currItem->isTableItem && currItem->isSingleSel))
ScMW->scrActions["editCut"]->addTo(pmen);
m_ScMW->scrActions["editCut"]->addTo(pmen);
if (!(currItem->isTableItem && currItem->isSingleSel))
ScMW->scrActions["editCopy"]->addTo(pmen);
if ((Doc->appMode == modeEdit) && (ScMW->Buffer2.startsWith("<SCRIBUSTEXT")) && (currItem->itemType() == PageItem::TextFrame))
ScMW->scrActions["editPaste"]->addTo(pmen);
m_ScMW->scrActions["editCopy"]->addTo(pmen);
if ((Doc->appMode == modeEdit) && (m_ScMW->Buffer2.startsWith("<SCRIBUSTEXT")) && (currItem->itemType() == PageItem::TextFrame))
m_ScMW->scrActions["editPaste"]->addTo(pmen);
if (!currItem->locked() && (Doc->appMode != modeEdit) && (!(currItem->isTableItem && currItem->isSingleSel)))
pmen->insertItem( tr("&Delete"), Doc, SLOT(itemSelection_DeleteItem()));
if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame))
2219,14 → 2220,14
pmen->insertItem( tr("Contents"), pmenEditContents);
if (currItem->itemType() == PageItem::ImageFrame)
{
ScMW->scrActions["editCopyContents"]->addTo(pmenEditContents);
ScMW->scrActions["editPasteContents"]->addTo(pmenEditContents);
ScMW->scrActions["editPasteContentsAbs"]->addTo(pmenEditContents);
m_ScMW->scrActions["editCopyContents"]->addTo(pmenEditContents);
m_ScMW->scrActions["editPasteContents"]->addTo(pmenEditContents);
m_ScMW->scrActions["editPasteContentsAbs"]->addTo(pmenEditContents);
}
ScMW->scrActions["editClearContents"]->addTo(pmenEditContents);
m_ScMW->scrActions["editClearContents"]->addTo(pmenEditContents);
}
pmen->insertSeparator();
ScMW->scrActions["toolsProperties"]->addTo(pmen);
m_ScMW->scrActions["toolsProperties"]->addTo(pmen);
 
pmen->exec(QCursor::pos());
setGlobalUndoMode();
3480,7 → 3481,7
Mxp = newX;
Myp = newY;
RefreshItem(currItem);
ScMW->propertiesPalette->updateColorSpecialGradient();
m_ScMW->propertiesPalette->updateColorSpecialGradient();
return;
}
if (m_MouseButtonPressed && (Doc->appMode == modeMeasurementTool))
3506,7 → 3507,7
}
if (m_MouseButtonPressed && (m->state() & Qt::RightButton) && (m->state() & Qt::ControlButton))
{
ScMW->setAppMode(modePanning);
m_ScMW->setAppMode(modePanning);
}
if (m_MouseButtonPressed && (Doc->appMode == modePanning))
{
5117,12 → 5118,12
if (Doc->docHyphenator->AutoCheck)
Doc->docHyphenator->slotHyphenate(currItem);
emit ChBMText(currItem);
ScMW->outlinePalette->BuildTree();
m_ScMW->outlinePalette->BuildTree();
}
else
{
if (ScMW->Buffer2.startsWith("<SCRIBUSTEXT"))
ScMW->slotEditPaste();
if (m_ScMW->Buffer2.startsWith("<SCRIBUSTEXT"))
m_ScMW->slotEditPaste();
}
RefreshItem(currItem);
}
7920,7 → 7921,7
 
void ScribusView::selectionChanged()
{
if (ScMW->isObjectSpecificUndo())
if (m_ScMW->isObjectSpecificUndo())
{
uint docSelectionCount=Doc->m_Selection->count();
if (docSelectionCount == 1)
8516,7 → 8517,7
}
}
}
ScMW->actionManager->setPDFActions(this);
m_ScMW->actionManager->setPDFActions(this);
emit DocChanged();
}
}
8541,7 → 8542,7
}
}
}
ScMW->actionManager->setPDFActions(this);
m_ScMW->actionManager->setPDFActions(this);
emit DocChanged();
}
}
8559,7 → 8560,7
{
if (Doc->sendItemSelectionToBack())
{
ScMW->outlinePalette->BuildTree();
m_ScMW->outlinePalette->BuildTree();
emit LevelChanged(0);
emit DocChanged();
updateContents();
8571,7 → 8572,7
{
if (Doc->bringItemSelectionToFront())
{
ScMW->outlinePalette->BuildTree();
m_ScMW->outlinePalette->BuildTree();
emit LevelChanged(Doc->m_Selection->itemAt(0)->ItemNr);
emit DocChanged();
updateContents();
8628,7 → 8629,7
{
Doc->Items->at(a)->ItemNr = a;
}
ScMW->outlinePalette->BuildTree();
m_ScMW->outlinePalette->BuildTree();
if (wasGUISelection)
tempSelection.setIsGUISelection(true);
*Doc->m_Selection=tempSelection;
8690,7 → 8691,7
{
Doc->Items->at(a)->ItemNr = a;
}
ScMW->outlinePalette->BuildTree();
m_ScMW->outlinePalette->BuildTree();
if (wasGUISelection)
tempSelection.setIsGUISelection(true);
*Doc->m_Selection=tempSelection;
8706,7 → 8707,7
uint ac = Doc->Items->count();
if (UndoManager::undoEnabled())
undoManager->beginTransaction(Doc->currentPage()->getUName(), 0, Um::Paste, "", Um::IPaste);
emit LoadElem(ScMW->Buffer2, Mxp / Scale, Myp / Scale, false, false, Doc, this);
emit LoadElem(m_ScMW->Buffer2, Mxp / Scale, Myp / Scale, false, false, Doc, this);
Doc->DraggedElem = 0;
Doc->DragElements.clear();
updateContents();
8764,7 → 8765,7
 
void ScribusView::setRulerPos(int x, int y)
{
if (ScMW->ScriptRunning)
if (m_ScMW->ScriptRunning)
return;
if (Doc->guidesSettings.rulerMode)
{
8783,7 → 8784,7
horizRuler->repaint();
vertRuler->repaint();
evSpon = true;
QString newStatusBarText;
QString newStatusBarText(" ");
if ((verticalScrollBar()->draggingSlider()) || (horizontalScrollBar()->draggingSlider()))
{
QValueList<int> pag;
8803,7 → 8804,7
if (!pag.isEmpty())
newStatusBarText=( tr("Page %1 to %2").arg(pag.first()).arg(pag.last()));
}
ScMW->mainWindowStatusLabel->setText(newStatusBarText);
m_ScMW->setStatusBarInfoText(newStatusBarText);
}
 
 
8838,7 → 8839,7
void ScribusView::reformPages(bool moveObjects)
{
Doc->reformPages(moveObjects);
if (!ScMW->ScriptRunning)
if (!m_ScMW->ScriptRunning)
setContentsPos(qRound((Doc->currentPage()->xOffset()-10 - Doc->minCanvasCoordinate.x()) * Scale), qRound((Doc->currentPage()->yOffset()-10 - Doc->minCanvasCoordinate.y()) * Scale));
if (!Doc->isLoading())
{
8862,7 → 8863,7
 
void ScribusView::setMenTxt(int Seite)
{
if (ScMW->ScriptRunning)
if (m_ScMW->ScriptRunning)
return;
disconnect(pageSelector, SIGNAL(GotoPage(int)), this, SLOT(GotoPa(int)));
pageSelector->setMaxValue(Doc->masterPageMode() ? 1 : Doc->Pages->count());
8903,7 → 8904,7
rememberPreviousSettings(w / 2 + x,h / 2 + y);
setScale(zoomSpinBox->value() / 100.0 * Prefs->DisScale);
slotDoZoom();
ScMW->setFocus();
m_ScMW->setFocus();
}
 
void ScribusView::slotZoom100()
8953,7 → 8954,7
 
void ScribusView::DrawNew()
{
if (ScMW->ScriptRunning)
if (m_ScMW->ScriptRunning)
return;
evSpon = false;
forceRedraw = true;
8967,7 → 8968,7
 
void ScribusView::SetCCPo(int x, int y)
{
if (ScMW->ScriptRunning)
if (m_ScMW->ScriptRunning)
return;
center(static_cast<int>((x - Doc->minCanvasCoordinate.x()) * Scale), static_cast<int>((y - Doc->minCanvasCoordinate.y())* Scale));
setRulerPos(contentsX(), contentsY());
8975,7 → 8976,7
 
void ScribusView::SetCPo(int x, int y)
{
if (ScMW->ScriptRunning)
if (m_ScMW->ScriptRunning)
return;
setContentsPos(static_cast<int>((x - Doc->minCanvasCoordinate.x()) * Scale), static_cast<int>((y - Doc->minCanvasCoordinate.y())* Scale));
setRulerPos(contentsX(), contentsY());
9008,7 → 9009,7
return;
Doc->setActiveLayer(layerNumber);
//CB TODO fix this to use view calls after 1.3.2 release
ScMW->changeLayer(Doc->activeLayer());
m_ScMW->changeLayer(Doc->activeLayer());
emit changeLA(layerNumber);
}
 
9028,7 → 9029,7
void ScribusView::GotoPage(int Seite)
{
Doc->setCurrentPage(Doc->Pages->at(Seite));
if (ScMW->ScriptRunning)
if (m_ScMW->ScriptRunning)
return;
setMenTxt(Seite);
SetCPo(qRound(Doc->currentPage()->xOffset()-10),qRound(Doc->currentPage()->yOffset()-10));
9277,7 → 9278,7
{
//Doc->Pages->at(pg)->addYGuide(newY-Doc->Pages->at(pg)->yOffset());
Doc->Pages->at(pg)->guides.addHorizontal(newY-Doc->Pages->at(pg)->yOffset(), GuideManagerCore::Standard);
ScMW->guidePalette->clearRestoreHorizontalList();
m_ScMW->guidePalette->clearRestoreHorizontalList();
}
else
{
9304,7 → 9305,7
Doc->currentPage()->guides.deleteHorizontal(
Doc->currentPage()->guides.horizontal(oldIndex, GuideManagerCore::Standard),
GuideManagerCore::Standard);//removeYGuide(oldIndex);
ScMW->guidePalette->clearRestoreHorizontalList();
m_ScMW->guidePalette->clearRestoreHorizontalList();
emit signalGuideInformation(-1, 0.0);
}
}
9324,7 → 9325,7
//Doc->Pages->at(pg)->addXGuide(newX-Doc->Pages->at(pg)->xOffset());
Doc->Pages->at(pg)->guides.addVertical(newX-Doc->Pages->at(pg)->xOffset(),
GuideManagerCore::Standard);
ScMW->guidePalette->clearRestoreVerticalList();
m_ScMW->guidePalette->clearRestoreVerticalList();
}
else
//Doc->Pages->at(pg)->moveXGuide(oldIndex, newX-Doc->Pages->at(pg)->xOffset());
9351,7 → 9352,7
Doc->currentPage()->guides.deleteVertical(
Doc->currentPage()->guides.vertical(oldIndex, GuideManagerCore::Standard),
GuideManagerCore::Standard);
ScMW->guidePalette->clearRestoreVerticalList();
m_ScMW->guidePalette->clearRestoreVerticalList();
emit signalGuideInformation(-1, 0.0);
}
}
9721,7 → 9722,7
currItem->setEndArrowIndex(Buffer->endArrowIndex);
currItem->setReversed(Buffer->Reverse);
currItem->NamedLStyle = Buffer->NamedLStyle;
// currItem->Language = ScMW->GetLang(Buffer->Language);
// currItem->Language = m_ScMW->GetLang(Buffer->Language);
currItem->Cols = Buffer->Cols;
currItem->ColGap = Buffer->ColGap;
if (Buffer->LayerNr != -1)
9946,7 → 9947,7
void ScribusView::TextToPath()
{
#ifndef NLS_PROTO
ScMW->NoFrameEdit();
m_ScMW->NoFrameEdit();
uint selectedItemCount=Doc->m_Selection->count();
if (selectedItemCount != 0)
{
9958,9 → 9959,9
bool cont=false;
if ((!((currItem->asTextFrame()) || (currItem->asPathText()))) || (currItem->isTableItem && currItem->isSingleSel) || (currItem->locked()) || currItem->itemText.length() == 0)
cont=true;
if (currItem==ScMW->storyEditor->currentItem() && Doc==ScMW->storyEditor->currentDocument())
if (currItem==m_ScMW->storyEditor->currentItem() && Doc==m_ScMW->storyEditor->currentDocument())
{
QMessageBox::information(ScMW, tr("Cannot Convert In-Use Item"), "<qt>" + tr("The item %1 is currently being edited by Story Editor. The convert to outlines operation for this item will be skipped").arg(currItem->itemName()) + "</qt>", QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
QMessageBox::information(m_ScMW, tr("Cannot Convert In-Use Item"), "<qt>" + tr("The item %1 is currently being edited by Story Editor. The convert to outlines operation for this item will be skipped").arg(currItem->itemName()) + "</qt>", QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
cont=true;
}
//Deselect();
10249,9 → 10250,10
void ScribusView::setObjectUndoMode()
{
_isGlobalMode = undoManager->isGlobalMode();
if (ScMW->HaveDoc)
if (m_ScMW->HaveDoc)
{
ScMW->scrActions["editActionMode"]->setOn(true);
qDebug(QString("%1 %2").arg((int)m_ScMW).arg(m_ScMW->scrActions.contains("editActionMode")));
m_ScMW->scrActions["editActionMode"]->setOn(true);
uint docSelectionCount=Doc->m_Selection->count();
if (docSelectionCount == 1)
undoManager->showObject(Doc->m_Selection->itemAt(0)->getUId());
10264,9 → 10266,9
 
void ScribusView::setGlobalUndoMode()
{
if (ScMW->HaveDoc)
if (m_ScMW->HaveDoc)
{
ScMW->scrActions["editActionMode"]->setOn(!_isGlobalMode);
m_ScMW->scrActions["editActionMode"]->setOn(!_isGlobalMode);
if (_isGlobalMode)
undoManager->showObject(Um::GLOBAL_UNDO_MODE);
else
/branches/Version13x/Scribus/scribus/actionmanager.cpp
32,9 → 32,10
QMap<QString, QKeySequence> ActionManager::defKeys;
QValueVector< QPair<QString, QStringList> > ActionManager::defMenus;
 
ActionManager::ActionManager ( QObject * parent, const char * name ) : QObject ( parent, name )
ActionManager::ActionManager ( QObject * parent, const char * name ) :
QObject ( parent, name ),
mainWindow(0)
{
mainWindow=0;
}
 
void ActionManager::init(ScribusMainWindow *mw)
/branches/Version13x/Scribus/scribus/scimage.cpp
3306,7 → 3306,7
#endif // HAVE_CMS
}
 
bool ScImage::LoadPicture(const QString & fn, const QString & Prof,
bool ScImage::LoadPicture(const QString & fn, const CMSettings& cmSettings,
int rend, bool useEmbedded, bool useProf,
RequestType requestType, int gsRes, bool *realCMYK)
{
4042,20 → 4042,22
else
{
QCString profilePath;
//CB If this is null, customfiledialog/picsearch/ScPreview might be sending it
Q_ASSERT(cmSettings.doc()!=0);
if (isCMYK)
{
if (ScCore->InputProfilesCMYK.contains(Prof))
imgInfo.profileName = Prof;
if (ScCore->InputProfilesCMYK.contains(cmSettings.profileName()))
imgInfo.profileName = cmSettings.profileName();
else
imgInfo.profileName = ScMW->doc->CMSSettings.DefaultImageCMYKProfile;
imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile;
profilePath = ScCore->InputProfilesCMYK[imgInfo.profileName].local8Bit();
}
else
{
if (ScCore->InputProfiles.contains(Prof))
imgInfo.profileName = Prof;
if (ScCore->InputProfiles.contains(cmSettings.profileName()))
imgInfo.profileName = cmSettings.profileName();
else
imgInfo.profileName = ScMW->doc->CMSSettings.DefaultImageRGBProfile;
imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageRGBProfile;
profilePath = ScCore->InputProfiles[imgInfo.profileName].local8Bit();
}
inputProf = cmsOpenProfileFromFile(profilePath.data(), "r");
/branches/Version13x/Scribus/scribus/pageitem_textframe.cpp
3751,7 → 3751,7
itemText.insertChars(CPos, QString(QChar(conv)));
CPos += 1;
Tinput = true;
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
view->RefreshItem(this);
keyRepeat = false;
return;
3811,7 → 3811,7
ExpandSel(-1, oldPos);
if ( this->itemText.lengthOfSelection() > 0 )
view->RefreshItem(this);
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
break;
case Key_End:
// go to end of line
3865,7 → 3865,7
ExpandSel(1, oldPos);
if ( this->itemText.lengthOfSelection() > 0 )
view->RefreshItem(this);
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
break;
case Key_Down:
if (buttonState & ControlButton)
3963,7 → 3963,7
}
if ( this->itemText.lengthOfSelection() > 0 )
view->RefreshItem(this);
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
break;
case Key_Up:
if (buttonState & ControlButton)
4055,19 → 4055,19
}
if ( this->itemText.lengthOfSelection() > 0 )
view->RefreshItem(this);
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
break;
case Key_Prior:
CPos = firstInFrame();
if ( buttonState & ShiftButton )
ExpandSel(-1, oldPos);
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
break;
case Key_Next:
CPos = lastInFrame();
if ( buttonState & ShiftButton )
ExpandSel(1, oldPos);
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
break;
case Key_Left:
if ( buttonState & ControlButton )
4123,7 → 4123,7
}
if ( itemText.lengthOfSelection() > 0 )
view->RefreshItem(this);
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
break;
case Key_Right:
if ( buttonState & ControlButton )
4161,7 → 4161,7
}
if ( itemText.lengthOfSelection() > 0 )
view->RefreshItem(this);
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
break;
case Key_Delete:
if (CPos == itemText.length())
4169,7 → 4169,7
if (itemText.lengthOfSelection() > 0)
{
deleteSelectedTextFromFrame();
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
view->RefreshItem(this);
}
keyRepeat = false;
4190,7 → 4190,7
m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(QMAX(CPos-1,0))));
Tinput = false;
}
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
view->RefreshItem(this);
break;
case Key_Backspace:
4199,7 → 4199,7
if (itemText.lengthOfSelection() > 0)
{
deleteSelectedTextFromFrame();
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
view->RefreshItem(this);
}
break;
4219,7 → 4219,7
m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(QMAX(CPos-1,0))));
Tinput = false;
}
ScMW->setTBvals(this);
m_Doc->scMW()->setTBvals(this);
view->RefreshItem(this);
break;
default:
4284,7 → 4284,7
HasSel = false;
}
m_Doc->updateFrameItems();
ScMW->DisableTxEdit();
m_Doc->scMW()->DisableTxEdit();
}
 
 
4414,7 → 4414,7
itemText.deselectAll();
HasSel = false;
//CB Replace with direct call for now //emit HasNoTextSel();
ScMW->DisableTxEdit();
m_Doc->scMW()->DisableTxEdit();
}
else if ( !selMode )
{
4429,7 → 4429,7
{
HasSel = true;
//CB Replace with direct call for now //emit HasTextSel();
ScMW->EnableTxEdit();
m_Doc->scMW()->EnableTxEdit();
leftSel = true;
rightSel = true;
}
4452,7 → 4452,7
itemText.select(start, end-start, sel);
if ( ! sel )
//CB Replace with direct call for now //emit HasNoTextSel();
ScMW->DisableTxEdit();
m_Doc->scMW()->DisableTxEdit();
view->RefreshItem(this);
}
 
4473,7 → 4473,7
item = item->NextBox;
}
//CB Replace with direct call for now //emit HasNoTextSel();
ScMW->DisableTxEdit();
m_Doc->scMW()->DisableTxEdit();
}
 
double PageItem_TextFrame::columnWidth()
/branches/Version13x/Scribus/scribus/muster.cpp
109,7 → 109,7
0, QMessageBox::No, QMessageBox::Yes);
if (exit == 0)
{
ScMW->DeletePage2(currentDoc->MasterNames[sMuster]);
currentDoc->scMW()->DeletePage2(currentDoc->MasterNames[sMuster]);
//<<CB TODO Move back into ScribusDoc::deleteMasterPage();
//This must happen after the pages have been reformed (view/doc)
currentDoc->MasterNames.clear();
316,7 → 316,7
qApp->processEvents();
//CB TODO: If we are loading to a new name, we rely on doc->onpage in
//FileLoader::PasteItem as this call doesnt pass in the new destination page
ScMW->loadPage(dia->getFromDoc(), dia->getMasterPageNameItem(), true, MasterPageName2);
currentDoc->scMW()->loadPage(dia->getFromDoc(), dia->getMasterPageNameItem(), true, MasterPageName2);
qApp->processEvents();
/*
MasterPageName = currentDoc->Pages->at(nr)->PageNam;
/branches/Version13x/Scribus/scribus/scribuswin.h
45,7 → 45,7
void setView(ScribusView* newView);
void setMainWindow(ScribusMainWindow *);
ScribusView* view() const { return m_View;}
ScribusDoc* document() const { return m_Doc;}
ScribusDoc* doc() const { return m_Doc;}
void setMasterPagesPalette(MasterPagesPalette* newMPP) { m_masterPagesPalette=newMPP; }
MasterPagesPalette* masterPagesPalette() const { return m_masterPagesPalette; }
void setMenuStatus(int index, bool value) { if (index>=0 && index <=6) MenuStat[index]=value;}
/branches/Version13x/Scribus/scribus/sampleitem.h
35,7 → 35,7
Q_OBJECT
 
public:
SampleItem();
SampleItem(ScribusDoc* doc);
~SampleItem();
 
/*! \brief Set sample text.
107,7 → 107,7
ParagraphStyle tmpStyle;
/*! \brief Reference to a document.
Existing or created one */
ScribusDoc *doc;
ScribusDoc *m_Doc;
//! \brief Is the doc created used only? true = used
bool used;
int bgShade;
/branches/Version13x/Scribus/scribus/scribus.cpp
210,15 → 210,16
 
QString DocDir;
 
extern ScribusCore* ScCore;
//extern ScribusCore* ScCore;
extern ScribusQApp* ScQApp;
extern bool emergencyActivated;
 
ScribusMainWindow::ScribusMainWindow()
{
actionManager=NULL;
scrMenuMgr=NULL;
prefsManager=NULL;
actionManager=0;
scrMenuMgr=0;
prefsManager=0;
mainWindowStatusLabel=0;
#ifdef Q_WS_MAC
noIcon = loadIcon("noicon.xpm");
#endif
247,7 → 248,7
scrRecentFileActions.clear();
scrWindowsActions.clear();
scrLayersActions.clear();
scrMenuMgr = new MenuManager(this->menuBar());
scrMenuMgr = new MenuManager(menuBar());
prefsManager = PrefsManager::instance();
objectSpecificUndo = false;
965,7 → 966,7
statusBar()->addWidget(mainWindowYPosDataLabel, 1, true);
}
 
void ScribusMainWindow::setMousePositionOnStatusBar(double xp, double yp)
void ScribusMainWindow::setStatusBarMousePosition(double xp, double yp)
{
double xn = xp;
double yn = yp;
985,6 → 986,11
mainWindowYPosDataLabel->setText(tmp.setNum(qRound(yn*doc->unitRatio() * multiplier) / divisor, 'f', precision) + suffix);
}
 
void ScribusMainWindow::setStatusBarInfoText(QString newText)
{
if (mainWindowStatusLabel)
mainWindowStatusLabel->setText(newText);
}
 
//CB-->Doc
void ScribusMainWindow::setTBvals(PageItem *currItem)
1419,7 → 1425,7
}
else
{
ScMW->view->MoveItem(-resizeBy, 0, currItem, false);
view->MoveItem(-resizeBy, 0, currItem, false);
currItem->Sizing = false;
view->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
}
1466,7 → 1472,7
{
if (resizingsmaller)
{
ScMW->view->MoveItem(-resizeBy, 0, currItem, false);
view->MoveItem(-resizeBy, 0, currItem, false);
currItem->Sizing = false;
view->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
}
1523,7 → 1529,7
}
else
{
ScMW->view->MoveItem(0, -resizeBy, currItem, false);
view->MoveItem(0, -resizeBy, currItem, false);
currItem->Sizing = false;
view->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
}
1570,7 → 1576,7
{
if (resizingsmaller)
{
ScMW->view->MoveItem(0, -resizeBy, currItem, false);
view->MoveItem(0, -resizeBy, currItem, false);
currItem->Sizing = false;
view->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
}
1728,7 → 1734,7
void ScribusMainWindow::startUpDialog()
{
PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false);
NewDoc* dia = new NewDoc(this, true);
NewDoc* dia = new NewDoc(this, RecentDocs, true);
if (dia->exec())
{
if (dia->tabSelected == 0)
1765,7 → 1771,7
}
else
{
QString fileName(dia->recentDocList->currentText());
QString fileName(dia->recentDocListBox->currentText());
if (!fileName.isEmpty())
loadRecent(fileName);
}
1778,8 → 1784,8
 
bool ScribusMainWindow::slotFileNew()
{
bool retVal;
NewDoc* dia = new NewDoc(this);
bool retVal=false;
NewDoc* dia = new NewDoc(this, RecentDocs);
if (dia->exec())
{
int facingPages = dia->choosenLayout;
1797,18 → 1803,17
int pageCount=dia->PgNum->value();
PageSize ps2(dia->pageSizeComboBox->currentText());
QString pagesize = ps2.getPageName();
retVal = doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->ComboBox3->currentItem(), firstPage, orientation, 1, pagesize, pageCount);
if (!doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->ComboBox3->currentItem(), firstPage, orientation, 1, pagesize, pageCount))
return false;
doc->pageSets[facingPages].FirstPage = firstPage;
mainWindowStatusLabel->setText( tr("Ready"));
HaveNewDoc();
}
else
retVal = false;
delete dia;
return retVal;
}
 
bool ScribusMainWindow::doFileNew(double width, double h, double tpr, double lr, double rr, double br, double ab,
ScribusDoc *ScribusMainWindow::doFileNew(double width, double h, double tpr, double lr, double rr, double br, double ab,
double sp, bool atf, int fp, int einh, int firstleft, int Ori, int SNr,
const QString& defaultPageSize, int pageCount, bool showView)
{
1833,8 → 1838,6
doc->addSection();
doc->setFirstSectionFromFirstPageNumber();
doc->setModified(false);
doc->setLoading(false);
doc->setCurrentPage(doc->Pages->at(0));
doc->OpenNodes.clear();
actionManager->disconnectNewDocActions();
actionManager->connectNewDocActions(doc);
1846,7 → 1849,12
actionManager->disconnectNewViewActions();
disconnect(view, SIGNAL(signalGuideInformation(int, double)), alignDistributePalette, SLOT(setGuide(int, double)));
}
view = new ScribusView(w, doc);
view = new ScribusView(w, this, doc);
doc->setCurrentPage(doc->Pages->at(0));
doc->setGUI(this, view);
doc->setLoading(false);
//run after setGUI to set up guidepalette ok
view->setScale(prefsManager->displayScale());
actionManager->connectNewViewActions(view);
alignDistributePalette->setDoc(doc);
1881,7 → 1889,7
styleManager->currentDoc(doc);
tocGenerator->setDoc(doc);
 
return true;
return doc;
}
 
void ScribusMainWindow::newView()
1888,7 → 1896,7
{
ScribusWin* w = new ScribusWin(wsp, doc);
w->setMainWindow(this);
view = new ScribusView(w, doc);
view = new ScribusView(w, this, doc);
view->setScale(prefsManager->displayScale());
w->setView(view);
ActWin = w;
1933,12 → 1941,12
return;
}
ActWin = (ScribusWin*)w;
if (ActWin->document()==NULL)
if (ActWin->doc()==NULL)
return;
QString oldDocName = "";
if (ActWin && ActWin->document())
if (ActWin && ActWin->doc())
{
oldDocName = ActWin->document()->DocName;
oldDocName = ActWin->doc()->DocName;
}
/* if (doc != NULL)
{
1947,8 → 1955,8
} */
docCheckerPalette->clearErrorList();
QString newDocName = "";
if (ActWin && ActWin->document())
newDocName = ActWin->document()->DocName;
if (ActWin && ActWin->doc())
newDocName = ActWin->doc()->DocName;
 
if (oldDocName != newDocName)
undoManager->switchStack(newDocName);
1963,7 → 1971,7
//disconnect(doc->m_Selection, SIGNAL(empty()), 0, 0);
}
}
doc = ActWin->document();
doc = ActWin->doc();
view = ActWin->view();
actionManager->connectNewViewActions(view);
actionManager->disconnectNewDocActions();
2122,7 → 2130,8
propertiesPalette->endArrow->rebuildList(&doc->arrowStyles);
FontSub->RebuildList(doc);
propertiesPalette->Fonts->RebuildList(doc);
layerPalette->setLayers(&doc->Layers, doc->activeLayer());
layerPalette->setDoc(doc);
guidePalette->setDoc(doc);
rebuildLayersList();
view->updateLayerMenu();
view->setLayerMenuText(doc->activeLayerName());
2260,7 → 2269,8
propertiesPalette->SetLineFormats(doc);
propertiesPalette->startArrow->rebuildList(&doc->arrowStyles);
propertiesPalette->endArrow->rebuildList(&doc->arrowStyles);
layerPalette->setLayers(&doc->Layers, doc->activeLayer());
layerPalette->setDoc(doc);
guidePalette->setDoc(doc);
outlinePalette->setDoc(doc);
outlinePalette->BuildTree();
rebuildLayersList();
2271,7 → 2281,7
windowsMenuAboutToShow();
connect(view, SIGNAL(changeUN(int)), this, SLOT(slotChangeUnit(int)));
connect(view, SIGNAL(changeLA(int)), layerPalette, SLOT(markActiveLayer(int)));
connect(view->horizRuler, SIGNAL(MarkerMoved(double, double)), this, SLOT(setMousePositionOnStatusBar(double, double)));
connect(view->horizRuler, SIGNAL(MarkerMoved(double, double)), this, SLOT(setStatusBarMousePosition(double, double)));
connect(view->horizRuler, SIGNAL(DocChanged(bool)), this, SLOT(slotDocCh(bool)));
connect(view, SIGNAL(ClipPo(double, double)), nodePalette, SLOT(SetXY(double, double)));
connect(view, SIGNAL(PolyOpen()), nodePalette, SLOT(IsOpen()));
2302,7 → 2312,7
connect(view, SIGNAL(PaintingDone()), this, SLOT(slotSelect()));
connect(view, SIGNAL(DocChanged()), this, SLOT(slotDocCh()));
//connect(view, SIGNAL(HavePoint(bool, bool)), nodePalette, SLOT(HaveNode(bool, bool)));
connect(view, SIGNAL(MousePos(double, double)), this, SLOT(setMousePositionOnStatusBar(double, double)));
connect(view, SIGNAL(MousePos(double, double)), this, SLOT(setStatusBarMousePosition(double, double)));
//connect(view, SIGNAL(ItemRadius(double)), propertiesPalette, SLOT(setRR(double)));
connect(view, SIGNAL(ItemTextStil(int)), propertiesPalette, SLOT(setStil(int)));
connect(view, SIGNAL(ItemTextSca(int)), propertiesPalette, SLOT(setTScale(int)));
3070,7 → 3080,7
}
doc->setLoading(true);
uint oldItemsCount = doc->Items->count();
if(!fl->LoadPage(Nr, Mpa, renamedPageName))
if(!fl->LoadPage(doc, Nr, Mpa, renamedPageName))
{
delete fl;
doc->setLoading(false);
3186,7 → 3196,8
mainWindowProgressBar->reset();
ScribusWin* w = new ScribusWin(wsp, doc);
w->setMainWindow(this);
view = new ScribusView(w, doc);
view = new ScribusView(w, this, doc);
doc->setGUI(this, view);
view->setScale(prefsManager->displayScale());
w->setView(view);
alignDistributePalette->setDoc(doc);
3202,11 → 3213,11
CMSuse = false;
#endif
ScriptRunning = true;
bool loadSuccess=fileLoader->LoadFile();
bool loadSuccess=fileLoader->LoadFile(doc);
//Do the font replacement check from here, when we have a GUI. TODO do this also somehow without the GUI
//This also gives the user the opportunity to cancel the load when finding theres a replacement required.
if (loadSuccess && ScCore->usingGUI())
loadSuccess=fileLoader->postLoad();
loadSuccess=fileLoader->postLoad(doc);
if(!loadSuccess)
{
view->close();
3216,7 → 3227,7
delete w;
view=NULL;
doc=NULL;
ScMW->ScriptRunning = false;
ScriptRunning = false;
qApp->setOverrideCursor(QCursor(arrowCursor), true);
mainWindowStatusLabel->setText("");
mainWindowProgressBar->reset();
3229,7 → 3240,7
fileLoader->informReplacementFonts();
view->unitSwitcher->setCurrentText(unitGetStrFromIndex(doc->unitIndex()));
view->unitChange();
ScMW->ScriptRunning = false;
ScriptRunning = false;
view->Deselect(true);
mainWindowStatusLabel->setText("");
mainWindowProgressBar->reset();
3682,7 → 3693,7
}
if (currItem->asTextFrame())
{
gtGetText* gt = new gtGetText();
gtGetText* gt = new gtGetText(doc);
gt->run(false);
delete gt;
if (doc->docHyphenator->AutoCheck)
3725,7 → 3736,7
{
if (doc->m_Selection->count() != 0)
{
gtGetText* gt = new gtGetText();
gtGetText* gt = new gtGetText(doc);
gt->run(true);
delete gt;
//CB Hyphenating now emits doc changed, plus we change lang as appropriate
4302,9 → 4313,9
for (uint i = 0; i < docSelectionCount; ++i)
{
currItem=doc->m_Selection->itemAt(i);
if ((currItem->asTextFrame() || currItem->asPathText()) && currItem==ScMW->storyEditor->currentItem() && doc==ScMW->storyEditor->currentDocument())
if ((currItem->asTextFrame() || currItem->asPathText()) && currItem==storyEditor->currentItem() && doc==storyEditor->currentDocument())
{
QMessageBox::critical(ScMW, tr("Cannot Cut In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The cut operation will be cancelled").arg(currItem->itemName()), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
QMessageBox::critical(this, tr("Cannot Cut In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The cut operation will be cancelled").arg(currItem->itemName()), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
return;
}
}
4665,7 → 4676,7
doc->useRaster = savedAlignGrid;
doc->SnapGuides = savedAlignGuides;
//int tempList=doc->m_Selection->backupToTempList(0);
Selection tempSelection(*ScMW->doc->m_Selection);
Selection tempSelection(*doc->m_Selection);
doc->m_Selection->clear();
if (doc->Items->count() - ac > 1)
isGroup = true;
4700,7 → 4711,7
}
doc->m_Selection->clear();
//doc->m_Selection->restoreFromTempList(0, tempList);
*ScMW->doc->m_Selection=tempSelection;
*doc->m_Selection=tempSelection;
view->resizeContents(qRound((maxSize.x() - minSize.x()) * view->scale()), qRound((maxSize.y() - minSize.y()) * view->scale()));
view->scrollBy(qRound((doc->minCanvasCoordinate.x() - minSize.x()) * view->scale()), qRound((doc->minCanvasCoordinate.y() - minSize.y()) * view->scale()));
doc->minCanvasCoordinate = minSize;
6607,7 → 6618,7
edc = doc->PageColors;
else
edc = prefsManager->colorSet();
ColorManager* dia = new ColorManager(this, edc, HaveDoc, prefsManager->colorSetName(), prefsManager->appPrefs.CustomColorSets);
ColorManager* dia = new ColorManager(this, edc, doc, prefsManager->colorSetName(), prefsManager->appPrefs.CustomColorSets);
if (dia->exec())
{
if (HaveDoc)
7240,12 → 7251,12
if (!doc->DocName.startsWith(tr("Document")))
{
QFileInfo fi(doc->DocName);
fna = fi.dirPath() + "/" + getFileNameByPage(doc->currentPage()->pageNr(), "eps");
fna = fi.dirPath() + "/" + getFileNameByPage(doc, doc->currentPage()->pageNr(), "eps");
}
else
{
QDir di = QDir();
fna = di.currentDirPath() + "/" + getFileNameByPage(doc->currentPage()->pageNr(), "eps");
fna = di.currentDirPath() + "/" + getFileNameByPage(doc, doc->currentPage()->pageNr(), "eps");
}
fna = QDir::convertSeparators(fna);
QString wdir = ".";
8206,7 → 8217,7
 
QString ScribusMainWindow::Collect(bool compress, bool withFonts, const QString& )
{
CollectForOutput *c = new CollectForOutput(withFonts, compress);
CollectForOutput *c = new CollectForOutput(doc, withFonts, compress);
Q_CHECK_PTR(c);
QString ret = c->collect();
delete c;
8301,7 → 8312,7
for (uint i=0; i<windowCount ; ++i)
{
ActWin = (ScribusWin*)windows.at(i);
doc = ActWin->document();
doc = ActWin->doc();
view = ActWin->view();
doc->setModified(false);
if (doc->hasName)
8589,7 → 8600,7
 
void ScribusMainWindow::insertSampleText()
{
LoremManager *m = new LoremManager(this, "m", true, 0);
LoremManager *m = new LoremManager(doc, this, "m", true, 0);
if (prefsManager->appPrefs.useStandardLI)
m->insertLoremIpsum("loremipsum.xml", prefsManager->appPrefs.paragraphsLI);
else
8672,13 → 8683,6
*command=PDef.Command;
}
 
const bool ScribusMainWindow::fileWatcherActive()
{
if (ScCore->fileWatcher!=NULL)
return ScCore->fileWatcher->isActive();
return false;
}
 
void ScribusMainWindow::updateColorMenu(QProgressBar* progressBar)
{
disconnect(ColorMenC, SIGNAL(activated(int)), this, SLOT(setItemFarbe(int)));
/branches/Version13x/Scribus/scribus/util.h
134,7 → 134,7
\retval QString standardized filename
\author Petr Vanek
*/
QString SCRIBUS_API getFileNameByPage(uint pageNo, QString extension);
QString SCRIBUS_API getFileNameByPage(ScribusDoc* currDoc, uint pageNo, QString extension);
void SCRIBUS_API sDebug(QString message);
inline double SCRIBUS_API square(double);
inline double SCRIBUS_API distance(double, double);
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
9,6 → 9,7
#include "selection.h"
#include "util.h"
#include "commonstrings.h"
#include "scribuscore.h"
 
 
PyObject *scribus_newrect(PyObject* /* self */, PyObject* args)
24,15 → 25,15
PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists.","python error"));
return NULL;
}
int i = ScMW->doc->itemAdd(PageItem::Polygon, PageItem::Rectangle,
int i = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::Polygon, PageItem::Rectangle,
pageUnitXToDocX(x), pageUnitYToDocY(y),
ValueToPoint(w), ValueToPoint(h),
ScMW->doc->toolSettings.dWidth,
ScMW->doc->toolSettings.dBrush, ScMW->doc->toolSettings.dPen, true);
ScMW->doc->setRedrawBounding(ScMW->doc->Items->at(i));
ScCore->primaryMainWindow()->doc->toolSettings.dWidth,
ScCore->primaryMainWindow()->doc->toolSettings.dBrush, ScCore->primaryMainWindow()->doc->toolSettings.dPen, true);
ScCore->primaryMainWindow()->doc->setRedrawBounding(ScCore->primaryMainWindow()->doc->Items->at(i));
if (Name != "")
ScMW->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScMW->doc->Items->at(i)->itemName().utf8());
ScCore->primaryMainWindow()->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().utf8());
}
 
 
44,14 → 45,14
return NULL;
if(!checkHaveDocument())
return NULL;
int i = ScMW->doc->itemAdd(PageItem::Polygon, PageItem::Ellipse,
int i = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::Polygon, PageItem::Ellipse,
pageUnitXToDocX(x),
pageUnitYToDocY(y),
ValueToPoint(w),
ValueToPoint(h),
ScMW->doc->toolSettings.dWidth,
ScMW->doc->toolSettings.dBrush,
ScMW->doc->toolSettings.dPen,
ScCore->primaryMainWindow()->doc->toolSettings.dWidth,
ScCore->primaryMainWindow()->doc->toolSettings.dBrush,
ScCore->primaryMainWindow()->doc->toolSettings.dPen,
true);
if (ItemExists(QString::fromUtf8(Name)))
{
58,10 → 59,10
PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists.","python error"));
return NULL;
}
ScMW->doc->setRedrawBounding(ScMW->doc->Items->at(i));
ScCore->primaryMainWindow()->doc->setRedrawBounding(ScCore->primaryMainWindow()->doc->Items->at(i));
if (Name != "")
ScMW->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScMW->doc->Items->at(i)->itemName().utf8());
ScCore->primaryMainWindow()->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().utf8());
}
 
 
73,12 → 74,12
return NULL;
if(!checkHaveDocument())
return NULL;
int i = ScMW->doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified,
int i = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified,
pageUnitXToDocX(x),
pageUnitYToDocY(y),
ValueToPoint(w),
ValueToPoint(h),
1, ScMW->doc->toolSettings.dBrushPict,
1, ScCore->primaryMainWindow()->doc->toolSettings.dBrushPict,
CommonStrings::None, true);
if (ItemExists(QString::fromUtf8(Name)))
{
85,10 → 86,10
PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists.","python error"));
return NULL;
}
ScMW->doc->setRedrawBounding(ScMW->doc->Items->at(i));
ScCore->primaryMainWindow()->doc->setRedrawBounding(ScCore->primaryMainWindow()->doc->Items->at(i));
if (Name != "")
ScMW->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScMW->doc->Items->at(i)->itemName().utf8());
ScCore->primaryMainWindow()->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().utf8());
}
 
 
100,22 → 101,22
return NULL;
if(!checkHaveDocument())
return NULL;
int i = ScMW->doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified,
int i = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified,
pageUnitXToDocX(x),
pageUnitYToDocY(y),
ValueToPoint(w),
ValueToPoint(h),
ScMW->doc->toolSettings.dWidth, CommonStrings::None,
ScMW->doc->toolSettings.dPenText, true);
ScCore->primaryMainWindow()->doc->toolSettings.dWidth, CommonStrings::None,
ScCore->primaryMainWindow()->doc->toolSettings.dPenText, true);
if (ItemExists(QString::fromUtf8(Name)))
{
PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists.","python error"));
return NULL;
}
ScMW->doc->setRedrawBounding(ScMW->doc->Items->at(i));
ScCore->primaryMainWindow()->doc->setRedrawBounding(ScCore->primaryMainWindow()->doc->Items->at(i));
if (Name != "")
ScMW->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScMW->doc->Items->at(i)->itemName().utf8());
ScCore->primaryMainWindow()->doc->Items->at(i)->setItemName(QString::fromUtf8(Name));
return PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().utf8());
}
 
PyObject *scribus_newline(PyObject* /* self */, PyObject* args)
137,17 → 138,17
"python error"));
return NULL;
}
int i = ScMW->doc->itemAdd(PageItem::Line, PageItem::Unspecified,
int i = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::Line, PageItem::Unspecified,
x, y, w, h,
ScMW->doc->toolSettings.dWidth,
ScMW->doc->toolSettings.dBrush,
ScMW->doc->toolSettings.dPen, true);
PageItem *it = ScMW->doc->Items->at(i);
ScCore->primaryMainWindow()->doc->toolSettings.dWidth,
ScCore->primaryMainWindow()->doc->toolSettings.dBrush,
ScCore->primaryMainWindow()->doc->toolSettings.dPen, true);
PageItem *it = ScCore->primaryMainWindow()->doc->Items->at(i);
it->setRotation(xy2Deg(w-x, h-y));
it->setWidthHeight(sqrt(pow(x-w, 2.0) + pow(y-h, 2.0)), 1.0);
it->Sizing = false;
it->updateClip();
ScMW->doc->setRedrawBounding(it);
ScCore->primaryMainWindow()->doc->setRedrawBounding(it);
/* WTF? maybe I'll examine who's author later. Or maybe I'll remove it later ;)
it->PoLine.resize(4);
it->PoLine.setPoint(0, 0, 0);
158,16 → 159,16
if (np2.x() < 0)
{
it->PoLine.translate(-np2.x(), 0);
ScMW->view->MoveItem(np2.x(), 0, it);
ScCore->primaryMainWindow()->view->MoveItem(np2.x(), 0, it);
}
if (np2.y() < 0)
{
it->PoLine.translate(0, -np2.y());
ScMW->view->MoveItem(0, np2.y(), it);
ScCore->primaryMainWindow()->view->MoveItem(0, np2.y(), it);
}
ScMW->view->SizeItem(it->PoLine.WidthHeight().x(),
ScCore->primaryMainWindow()->view->SizeItem(it->PoLine.WidthHeight().x(),
it->PoLine.WidthHeight().y(), i, false, false, false);
ScMW->view->AdjustItemSize(it);*/
ScCore->primaryMainWindow()->view->AdjustItemSize(it);*/
if (Name != "")
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
205,8 → 206,8
i++;
y = pageUnitYToDocY(static_cast<double>(PyFloat_AsDouble(PyList_GetItem(il, i))));
i++;
int ic = ScMW->doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, 1, 1, ScMW->doc->toolSettings.dWidth, ScMW->doc->toolSettings.dBrush, ScMW->doc->toolSettings.dPen, true);
PageItem *it = ScMW->doc->Items->at(ic);
int ic = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, 1, 1, ScCore->primaryMainWindow()->doc->toolSettings.dWidth, ScCore->primaryMainWindow()->doc->toolSettings.dBrush, ScCore->primaryMainWindow()->doc->toolSettings.dPen, true);
PageItem *it = ScCore->primaryMainWindow()->doc->Items->at(ic);
it->PoLine.resize(2);
it->PoLine.setPoint(0, 0, 0);
it->PoLine.setPoint(1, 0, 0);
232,15 → 233,15
if (np2.x() < 0)
{
it->PoLine.translate(-np2.x(), 0);
ScMW->view->MoveItem(np2.x(), 0, it);
ScCore->primaryMainWindow()->view->MoveItem(np2.x(), 0, it);
}
if (np2.y() < 0)
{
it->PoLine.translate(0, -np2.y());
ScMW->view->MoveItem(0, np2.y(), it);
ScCore->primaryMainWindow()->view->MoveItem(0, np2.y(), it);
}
ScMW->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScMW->view->AdjustItemSize(it);
ScCore->primaryMainWindow()->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->view->AdjustItemSize(it);
if (Name != "")
{
it->setItemName(QString::fromUtf8(Name));
280,8 → 281,8
i++;
y = pageUnitYToDocY(static_cast<double>(PyFloat_AsDouble(PyList_GetItem(il, i))));
i++;
int ic = ScMW->doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, x, y, 1, 1, ScMW->doc->toolSettings.dWidth, ScMW->doc->toolSettings.dBrush, ScMW->doc->toolSettings.dPen, true);
PageItem *it = ScMW->doc->Items->at(ic);
int ic = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, x, y, 1, 1, ScCore->primaryMainWindow()->doc->toolSettings.dWidth, ScCore->primaryMainWindow()->doc->toolSettings.dBrush, ScCore->primaryMainWindow()->doc->toolSettings.dPen, true);
PageItem *it = ScCore->primaryMainWindow()->doc->Items->at(ic);
it->PoLine.resize(2);
it->PoLine.setPoint(0, 0, 0);
it->PoLine.setPoint(1, 0, 0);
312,15 → 313,15
if (np2.x() < 0)
{
it->PoLine.translate(-np2.x(), 0);
ScMW->view->MoveItem(np2.x(), 0, it);
ScCore->primaryMainWindow()->view->MoveItem(np2.x(), 0, it);
}
if (np2.y() < 0)
{
it->PoLine.translate(0, -np2.y());
ScMW->view->MoveItem(0, np2.y(), it);
ScCore->primaryMainWindow()->view->MoveItem(0, np2.y(), it);
}
ScMW->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScMW->view->AdjustItemSize(it);
ScCore->primaryMainWindow()->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->view->AdjustItemSize(it);
if (Name != "")
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
365,9 → 366,9
i++;
ky2 = pageUnitYToDocY(static_cast<double>(PyFloat_AsDouble(PyList_GetItem(il, i))));
i++;
//int ic = ScMW->view->PaintPolyLine(x, y, 1, 1, ScMW->doc->toolSettings.dWidth, ScMW->doc->toolSettings.dBrush, ScMW->doc->toolSettings.dPen);
int ic = ScMW->doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, 1, 1, ScMW->doc->toolSettings.dWidth, ScMW->doc->toolSettings.dBrush, ScMW->doc->toolSettings.dPen, true);
PageItem *it = ScMW->doc->Items->at(ic);
//int ic = ScCore->primaryMainWindow()->view->PaintPolyLine(x, y, 1, 1, ScCore->primaryMainWindow()->doc->toolSettings.dWidth, ScCore->primaryMainWindow()->doc->toolSettings.dBrush, ScCore->primaryMainWindow()->doc->toolSettings.dPen);
int ic = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, 1, 1, ScCore->primaryMainWindow()->doc->toolSettings.dWidth, ScCore->primaryMainWindow()->doc->toolSettings.dBrush, ScCore->primaryMainWindow()->doc->toolSettings.dPen, true);
PageItem *it = ScCore->primaryMainWindow()->doc->Items->at(ic);
it->PoLine.resize(2);
it->PoLine.setPoint(0, 0, 0);
it->PoLine.setPoint(1, kx-x, ky-y);
399,15 → 400,15
if (np2.x() < 0)
{
it->PoLine.translate(-np2.x(), 0);
ScMW->view->MoveItem(np2.x(), 0, it);
ScCore->primaryMainWindow()->view->MoveItem(np2.x(), 0, it);
}
if (np2.y() < 0)
{
it->PoLine.translate(0, -np2.y());
ScMW->view->MoveItem(0, np2.y(), it);
ScCore->primaryMainWindow()->view->MoveItem(0, np2.y(), it);
}
ScMW->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScMW->view->AdjustItemSize(it);
ScCore->primaryMainWindow()->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->view->AdjustItemSize(it);
if (Name != "")
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
440,12 → 441,12
PyErr_SetString(NotFoundError, QObject::tr("Object not found.","python error"));
return NULL;
}
ScMW->doc->m_Selection->clear();
ScMW->doc->m_Selection->addItem(ScMW->doc->Items->at(i));
ScMW->doc->m_Selection->addItem(ScMW->doc->Items->at(ii));
PageItem *it = ScMW->doc->Items->at(i);
ScMW->view->ToPathText();
ScMW->view->MoveItem(pageUnitXToDocX(x) - it->xPos(), pageUnitYToDocY(y) - it->yPos(), it);
ScCore->primaryMainWindow()->doc->m_Selection->clear();
ScCore->primaryMainWindow()->doc->m_Selection->addItem(ScCore->primaryMainWindow()->doc->Items->at(i));
ScCore->primaryMainWindow()->doc->m_Selection->addItem(ScCore->primaryMainWindow()->doc->Items->at(ii));
PageItem *it = ScCore->primaryMainWindow()->doc->Items->at(i);
ScCore->primaryMainWindow()->view->ToPathText();
ScCore->primaryMainWindow()->view->MoveItem(pageUnitXToDocX(x) - it->xPos(), pageUnitYToDocY(y) - it->yPos(), it);
if (Name != "")
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
464,9 → 465,9
PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
if (i == NULL)
return NULL;
ScMW->doc->m_Selection->clear();
ScMW->doc->m_Selection->addItem(i);
ScMW->doc->itemSelection_DeleteItem();
ScCore->primaryMainWindow()->doc->m_Selection->clear();
ScCore->primaryMainWindow()->doc->m_Selection->addItem(i);
ScCore->primaryMainWindow()->doc->itemSelection_DeleteItem();
Py_INCREF(Py_None);
return Py_None;
}
501,8 → 502,8
i->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
else if( state == (int) PageItem::TextFlowUsesContourLine )
i->setTextFlowMode(PageItem::TextFlowUsesContourLine);
ScMW->view->DrawNew();
ScMW->slotDocCh(true);
ScCore->primaryMainWindow()->view->DrawNew();
ScCore->primaryMainWindow()->slotDocCh(true);
Py_INCREF(Py_None);
return Py_None;
}
545,10 → 546,10
bool found = false;
uint styleid = 0;
// We start at zero here because it's OK to match an internal name
uint docParagraphStylesCount=ScMW->doc->docParagraphStyles.count();
uint docParagraphStylesCount=ScCore->primaryMainWindow()->doc->docParagraphStyles.count();
for (uint i=0; i < docParagraphStylesCount; ++i)
{
if (ScMW->doc->docParagraphStyles[i].name() == QString::fromUtf8(style)) {
if (ScCore->primaryMainWindow()->doc->docParagraphStyles[i].name() == QString::fromUtf8(style)) {
found = true;
styleid = i;
break;
560,25 → 561,25
return NULL;
}
// for current item only
if (ScMW->doc->m_Selection->count() == 0 || name != "")
if (ScCore->primaryMainWindow()->doc->m_Selection->count() == 0 || name != "")
{
// quick hack to always apply on the right frame - pv
ScMW->view->Deselect(true);
ScCore->primaryMainWindow()->view->Deselect(true);
//CB I dont think we need to draw here. Its faster if we dont.
ScMW->view->SelectItem(item, false);
ScCore->primaryMainWindow()->view->SelectItem(item, false);
// Now apply the style.
int mode = ScMW->doc->appMode;
ScMW->doc->appMode = modeEdit;
ScMW->setNewParStyle(styleid);
ScMW->doc->appMode = mode;
int mode = ScCore->primaryMainWindow()->doc->appMode;
ScCore->primaryMainWindow()->doc->appMode = modeEdit;
ScCore->primaryMainWindow()->setNewParStyle(styleid);
ScCore->primaryMainWindow()->doc->appMode = mode;
}
else // for multiple selection
{
int mode = ScMW->doc->appMode;
ScMW->doc->appMode = modeEdit;
for (uint i = 0; i < ScMW->doc->m_Selection->count(); ++i)
ScMW->doc->chAbStyle(ScMW->doc->m_Selection->itemAt(i), styleid);
ScMW->doc->appMode = mode;
int mode = ScCore->primaryMainWindow()->doc->appMode;
ScCore->primaryMainWindow()->doc->appMode = modeEdit;
for (uint i = 0; i < ScCore->primaryMainWindow()->doc->m_Selection->count(); ++i)
ScCore->primaryMainWindow()->doc->chAbStyle(ScCore->primaryMainWindow()->doc->m_Selection->itemAt(i), styleid);
ScCore->primaryMainWindow()->doc->appMode = mode;
}
}
else
605,9 → 606,9
pv - changet to get all (with system) objects
FIXME: this should be a constant defined by the scribus core
*/
for (uint i=0; i < ScMW->doc->docParagraphStyles.count(); ++i)
for (uint i=0; i < ScCore->primaryMainWindow()->doc->docParagraphStyles.count(); ++i)
{
if (PyList_Append(styleList, PyString_FromString(ScMW->doc->docParagraphStyles[i].name().utf8())))
if (PyList_Append(styleList, PyString_FromString(ScCore->primaryMainWindow()->doc->docParagraphStyles[i].name().utf8())))
{
// An exception will have already been set by PyList_Append apparently.
return NULL;
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp
7,12 → 7,13
#include "cmdpage.h"
#include "cmdutil.h"
#include "page.h"
#include "scribuscore.h"
 
PyObject *scribus_actualpage(PyObject* /* self */)
{
if(!checkHaveDocument())
return NULL;
return PyInt_FromLong(static_cast<long>(ScMW->doc->currentPageNumber() + 1));
return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->doc->currentPageNumber() + 1));
}
 
PyObject *scribus_redraw(PyObject* /* self */)
19,7 → 20,7
{
if(!checkHaveDocument())
return NULL;
ScMW->view->DrawNew();
ScCore->primaryMainWindow()->view->DrawNew();
Py_INCREF(Py_None);
return Py_None;
}
31,7 → 32,7
return NULL;
if(!checkHaveDocument())
return NULL;
bool ret = ScMW->DoSaveAsEps(QString::fromUtf8(Name));
bool ret = ScCore->primaryMainWindow()->DoSaveAsEps(QString::fromUtf8(Name));
if (!ret)
{
PyErr_SetString(ScribusException, QObject::tr("Failed to save EPS.","python error"));
49,12 → 50,12
if(!checkHaveDocument())
return NULL;
e--;
if ((e < 0) || (e > static_cast<int>(ScMW->doc->Pages->count())-1))
if ((e < 0) || (e > static_cast<int>(ScCore->primaryMainWindow()->doc->Pages->count())-1))
{
PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range.","python error"));
return NULL;
}
ScMW->DeletePage2(e);
ScCore->primaryMainWindow()->DeletePage2(e);
Py_INCREF(Py_None);
return Py_None;
}
67,12 → 68,12
if(!checkHaveDocument())
return NULL;
e--;
if ((e < 0) || (e > static_cast<int>(ScMW->doc->Pages->count())-1))
if ((e < 0) || (e > static_cast<int>(ScCore->primaryMainWindow()->doc->Pages->count())-1))
{
PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range.","python error"));
return NULL;
}
ScMW->view->GotoPage(e);
ScCore->primaryMainWindow()->view->GotoPage(e);
Py_INCREF(Py_None);
return Py_None;
}
85,22 → 86,22
return NULL;
if(!checkHaveDocument())
return NULL;
if (!ScMW->doc->MasterNames.contains(name))
if (!ScCore->primaryMainWindow()->doc->MasterNames.contains(name))
{
PyErr_SetString(PyExc_IndexError, QObject::tr("Given master page name does not match any existing.","python error"));
return NULL;
}
if (e < 0)
ScMW->slotNewPageP(ScMW->doc->Pages->count(), QString::fromUtf8(name));
ScCore->primaryMainWindow()->slotNewPageP(ScCore->primaryMainWindow()->doc->Pages->count(), QString::fromUtf8(name));
else
{
e--;
if ((e < 0) || (e > static_cast<int>(ScMW->doc->Pages->count())-1))
if ((e < 0) || (e > static_cast<int>(ScCore->primaryMainWindow()->doc->Pages->count())-1))
{
PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range.","python error"));
return NULL;
}
ScMW->slotNewPageP(e, QString::fromUtf8(name));
ScCore->primaryMainWindow()->slotNewPageP(e, QString::fromUtf8(name));
}
Py_INCREF(Py_None);
return Py_None;
110,7 → 111,7
{
if(!checkHaveDocument())
return NULL;
return PyInt_FromLong(static_cast<long>(ScMW->doc->Pages->count()));
return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->doc->Pages->count()));
}
 
PyObject *scribus_pagedimension(PyObject* /* self */)
120,8 → 121,8
PyObject *t;
t = Py_BuildValue(
"(dd)",
PointToValue(ScMW->doc->pageWidth), // it's just view scale... * ScMW->doc->Scale),
PointToValue(ScMW->doc->pageHeight) // * ScMW->doc->Scale)
PointToValue(ScCore->primaryMainWindow()->doc->pageWidth), // it's just view scale... * ScCore->primaryMainWindow()->doc->Scale),
PointToValue(ScCore->primaryMainWindow()->doc->pageHeight) // * ScCore->primaryMainWindow()->doc->Scale)
);
return t;
}
130,26 → 131,26
{
if(!checkHaveDocument())
return NULL;
if (ScMW->doc->Items->count() == 0)
if (ScCore->primaryMainWindow()->doc->Items->count() == 0)
return Py_BuildValue((char*)"[]");
uint counter = 0;
uint pageNr = ScMW->doc->currentPageNumber();
for (uint lam2 = 0; lam2 < ScMW->doc->Items->count(); ++lam2)
uint pageNr = ScCore->primaryMainWindow()->doc->currentPageNumber();
for (uint lam2 = 0; lam2 < ScCore->primaryMainWindow()->doc->Items->count(); ++lam2)
{
if (pageNr == ScMW->doc->Items->at(lam2)->OwnPage)
if (pageNr == ScCore->primaryMainWindow()->doc->Items->at(lam2)->OwnPage)
counter++;
}
PyObject *l = PyList_New(counter);
PyObject *row;
counter = 0;
for (uint i = 0; i<ScMW->doc->Items->count(); ++i)
for (uint i = 0; i<ScCore->primaryMainWindow()->doc->Items->count(); ++i)
{
if (pageNr == ScMW->doc->Items->at(i)->OwnPage)
if (pageNr == ScCore->primaryMainWindow()->doc->Items->at(i)->OwnPage)
{
row = Py_BuildValue((char*)"(sii)",
ScMW->doc->Items->at(i)->itemName().ascii(),
ScMW->doc->Items->at(i)->itemType(),
ScMW->doc->Items->at(i)->ItemNr
ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().ascii(),
ScCore->primaryMainWindow()->doc->Items->at(i)->itemType(),
ScCore->primaryMainWindow()->doc->Items->at(i)->ItemNr
);
PyList_SetItem(l, counter, row);
counter++;
162,8 → 163,8
{
if(!checkHaveDocument())
return NULL;
Guides g = ScMW->doc->currentPage()->guides.horizontals(GuideManagerCore::Standard);
int n = g.count();//ScMW->doc->currentPage->YGuides.count();
Guides g = ScCore->primaryMainWindow()->doc->currentPage()->guides.horizontals(GuideManagerCore::Standard);
int n = g.count();//ScCore->primaryMainWindow()->doc->currentPage->YGuides.count();
if (n == 0)
return Py_BuildValue((char*)"[]");
int i;
194,7 → 195,7
int i, n;
n = PyList_Size(l);
double guide;
ScMW->doc->currentPage()->guides.clearHorizontals(GuideManagerCore::Standard);
ScCore->primaryMainWindow()->doc->currentPage()->guides.clearHorizontals(GuideManagerCore::Standard);
for (i=0; i<n; i++)
{
if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
202,7 → 203,7
PyErr_SetString(PyExc_TypeError, QObject::tr("argument contains non-numeric values: must be list of float values.","python error"));
return NULL;
}
ScMW->doc->currentPage()->guides.addHorizontal(ValueToPoint(guide), GuideManagerCore::Standard);
ScCore->primaryMainWindow()->doc->currentPage()->guides.addHorizontal(ValueToPoint(guide), GuideManagerCore::Standard);
}
Py_INCREF(Py_None);
return Py_None;
212,8 → 213,8
{
if(!checkHaveDocument())
return NULL;
Guides g = ScMW->doc->currentPage()->guides.verticals(GuideManagerCore::Standard);
int n = g.count();//ScMW->doc->currentPage->XGuides.count();
Guides g = ScCore->primaryMainWindow()->doc->currentPage()->guides.verticals(GuideManagerCore::Standard);
int n = g.count();//ScCore->primaryMainWindow()->doc->currentPage->XGuides.count();
if (n == 0)
return Py_BuildValue((char*)"[]");
int i;
244,7 → 245,7
int i, n;
n = PyList_Size(l);
double guide;
ScMW->doc->currentPage()->guides.clearVerticals(GuideManagerCore::Standard);
ScCore->primaryMainWindow()->doc->currentPage()->guides.clearVerticals(GuideManagerCore::Standard);
for (i=0; i<n; i++)
{
if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
252,7 → 253,7
PyErr_SetString(PyExc_TypeError, QObject::tr("argument contains no-numeric values: must be list of float values.","python error"));
return NULL;
}
ScMW->doc->currentPage()->guides.addVertical(ValueToPoint(guide), GuideManagerCore::Standard);
ScCore->primaryMainWindow()->doc->currentPage()->guides.addVertical(ValueToPoint(guide), GuideManagerCore::Standard);
}
Py_INCREF(Py_None);
return Py_None;
263,9 → 264,9
PyObject *margins = NULL;
if(!checkHaveDocument())
return NULL;
margins = Py_BuildValue("ffff", PointToValue(ScMW->doc->pageMargins.Top),
PointToValue(ScMW->doc->pageMargins.Left),
PointToValue(ScMW->doc->pageMargins.Right),
PointToValue(ScMW->doc->pageMargins.Bottom));
margins = Py_BuildValue("ffff", PointToValue(ScCore->primaryMainWindow()->doc->pageMargins.Top),
PointToValue(ScCore->primaryMainWindow()->doc->pageMargins.Left),
PointToValue(ScCore->primaryMainWindow()->doc->pageMargins.Right),
PointToValue(ScCore->primaryMainWindow()->doc->pageMargins.Bottom));
return margins;
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
7,6 → 7,7
#include "cmdutil.h"
#include "units.h"
#include "page.h"
#include "scribuscore.h"
#include "selection.h"
 
ScribusMainWindow* Carrier;
15,13 → 16,13
/// Convert a value in points to a value in the current document units
double PointToValue(double Val)
{
return pts2value(Val, ScMW->doc->unitIndex());
return pts2value(Val, ScCore->primaryMainWindow()->doc->unitIndex());
}
 
/// Convert a value in the current document units to a value in points
double ValueToPoint(double Val)
{
return value2pts(Val, ScMW->doc->unitIndex());
return value2pts(Val, ScCore->primaryMainWindow()->doc->unitIndex());
}
 
/// Convert an X co-ordinate part in page units to a document co-ordinate
28,13 → 29,13
/// in system units.
double pageUnitXToDocX(double pageUnitX)
{
return ValueToPoint(pageUnitX) + ScMW->doc->currentPage()->xOffset();
return ValueToPoint(pageUnitX) + ScCore->primaryMainWindow()->doc->currentPage()->xOffset();
}
 
// Convert doc units to page units
double docUnitXToPageX(double pageUnitX)
{
return PointToValue(pageUnitX - ScMW->doc->currentPage()->xOffset());
return PointToValue(pageUnitX - ScCore->primaryMainWindow()->doc->currentPage()->xOffset());
}
 
/// Convert a Y co-ordinate part in page units to a document co-ordinate
43,12 → 44,12
/// origin on the top left of the current page.
double pageUnitYToDocY(double pageUnitY)
{
return ValueToPoint(pageUnitY) + ScMW->doc->currentPage()->yOffset();
return ValueToPoint(pageUnitY) + ScCore->primaryMainWindow()->doc->currentPage()->yOffset();
}
 
double docUnitYToPageY(double pageUnitY)
{
return PointToValue(pageUnitY - ScMW->doc->currentPage()->yOffset());
return PointToValue(pageUnitY - ScCore->primaryMainWindow()->doc->currentPage()->yOffset());
}
 
int GetItem(QString Name)
55,16 → 56,16
{
if (!Name.isEmpty())
{
for (uint a = 0; a < ScMW->doc->Items->count(); a++)
for (uint a = 0; a < ScCore->primaryMainWindow()->doc->Items->count(); a++)
{
if (ScMW->doc->Items->at(a)->itemName() == Name)
if (ScCore->primaryMainWindow()->doc->Items->at(a)->itemName() == Name)
return static_cast<int>(a);
}
}
else
{
if (ScMW->doc->m_Selection->count() != 0)
return ScMW->doc->m_Selection->itemAt(0)->ItemNr;
if (ScCore->primaryMainWindow()->doc->m_Selection->count() != 0)
return ScCore->primaryMainWindow()->doc->m_Selection->itemAt(0)->ItemNr;
}
return -1;
}
72,9 → 73,9
void ReplaceColor(QString col, QString rep)
{
QColor tmpc;
for (uint c = 0; c < ScMW->doc->Items->count(); c++)
for (uint c = 0; c < ScCore->primaryMainWindow()->doc->Items->count(); c++)
{
PageItem *ite = ScMW->doc->Items->at(c);
PageItem *ite = ScCore->primaryMainWindow()->doc->Items->at(c);
if (ite->itemType() == PageItem::TextFrame)
{
for (int d = 0; d < ite->itemText.length(); d++)
101,9 → 102,9
}
}
}
for (uint c = 0; c < ScMW->doc->MasterItems.count(); c++)
for (uint c = 0; c < ScCore->primaryMainWindow()->doc->MasterItems.count(); c++)
{
PageItem *ite = ScMW->doc->MasterItems.at(c);
PageItem *ite = ScCore->primaryMainWindow()->doc->MasterItems.at(c);
if (ite->itemType() == PageItem::TextFrame)
{
for (int d = 0; d < ite->itemText.length(); d++)
136,8 → 137,8
PageItem* GetUniqueItem(QString name)
{
if (name.length()==0)
if (ScMW->doc->m_Selection->count() != 0)
return ScMW->doc->m_Selection->itemAt(0);
if (ScCore->primaryMainWindow()->doc->m_Selection->count() != 0)
return ScCore->primaryMainWindow()->doc->m_Selection->itemAt(0);
else
{
PyErr_SetString(NoValidObjectError, QString("Cannot use empty string for object name when there is no selection"));
154,10 → 155,10
PyErr_SetString(PyExc_ValueError, QString("Cannot accept empty name for pageitem"));
return NULL;
}
for (uint j = 0; j<ScMW->doc->Items->count(); j++)
for (uint j = 0; j<ScCore->primaryMainWindow()->doc->Items->count(); j++)
{
if (name==ScMW->doc->Items->at(j)->itemName())
return ScMW->doc->Items->at(j);
if (name==ScCore->primaryMainWindow()->doc->Items->at(j)->itemName())
return ScCore->primaryMainWindow()->doc->Items->at(j);
} // for items
PyErr_SetString(NoValidObjectError, QString("Object not found"));
return NULL;
173,9 → 174,9
{
if (name.length() == 0)
return false;
for (uint j = 0; j<ScMW->doc->Items->count(); j++)
for (uint j = 0; j<ScCore->primaryMainWindow()->doc->Items->count(); j++)
{
if (name==ScMW->doc->Items->at(j)->itemName())
if (name==ScCore->primaryMainWindow()->doc->Items->at(j)->itemName())
return true;
} // for items
return false;
190,7 → 191,7
*/
bool checkHaveDocument()
{
if (ScMW->HaveDoc)
if (ScCore->primaryMainWindow()->HaveDoc)
return true;
// Caller is required to check for false return from this function
// and return NULL.
202,29 → 203,29
{
/*
QStringList names;
QPtrListIterator<PageItem> it(ScMW->view->SelItem);
QPtrListIterator<PageItem> it(ScCore->primaryMainWindow()->view->SelItem);
for ( ; it.current() != 0 ; ++it)
names.append(it.current()->itemName());
return names;
*/
return ScMW->doc->m_Selection->getSelectedItemsByName();
return ScCore->primaryMainWindow()->doc->m_Selection->getSelectedItemsByName();
}
 
bool setSelectedItemsByName(QStringList& itemNames)
{
ScMW->view->Deselect();
ScCore->primaryMainWindow()->view->Deselect();
// For each named item
for (QStringList::Iterator it = itemNames.begin() ; it != itemNames.end() ; it++)
{
// Search for the named item
PageItem* item = 0;
for (uint j = 0; j < ScMW->doc->Items->count(); j++)
if (*it == ScMW->doc->Items->at(j)->itemName())
item = ScMW->doc->Items->at(j);
for (uint j = 0; j < ScCore->primaryMainWindow()->doc->Items->count(); j++)
if (*it == ScCore->primaryMainWindow()->doc->Items->at(j)->itemName())
item = ScCore->primaryMainWindow()->doc->Items->at(j);
if (!item)
return false;
// and select it
ScMW->view->SelectItemNr(item->ItemNr);
ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
}
return true;
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
6,6 → 6,7
*/
#include "cmdgetprop.h"
#include "cmdutil.h"
#include "scribuscore.h"
 
PyObject *scribus_getfillcolor(PyObject* /* self */, PyObject* args)
{
197,7 → 198,7
int typ = -1;
uint counter = 0;
uint counter2 = 0;
uint pageNr = ScMW->doc->currentPageNumber();
uint pageNr = ScCore->primaryMainWindow()->doc->currentPageNumber();
if (!PyArg_ParseTuple(args, "|i", &typ))
return NULL;
if(!checkHaveDocument())
205,37 → 206,37
// have doc already
if (typ != -1)
{
for (uint lam2 = 0; lam2 < ScMW->doc->Items->count(); ++lam2)
for (uint lam2 = 0; lam2 < ScCore->primaryMainWindow()->doc->Items->count(); ++lam2)
{
if ((ScMW->doc->Items->at(lam2)->itemType() == typ) && (pageNr == static_cast<uint>(ScMW->doc->Items->at(lam2)->OwnPage)))
if ((ScCore->primaryMainWindow()->doc->Items->at(lam2)->itemType() == typ) && (pageNr == static_cast<uint>(ScCore->primaryMainWindow()->doc->Items->at(lam2)->OwnPage)))
counter++;
}
}
else
{
for (uint lam2 = 0; lam2 < ScMW->doc->Items->count(); ++lam2)
for (uint lam2 = 0; lam2 < ScCore->primaryMainWindow()->doc->Items->count(); ++lam2)
{
if (pageNr == static_cast<uint>(ScMW->doc->Items->at(lam2)->OwnPage))
if (pageNr == static_cast<uint>(ScCore->primaryMainWindow()->doc->Items->at(lam2)->OwnPage))
counter++;
}
}
 
l = PyList_New(counter);
for (uint lam=0; lam < ScMW->doc->Items->count(); ++lam)
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Items->count(); ++lam)
{
if (pageNr == static_cast<uint>(ScMW->doc->Items->at(lam)->OwnPage))
if (pageNr == static_cast<uint>(ScCore->primaryMainWindow()->doc->Items->at(lam)->OwnPage))
{
if (typ != -1)
{
if (ScMW->doc->Items->at(lam)->itemType() == typ)
if (ScCore->primaryMainWindow()->doc->Items->at(lam)->itemType() == typ)
{
PyList_SetItem(l, counter2, PyString_FromString(ScMW->doc->Items->at(lam)->itemName().utf8()));
PyList_SetItem(l, counter2, PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(lam)->itemName().utf8()));
counter2++;
}
}
else
{
PyList_SetItem(l, counter2, PyString_FromString(ScMW->doc->Items->at(lam)->itemName().utf8()));
PyList_SetItem(l, counter2, PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(lam)->itemName().utf8()));
counter2++;
}
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
10,6 → 10,7
#include "prefsmanager.h"
#include "selection.h"
#include "util.h"
#include "scribuscore.h"
 
PyObject *scribus_getfontsize(PyObject* /* self */, PyObject* args)
{
219,9 → 220,9
PyMem_Free(Text);
currItem->itemText.clear();
currItem->CPos = 0;
for (uint a = 0; a < ScMW->doc->FrameItems.count(); ++a)
for (uint a = 0; a < ScCore->primaryMainWindow()->doc->FrameItems.count(); ++a)
{
ScMW->doc->FrameItems.at(a)->ItemNr = a;
ScCore->primaryMainWindow()->doc->FrameItems.at(a)->ItemNr = a;
}
currItem->itemText.insertChars(0, Daten);
currItem->Dirty = false;
258,7 → 259,7
it->itemText.insertChars(pos, Daten);
it->CPos = pos + Daten.length();
it->Dirty = true;
if (ScMW->doc->DoDrawing)
if (ScCore->primaryMainWindow()->doc->DoDrawing)
{
it->paintObj();
it->Dirty = false;
288,14 → 289,14
PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set text alignment on a non-text frame.","python error"));
return NULL;
}
int Apm = ScMW->doc->appMode;
ScMW->doc->m_Selection->clear();
ScMW->doc->m_Selection->addItem(i);
int Apm = ScCore->primaryMainWindow()->doc->appMode;
ScCore->primaryMainWindow()->doc->m_Selection->clear();
ScCore->primaryMainWindow()->doc->m_Selection->addItem(i);
if (i->HasSel)
ScMW->doc->appMode = modeEdit;
ScMW->setNewAlignment(alignment);
ScMW->doc->appMode = Apm;
ScMW->view->Deselect();
ScCore->primaryMainWindow()->doc->appMode = modeEdit;
ScCore->primaryMainWindow()->setNewAlignment(alignment);
ScCore->primaryMainWindow()->doc->appMode = Apm;
ScCore->primaryMainWindow()->view->Deselect();
Py_INCREF(Py_None);
return Py_None;
}
322,14 → 323,14
PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set font size on a non-text frame.","python error"));
return NULL;
}
int Apm = ScMW->doc->appMode;
ScMW->doc->m_Selection->clear();
ScMW->doc->m_Selection->addItem(i);
int Apm = ScCore->primaryMainWindow()->doc->appMode;
ScCore->primaryMainWindow()->doc->m_Selection->clear();
ScCore->primaryMainWindow()->doc->m_Selection->addItem(i);
if (i->HasSel)
ScMW->doc->appMode = modeEdit;
ScMW->doc->chFSize(qRound(size * 10.0));
ScMW->doc->appMode = Apm;
ScMW->view->Deselect();
ScCore->primaryMainWindow()->doc->appMode = modeEdit;
ScCore->primaryMainWindow()->doc->chFSize(qRound(size * 10.0));
ScCore->primaryMainWindow()->doc->appMode = Apm;
ScCore->primaryMainWindow()->view->Deselect();
Py_INCREF(Py_None);
return Py_None;
}
352,14 → 353,14
}
if (PrefsManager::instance()->appPrefs.AvailFonts.find(QString::fromUtf8(Font)))
{
int Apm = ScMW->doc->appMode;
ScMW->doc->m_Selection->clear();
ScMW->doc->m_Selection->addItem(i);
int Apm = ScCore->primaryMainWindow()->doc->appMode;
ScCore->primaryMainWindow()->doc->m_Selection->clear();
ScCore->primaryMainWindow()->doc->m_Selection->addItem(i);
if (i->HasSel)
ScMW->doc->appMode = modeEdit;
ScMW->SetNewFont(QString::fromUtf8(Font));
ScMW->doc->appMode = Apm;
ScMW->view->Deselect();
ScCore->primaryMainWindow()->doc->appMode = modeEdit;
ScCore->primaryMainWindow()->SetNewFont(QString::fromUtf8(Font));
ScCore->primaryMainWindow()->doc->appMode = Apm;
ScCore->primaryMainWindow()->view->Deselect();
}
else
{
519,9 → 520,9
{
it->itemText.clear();
it->CPos = 0;
for (uint a = 0; a < ScMW->doc->FrameItems.count(); ++a)
for (uint a = 0; a < ScCore->primaryMainWindow()->doc->FrameItems.count(); ++a)
{
ScMW->doc->FrameItems.at(a)->ItemNr = a;
ScCore->primaryMainWindow()->doc->FrameItems.at(a)->ItemNr = a;
}
}
Py_INCREF(Py_None);
681,9 → 682,9
// references to the others boxes
fromitem->NextBox = toitem;
toitem->BackBox = fromitem;
ScMW->view->DrawNew();
ScCore->primaryMainWindow()->view->DrawNew();
// enable 'save icon' stuff
ScMW->slotDocCh();
ScCore->primaryMainWindow()->slotDocCh();
Py_INCREF(Py_None);
return Py_None;
}
729,10 → 730,10
*/
item->BackBox->NextBox = 0;
item->BackBox = 0;
item->itemText = StoryText(item->document());
item->itemText = StoryText(item->doc());
// enable 'save icon' stuff
ScMW->slotDocCh();
ScMW->view->DrawNew();
ScCore->primaryMainWindow()->slotDocCh();
ScCore->primaryMainWindow()->view->DrawNew();
Py_INCREF(Py_None);
return Py_None;
}
758,9 → 759,9
PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot convert a non-text frame to outlines.","python error"));
return NULL;
}
ScMW->view->Deselect(true);
ScMW->view->SelectItemNr(item->ItemNr);
ScMW->view->TextToPath();
ScCore->primaryMainWindow()->view->Deselect(true);
ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
ScCore->primaryMainWindow()->view->TextToPath();
Py_INCREF(Py_None);
return Py_None;
}
833,10 → 834,10
if (toggle)
{
i->setIsAnnotation(false);
ScMW->AddBookMark(i);
ScCore->primaryMainWindow()->AddBookMark(i);
}
else
ScMW->DelBookMark(i);
ScCore->primaryMainWindow()->DelBookMark(i);
i->isBookmark = toggle;
Py_INCREF(Py_None);
return Py_None;
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp
8,6 → 8,7
#include "cmdutil.h"
#include "mpalette.h" //CB argh.. noooooooooooooooooooooooooooooooooooo FIXME see other FIXME
#include "selection.h"
#include "scribuscore.h"
 
PyObject *scribus_loadimage(PyObject* /* self */, PyObject* args)
{
25,7 → 26,7
PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error"));
return NULL;
}
ScMW->doc->LoadPict(QString::fromUtf8(Image), item->ItemNr);
ScCore->primaryMainWindow()->doc->LoadPict(QString::fromUtf8(Image), item->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
47,8 → 48,8
return NULL;
}
item->setImageXYScale(x, y);
ScMW->doc->itemSelection_SetImageScale(x, y); //CB why when this is done above?
ScMW->doc->updatePic();
ScCore->primaryMainWindow()->doc->itemSelection_SetImageScale(x, y); //CB why when this is done above?
ScCore->primaryMainWindow()->doc->updatePic();
Py_INCREF(Py_None);
return Py_None;
}
65,27 → 66,27
if (item==NULL)
return NULL;
// Grab the old selection
//QPtrList<PageItem> oldSelection = ScMW->view->SelItem;
//int tempList=ScMW->doc->selection->backupToTempList(0);
Selection tempSelection(*ScMW->doc->m_Selection);
ScMW->doc->m_Selection->clear();
//QPtrList<PageItem> oldSelection = ScCore->primaryMainWindow()->view->SelItem;
//int tempList=ScCore->primaryMainWindow()->doc->selection->backupToTempList(0);
Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
ScCore->primaryMainWindow()->doc->m_Selection->clear();
// Clear the selection
ScMW->view->Deselect();
ScCore->primaryMainWindow()->view->Deselect();
// Select the item, which will also select its group if
// there is one.
ScMW->view->SelectItemNr(item->ItemNr);
ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
// Move the item, or items
if (ScMW->doc->m_Selection->count() > 1)
ScMW->view->moveGroup(ValueToPoint(x), ValueToPoint(y));
if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
ScCore->primaryMainWindow()->view->moveGroup(ValueToPoint(x), ValueToPoint(y));
else
ScMW->view->MoveItem(ValueToPoint(x), ValueToPoint(y), item);
ScCore->primaryMainWindow()->view->MoveItem(ValueToPoint(x), ValueToPoint(y), item);
// Now restore the selection. We just have to go through and select
// each and every item, unfortunately.
//ScMW->doc->selection->restoreFromTempList(0, tempList);
*ScMW->doc->m_Selection=tempSelection;
//ScMW->view->Deselect();
//ScCore->primaryMainWindow()->doc->selection->restoreFromTempList(0, tempList);
*ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
//ScCore->primaryMainWindow()->view->Deselect();
//for ( oldSelection.first(); oldSelection.current(); oldSelection.next() )
// ScMW->view->SelectItemNr(oldSelection.current()->ItemNr);
// ScCore->primaryMainWindow()->view->SelectItemNr(oldSelection.current()->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
102,30 → 103,30
if (item == NULL)
return NULL;
// Grab the old selection
//QPtrList<PageItem> oldSelection = ScMW->view->SelItem;
//int tempList=ScMW->doc->selection->backupToTempList(0);
Selection tempSelection(*ScMW->doc->m_Selection);
//QPtrList<PageItem> oldSelection = ScCore->primaryMainWindow()->view->SelItem;
//int tempList=ScCore->primaryMainWindow()->doc->selection->backupToTempList(0);
Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
// Clear the selection
ScMW->view->Deselect();
ScCore->primaryMainWindow()->view->Deselect();
// Select the item, which will also select its group if
// there is one.
ScMW->view->SelectItemNr(item->ItemNr);
ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
// Move the item, or items
if (ScMW->doc->m_Selection->count() > 1)
if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
{
double x2, y2, w, h;
ScMW->view->getGroupRect(&x2, &y2, &w, &h);
ScMW->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
ScCore->primaryMainWindow()->view->getGroupRect(&x2, &y2, &w, &h);
ScCore->primaryMainWindow()->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
}
else
ScMW->view->MoveItem(pageUnitXToDocX(x) - item->xPos(), pageUnitYToDocY(y) - item->yPos(), item);
ScCore->primaryMainWindow()->view->MoveItem(pageUnitXToDocX(x) - item->xPos(), pageUnitYToDocY(y) - item->yPos(), item);
// Now restore the selection. We just have to go through and select
// each and every item, unfortunately.
//ScMW->doc->selection->restoreFromTempList(0, tempList);
*ScMW->doc->m_Selection=tempSelection;
//ScMW->view->Deselect();
//ScCore->primaryMainWindow()->doc->selection->restoreFromTempList(0, tempList);
*ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
//ScCore->primaryMainWindow()->view->Deselect();
//for ( oldSelection.first(); oldSelection.current(); oldSelection.next() )
// ScMW->view->SelectItemNr(oldSelection.current()->ItemNr);
// ScCore->primaryMainWindow()->view->SelectItemNr(oldSelection.current()->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
141,7 → 142,7
PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
if (item == NULL)
return NULL;
ScMW->view->RotateItem(item->rotation() - x, item->ItemNr);
ScCore->primaryMainWindow()->view->RotateItem(item->rotation() - x, item->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
157,7 → 158,7
PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
if (item == NULL)
return NULL;
ScMW->view->RotateItem(x * -1.0, item->ItemNr);
ScCore->primaryMainWindow()->view->RotateItem(x * -1.0, item->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
173,7 → 174,7
PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
if (item == NULL)
return NULL;
ScMW->view->SizeItem(ValueToPoint(x), ValueToPoint(y), item->ItemNr);
ScCore->primaryMainWindow()->view->SizeItem(ValueToPoint(x), ValueToPoint(y), item->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
186,7 → 187,7
return NULL;
if(!checkHaveDocument())
return NULL;
uint ap = ScMW->doc->currentPage()->pageNr();
uint ap = ScCore->primaryMainWindow()->doc->currentPage()->pageNr();
// If we were passed a list of items to group...
if (il != 0)
{
198,7 → 199,7
return NULL;
}
QStringList oldSelection = getSelectedItemsByName();
ScMW->view->Deselect();
ScCore->primaryMainWindow()->view->Deselect();
for (int i = 0; i < len; i++)
{
// FIXME: We might need to explicitly get this string as utf8
208,22 → 209,22
PageItem *ic = GetUniqueItem(QString::fromUtf8(Name));
if (ic == NULL)
return NULL;
ScMW->view->SelectItemNr(ic->ItemNr);
ScCore->primaryMainWindow()->view->SelectItemNr(ic->ItemNr);
}
ScMW->GroupObj();
ScCore->primaryMainWindow()->GroupObj();
setSelectedItemsByName(oldSelection);
}
// or if no argument list was given but there is a selection...
else if (ScMW->doc->m_Selection->count() != 0)
else if (ScCore->primaryMainWindow()->doc->m_Selection->count() != 0)
{
if (ScMW->doc->m_Selection->count() < 2)
if (ScCore->primaryMainWindow()->doc->m_Selection->count() < 2)
{
// We can't very well group only one item
PyErr_SetString(NoValidObjectError, QObject::tr("Can't group less than two items", "python error"));
return NULL;
}
ScMW->GroupObj();
ScMW->view->GotoPage(ap);
ScCore->primaryMainWindow()->GroupObj();
ScCore->primaryMainWindow()->view->GotoPage(ap);
}
else
{
244,7 → 245,7
PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
if (i == NULL)
return NULL;
ScMW->UnGroupObj();
ScCore->primaryMainWindow()->UnGroupObj();
Py_INCREF(Py_None);
return Py_None;
}
265,12 → 266,12
PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
if (i == NULL)
return NULL;
ScMW->view->Deselect();
ScMW->view->SelectItemNr(i->ItemNr);
int h = ScMW->view->frameResizeHandle;
ScMW->view->frameResizeHandle = 1;
ScMW->view->scaleGroup(sc, sc);
ScMW->view->frameResizeHandle = h;
ScCore->primaryMainWindow()->view->Deselect();
ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
int h = ScCore->primaryMainWindow()->view->frameResizeHandle;
ScCore->primaryMainWindow()->view->frameResizeHandle = 1;
ScCore->primaryMainWindow()->view->scaleGroup(sc, sc);
ScCore->primaryMainWindow()->view->frameResizeHandle = h;
Py_INCREF(Py_None);
return Py_None;
}
282,8 → 283,8
return NULL;
if(!checkHaveDocument())
return NULL;
if ((i < static_cast<int>(ScMW->doc->m_Selection->count())) && (i > -1))
return PyString_FromString(ScMW->doc->m_Selection->itemAt(i)->itemName().utf8());
if ((i < static_cast<int>(ScCore->primaryMainWindow()->doc->m_Selection->count())) && (i > -1))
return PyString_FromString(ScCore->primaryMainWindow()->doc->m_Selection->itemAt(i)->itemName().utf8());
else
// FIXME: Should probably return None if no selection?
return PyString_FromString("");
293,7 → 294,7
{
if(!checkHaveDocument())
return NULL;
return PyInt_FromLong(static_cast<long>(ScMW->doc->m_Selection->count()));
return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->doc->m_Selection->count()));
}
 
PyObject *scribus_selectobj(PyObject* /* self */, PyObject* args)
306,7 → 307,7
PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
if (i == NULL)
return NULL;
ScMW->view->SelectItemNr(i->ItemNr);
ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
315,7 → 316,7
{
if(!checkHaveDocument())
return NULL;
ScMW->view->Deselect();
ScCore->primaryMainWindow()->view->Deselect();
Py_INCREF(Py_None);
return Py_None;
}
381,11 → 382,11
// Force the braindead app to notice the changes
//FIXME emit or something so we dont need this
ScMW->propertiesPalette->setLvalue(item->imageXScale(), item->imageYScale(), item->imageXOffset(), item->imageYOffset());
ScCore->primaryMainWindow()->propertiesPalette->setLvalue(item->imageXScale(), item->imageYScale(), item->imageXOffset(), item->imageYOffset());
item->AdjustPictScale();
//ScMW->view->AdjustPictScale(item);
//ScCore->primaryMainWindow()->view->AdjustPictScale(item);
ScMW->view->RefreshItem(item);
ScCore->primaryMainWindow()->view->RefreshItem(item);
Py_INCREF(Py_None);
return Py_None;
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/objimageexport.cpp
11,6 → 11,7
#include <structmember.h>
#include <qfileinfo.h>
#include <vector>
#include "scribuscore.h"
 
typedef struct
{
143,10 → 144,10
* portrait and user defined sizes.
*/
double pixmapSize;
(ScMW->doc->pageHeight > ScMW->doc->pageWidth)
? pixmapSize = ScMW->doc->pageHeight
: pixmapSize = ScMW->doc->pageWidth;
QImage im = ScMW->view->PageToPixmap(ScMW->doc->currentPage()->pageNr(), qRound(pixmapSize * self->scale * (self->dpi / 72.0) / 100.0), false);
(ScCore->primaryMainWindow()->doc->pageHeight > ScCore->primaryMainWindow()->doc->pageWidth)
? pixmapSize = ScCore->primaryMainWindow()->doc->pageHeight
: pixmapSize = ScCore->primaryMainWindow()->doc->pageWidth;
QImage im = ScCore->primaryMainWindow()->view->PageToPixmap(ScCore->primaryMainWindow()->doc->currentPage()->pageNr(), qRound(pixmapSize * self->scale * (self->dpi / 72.0) / 100.0), false);
int dpi = qRound(100.0 / 2.54 * self->dpi);
im.setDotsPerMeterY(dpi);
im.setDotsPerMeterX(dpi);
172,10 → 173,10
* portrait and user defined sizes.
*/
double pixmapSize;
(ScMW->doc->pageHeight > ScMW->doc->pageWidth)
? pixmapSize = ScMW->doc->pageHeight
: pixmapSize = ScMW->doc->pageWidth;
QImage im = ScMW->view->PageToPixmap(ScMW->doc->currentPage()->pageNr(), qRound(pixmapSize * self->scale * (self->dpi / 72.0) / 100.0), false);
(ScCore->primaryMainWindow()->doc->pageHeight > ScCore->primaryMainWindow()->doc->pageWidth)
? pixmapSize = ScCore->primaryMainWindow()->doc->pageHeight
: pixmapSize = ScCore->primaryMainWindow()->doc->pageWidth;
QImage im = ScCore->primaryMainWindow()->view->PageToPixmap(ScCore->primaryMainWindow()->doc->currentPage()->pageNr(), qRound(pixmapSize * self->scale * (self->dpi / 72.0) / 100.0), false);
int dpi = qRound(100.0 / 2.54 * self->dpi);
im.setDotsPerMeterY(dpi);
im.setDotsPerMeterX(dpi);
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
6,6 → 6,7
*/
#include "cmdsetprop.h"
#include "cmdutil.h"
#include "scribuscore.h"
 
PyObject *scribus_setgradfill(PyObject* /* self */, PyObject* args)
{
29,9 → 30,9
currItem->SetFarbe(&tmp, c2, shade2);
currItem->fill_gradient.addStop(tmp, 1.0, 0.5, 1.0, c2, shade2);
currItem->GrType = typ;
//ScMW->view->updateGradientVectors(currItem);
//ScCore->primaryMainWindow()->view->updateGradientVectors(currItem);
currItem->updateGradientVectors();
ScMW->view->RefreshItem(currItem);
ScCore->primaryMainWindow()->view->RefreshItem(currItem);
Py_INCREF(Py_None);
return Py_None;
}
198,8 → 199,8
// apply rounding
currItem->setCornerRadius(w);
currItem->SetFrameRound();
ScMW->doc->setRedrawBounding(currItem);
ScMW->view->SetFrameRounded();
ScCore->primaryMainWindow()->doc->setRedrawBounding(currItem);
ScCore->primaryMainWindow()->view->SetFrameRounded();
Py_INCREF(Py_None);
return Py_None;
}
215,7 → 216,7
PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name));
if (currItem == NULL)
return NULL;
if (!ScMW->doc->MLineStyles.contains(QString::fromUtf8(Style)))
if (!ScCore->primaryMainWindow()->doc->MLineStyles.contains(QString::fromUtf8(Style)))
{
PyErr_SetString(NotFoundError, QObject::tr("Line style not found.","python error"));
return NULL;
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp
8,6 → 8,7
#include "cmdutil.h"
#include "units.h"
#include "documentinformation.h"
#include "scribuscore.h"
 
/*
newDocument(size, margins, orientation, firstPageNumber,
56,7 → 57,7
topMargin = value2pts(topMargin, unit);
bottomMargin = value2pts(bottomMargin, unit);
 
bool ret = ScMW->doFileNew(pageWidth, pageHeight,
bool ret = ScCore->primaryMainWindow()->doFileNew(pageWidth, pageHeight,
topMargin, leftMargin, rightMargin, bottomMargin,
// autoframes. It's disabled in python
// columnDistance, numberCols, autoframes,
63,7 → 64,7
0, 1, false,
pagesType, unit, firstPageOrder,
orientation, firstPageNr, "Custom");
ScMW->doc->pageSets[pagesType].FirstPage = firstPageOrder;
ScCore->primaryMainWindow()->doc->pageSets[pagesType].FirstPage = firstPageOrder;
 
return PyInt_FromLong(static_cast<long>(ret));
}
97,7 → 98,7
lr = value2pts(lr, unit);
rr = value2pts(rr, unit);
btr = value2pts(btr, unit);
bool ret = ScMW->doFileNew(b, h, tpr, lr, rr, btr, 0, 1, false, ds, unit, fsl, ori, fNr, "Custom");
bool ret = ScCore->primaryMainWindow()->doFileNew(b, h, tpr, lr, rr, btr, 0, 1, false, ds, unit, fsl, ori, fNr, "Custom");
// qApp->processEvents();
return PyInt_FromLong(static_cast<long>(ret));
}
113,11 → 114,11
lr = ValueToPoint(lr);
rr = ValueToPoint(rr);
btr = ValueToPoint(btr);
ScMW->doc->resetPage(tpr, lr, rr, btr, ScMW->doc->currentPageLayout);
ScMW->view->reformPages();
ScMW->doc->setModified(true);
ScMW->view->GotoPage(ScMW->doc->currentPageNumber());
ScMW->view->DrawNew();
ScCore->primaryMainWindow()->doc->resetPage(tpr, lr, rr, btr, ScCore->primaryMainWindow()->doc->currentPageLayout);
ScCore->primaryMainWindow()->view->reformPages();
ScCore->primaryMainWindow()->doc->setModified(true);
ScCore->primaryMainWindow()->view->GotoPage(ScCore->primaryMainWindow()->doc->currentPageNumber());
ScCore->primaryMainWindow()->view->DrawNew();
Py_INCREF(Py_None);
return Py_None;
}
126,8 → 127,8
{
if(!checkHaveDocument())
return NULL;
ScMW->doc->setModified(false);
bool ret = ScMW->slotFileClose();
ScCore->primaryMainWindow()->doc->setModified(false);
bool ret = ScCore->primaryMainWindow()->slotFileClose();
qApp->processEvents();
return PyInt_FromLong(static_cast<long>(ret));
}
134,7 → 135,7
 
PyObject *scribus_havedoc(PyObject* /* self */)
{
return PyInt_FromLong(static_cast<long>(ScMW->HaveDoc));
return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->HaveDoc));
}
 
PyObject *scribus_opendoc(PyObject* /* self */, PyObject* args)
142,7 → 143,7
char *Name;
if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
return NULL;
bool ret = ScMW->loadDoc(QString::fromUtf8(Name));
bool ret = ScCore->primaryMainWindow()->loadDoc(QString::fromUtf8(Name));
if (!ret)
{
PyErr_SetString(ScribusException, QObject::tr("Failed to open document.","python error"));
156,7 → 157,7
{
if(!checkHaveDocument())
return NULL;
ScMW->slotFileSave();
ScCore->primaryMainWindow()->slotFileSave();
Py_INCREF(Py_None);
return Py_None;
}
168,7 → 169,7
return NULL;
if(!checkHaveDocument())
return NULL;
bool ret = ScMW->DoFileSave(QString::fromUtf8(Name));
bool ret = ScCore->primaryMainWindow()->DoFileSave(QString::fromUtf8(Name));
if (!ret)
{
PyErr_SetString(ScribusException, QObject::tr("Failed to save document.","python error"));
189,10 → 190,10
return NULL;
if(!checkHaveDocument())
return NULL;
ScMW->doc->documentInfo.setAuthor(QString::fromUtf8(Author));
ScMW->doc->documentInfo.setTitle(QString::fromUtf8(Title));
ScMW->doc->documentInfo.setComments(QString::fromUtf8(Desc));
ScMW->slotDocCh();
ScCore->primaryMainWindow()->doc->documentInfo.setAuthor(QString::fromUtf8(Author));
ScCore->primaryMainWindow()->doc->documentInfo.setTitle(QString::fromUtf8(Title));
ScCore->primaryMainWindow()->doc->documentInfo.setComments(QString::fromUtf8(Desc));
ScCore->primaryMainWindow()->slotDocCh();
Py_INCREF(Py_None);
return Py_None;
}
209,7 → 210,7
PyErr_SetString(PyExc_ValueError, QObject::tr("Unit out of range. Use one of the scribus.UNIT_* constants.","python error"));
return NULL;
}
ScMW->slotChangeUnit(e);
ScCore->primaryMainWindow()->slotChangeUnit(e);
Py_INCREF(Py_None);
return Py_None;
}
218,7 → 219,7
{
if(!checkHaveDocument())
return NULL;
return PyInt_FromLong(static_cast<long>(ScMW->doc->unitIndex()));
return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->doc->unitIndex()));
}
 
PyObject *scribus_loadstylesfromfile(PyObject* /* self */, PyObject *args)
228,7 → 229,7
return NULL;
if(!checkHaveDocument())
return NULL;
ScMW->doc->loadStylesFromFile(QString::fromUtf8(fileName));
ScCore->primaryMainWindow()->doc->loadStylesFromFile(QString::fromUtf8(fileName));
Py_INCREF(Py_None);
return Py_None;
}
240,13 → 241,13
return NULL;
if(!checkHaveDocument())
return NULL;
if (ScMW->doc->currentPageLayout == fp)
ScMW->doc->pageSets[ScMW->doc->currentPageLayout].FirstPage = fsl;
ScMW->view->reformPages();
ScMW->view->GotoPage(ScMW->doc->currentPageNumber()); // is this needed?
ScMW->view->DrawNew(); // is this needed?
//CB TODO ScMW->pagePalette->RebuildPage(); // is this needed?
ScMW->slotDocCh();
if (ScCore->primaryMainWindow()->doc->currentPageLayout == fp)
ScCore->primaryMainWindow()->doc->pageSets[ScCore->primaryMainWindow()->doc->currentPageLayout].FirstPage = fsl;
ScCore->primaryMainWindow()->view->reformPages();
ScCore->primaryMainWindow()->view->GotoPage(ScCore->primaryMainWindow()->doc->currentPageNumber()); // is this needed?
ScCore->primaryMainWindow()->view->DrawNew(); // is this needed?
//CB TODO ScCore->primaryMainWindow()->pagePalette->RebuildPage(); // is this needed?
ScCore->primaryMainWindow()->slotDocCh();
Py_INCREF(Py_None);
return Py_None;
}
255,7 → 256,7
{
if(!checkHaveDocument())
return NULL;
ScMW->view->hideMasterPage();
ScCore->primaryMainWindow()->view->hideMasterPage();
Py_INCREF(Py_None);
return Py_None;
}
264,9 → 265,9
{
if(!checkHaveDocument())
return NULL;
PyObject* names = PyList_New(ScMW->doc->MasterPages.count());
QMap<QString,int>::const_iterator it(ScMW->doc->MasterNames.constBegin());
QMap<QString,int>::const_iterator itEnd(ScMW->doc->MasterNames.constEnd());
PyObject* names = PyList_New(ScCore->primaryMainWindow()->doc->MasterPages.count());
QMap<QString,int>::const_iterator it(ScCore->primaryMainWindow()->doc->MasterNames.constBegin());
QMap<QString,int>::const_iterator itEnd(ScCore->primaryMainWindow()->doc->MasterNames.constEnd());
int n = 0;
for ( ; it != itEnd; ++it )
{
283,7 → 284,7
if(!checkHaveDocument())
return NULL;
const QString masterPageName(name);
const QMap<QString,int>& masterNames(ScMW->doc->MasterNames);
const QMap<QString,int>& masterNames(ScCore->primaryMainWindow()->doc->MasterNames);
const QMap<QString,int>::const_iterator it(masterNames.find(masterPageName));
if ( it == masterNames.constEnd() )
{
290,7 → 291,7
PyErr_SetString(PyExc_ValueError, "Master page not found");
return NULL;
}
ScMW->view->showMasterPage(*it);
ScCore->primaryMainWindow()->view->showMasterPage(*it);
Py_INCREF(Py_None);
return Py_None;
}
303,12 → 304,12
if(!checkHaveDocument())
return NULL;
const QString masterPageName(name);
if (ScMW->doc->MasterNames.contains(masterPageName))
if (ScCore->primaryMainWindow()->doc->MasterNames.contains(masterPageName))
{
PyErr_SetString(PyExc_ValueError, "Master page already exists");
return NULL;
}
ScMW->doc->addMasterPage(ScMW->doc->MasterPages.count(), masterPageName);
ScCore->primaryMainWindow()->doc->addMasterPage(ScCore->primaryMainWindow()->doc->MasterPages.count(), masterPageName);
Py_INCREF(Py_None);
return Py_None;
}
321,7 → 322,7
if(!checkHaveDocument())
return NULL;
const QString masterPageName(name);
if (!ScMW->doc->MasterNames.contains(masterPageName))
if (!ScCore->primaryMainWindow()->doc->MasterNames.contains(masterPageName))
{
PyErr_SetString(PyExc_ValueError, "Master page does not exist");
return NULL;
331,10 → 332,10
PyErr_SetString(PyExc_ValueError, "Can not delete the Normal master page");
return NULL;
}
bool oldMode = ScMW->doc->masterPageMode();
ScMW->doc->setMasterPageMode(true);
ScMW->DeletePage2(ScMW->doc->MasterNames[masterPageName]);
ScMW->doc->setMasterPageMode(oldMode);
bool oldMode = ScCore->primaryMainWindow()->doc->masterPageMode();
ScCore->primaryMainWindow()->doc->setMasterPageMode(true);
ScCore->primaryMainWindow()->DeletePage2(ScCore->primaryMainWindow()->doc->MasterNames[masterPageName]);
ScCore->primaryMainWindow()->doc->setMasterPageMode(oldMode);
Py_INCREF(Py_None);
return Py_None;
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/scripter2/scripter2_styles.cpp
23,8 → 23,8
 
ParagraphStyle & getStyleRef(const QString & styleName)
{
QValueList<ParagraphStyle>::iterator it(ScMW->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScMW->doc->docParagraphStyles.end());
QValueList<ParagraphStyle>::iterator it(ScCore->primaryMainWindow()->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScCore->primaryMainWindow()->doc->docParagraphStyles.end());
for ( ; it != itEnd; ++it)
{
if ((*it).Vname == styleName)
35,7 → 35,7
 
ParagraphStyle & getStyleRefi(int index)
{
return ScMW->doc->docParagraphStyles[index];
return ScCore->primaryMainWindow()->doc->docParagraphStyles[index];
}
 
ParagraphStyle getStyleVal(const QString & styleName)
50,14 → 50,14
 
void addStyle(const ParagraphStyle & style)
{
QValueList<ParagraphStyle>::iterator it(ScMW->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScMW->doc->docParagraphStyles.end());
QValueList<ParagraphStyle>::iterator it(ScCore->primaryMainWindow()->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScCore->primaryMainWindow()->doc->docParagraphStyles.end());
for ( ; it != itEnd; ++it)
{
if ((*it).Vname == style.Vname)
throw "Style of same name already exists";
}
ScMW->doc->docParagraphStyles.append(style);
ScCore->primaryMainWindow()->doc->docParagraphStyles.append(style);
}
 
// This returns a COPY of the paragraph styles; modifications to this list do
67,8 → 67,8
dict getStylesVal()
{
dict d;
QValueList<ParagraphStyle>::iterator it(ScMW->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScMW->doc->docParagraphStyles.end());
QValueList<ParagraphStyle>::iterator it(ScCore->primaryMainWindow()->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScCore->primaryMainWindow()->doc->docParagraphStyles.end());
for ( ; it != itEnd; ++it)
d[(*it).Vname] = *it;
return d;
77,8 → 77,8
dict getStylesRef()
{
dict d;
QValueList<ParagraphStyle>::iterator it(ScMW->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScMW->doc->docParagraphStyles.end());
QValueList<ParagraphStyle>::iterator it(ScCore->primaryMainWindow()->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScCore->primaryMainWindow()->doc->docParagraphStyles.end());
for ( ; it != itEnd; ++it)
d[(*it).Vname] = boost::ref(*it);
return d;
87,8 → 87,8
list getStyleNames()
{
list l;
QValueList<ParagraphStyle>::iterator it(ScMW->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScMW->doc->docParagraphStyles.end());
QValueList<ParagraphStyle>::iterator it(ScCore->primaryMainWindow()->doc->docParagraphStyles.begin());
QValueList<ParagraphStyle>::iterator itEnd(ScCore->primaryMainWindow()->doc->docParagraphStyles.end());
for ( ; it != itEnd; ++it)
l.append((*it).Vname);
return l;
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/scripter2/scripter2_scribus_pageitem.cpp
31,13 → 31,13
 
PageItem & getItem(const QString name)
{
return findItemByName(ScMW->doc->DocItems, name);
return findItemByName(ScCore->primaryMainWindow()->doc->DocItems, name);
}
 
list getItemNames()
{
list l;
QPtrList<PageItem>& items( ScMW->doc->DocItems );
QPtrList<PageItem>& items( ScCore->primaryMainWindow()->doc->DocItems );
for (
QPtrList<PageItem>::iterator it(items.begin()) ;
it != items.end() ;
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdcolor.cpp
8,6 → 8,7
#include "cmdutil.h"
#include "prefsmanager.h"
#include "commonstrings.h"
#include "scribuscore.h"
 
 
PyObject *scribus_colornames(PyObject* /* self */)
15,7 → 16,7
ColorList edc;
PyObject *l;
int cc = 0;
edc = ScMW->HaveDoc ? ScMW->doc->PageColors : PrefsManager::instance()->colorSet();
edc = ScCore->primaryMainWindow()->HaveDoc ? ScCore->primaryMainWindow()->doc->PageColors : PrefsManager::instance()->colorSet();
ColorList::Iterator it;
l = PyList_New(edc.count());
for (it = edc.begin(); it != edc.end(); ++it)
38,7 → 39,7
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot get a color with an empty name.","python error"));
return NULL;
}
edc = ScMW->HaveDoc ? ScMW->doc->PageColors : PrefsManager::instance()->colorSet();
edc = ScCore->primaryMainWindow()->HaveDoc ? ScCore->primaryMainWindow()->doc->PageColors : PrefsManager::instance()->colorSet();
QString col = QString::fromUtf8(Name);
if (!edc.contains(col))
{
60,7 → 61,7
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot get a color with an empty name.","python error"));
return NULL;
}
edc = ScMW->HaveDoc ? ScMW->doc->PageColors : PrefsManager::instance()->colorSet();
edc = ScCore->primaryMainWindow()->HaveDoc ? ScCore->primaryMainWindow()->doc->PageColors : PrefsManager::instance()->colorSet();
QString col = QString::fromUtf8(Name);
if (!edc.contains(col))
{
83,14 → 84,14
return NULL;
}
QString col = QString::fromUtf8(Name);
if (ScMW->HaveDoc)
if (ScCore->primaryMainWindow()->HaveDoc)
{
if (!ScMW->doc->PageColors.contains(col))
if (!ScCore->primaryMainWindow()->doc->PageColors.contains(col))
{
PyErr_SetString(NotFoundError, QObject::tr("Color not found in document.","python error"));
return NULL;
}
ScMW->doc->PageColors[col].setColor(c, m, y, k);
ScCore->primaryMainWindow()->doc->PageColors[col].setColor(c, m, y, k);
}
else
{
118,14 → 119,14
return NULL;
}
QString col = QString::fromUtf8(Name);
if (ScMW->HaveDoc)
if (ScCore->primaryMainWindow()->HaveDoc)
{
if (!ScMW->doc->PageColors.contains(col))
ScMW->doc->PageColors.insert(col, ScColor(c, m, y, k));
if (!ScCore->primaryMainWindow()->doc->PageColors.contains(col))
ScCore->primaryMainWindow()->doc->PageColors.insert(col, ScColor(c, m, y, k));
else
// FIXME: Given that we have a changeColour function, should we really be
// silently changing colours in newColour?
ScMW->doc->PageColors[col].setColor(c, m, y, k);
ScCore->primaryMainWindow()->doc->PageColors[col].setColor(c, m, y, k);
}
else
{
154,11 → 155,11
}
QString col = QString::fromUtf8(Name);
QString rep = QString::fromUtf8(Repl);
if (ScMW->HaveDoc)
if (ScCore->primaryMainWindow()->HaveDoc)
{
if (ScMW->doc->PageColors.contains(col) && (ScMW->doc->PageColors.contains(rep) || (rep == CommonStrings::None)))
if (ScCore->primaryMainWindow()->doc->PageColors.contains(col) && (ScCore->primaryMainWindow()->doc->PageColors.contains(rep) || (rep == CommonStrings::None)))
{
ScMW->doc->PageColors.remove(col);
ScCore->primaryMainWindow()->doc->PageColors.remove(col);
ReplaceColor(col, rep);
}
else
198,7 → 199,7
}
QString col = QString::fromUtf8(Name);
QString rep = QString::fromUtf8(Repl);
if (ScMW->doc->PageColors.contains(col) && (ScMW->doc->PageColors.contains(rep) || (rep == CommonStrings::None)))
if (ScCore->primaryMainWindow()->doc->PageColors.contains(col) && (ScCore->primaryMainWindow()->doc->PageColors.contains(rep) || (rep == CommonStrings::None)))
ReplaceColor(col, rep);
else
{
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
111,7 → 111,7
static PyObject * PDFfile_new(PyTypeObject *type, PyObject */*args*/, PyObject */*kwds*/)
{
// do not create new object if there is no opened document
if (!ScMW->HaveDoc) {
if (!ScCore->primaryMainWindow()->HaveDoc) {
PyErr_SetString(PyExc_SystemError, "Need to open document first");
return NULL;
}
246,14 → 246,14
static int PDFfile_init(PDFfile *self, PyObject */*args*/, PyObject */*kwds*/)
{
int i;
if (!ScMW->HaveDoc) {
if (!ScCore->primaryMainWindow()->HaveDoc) {
PyErr_SetString(PyExc_SystemError, "Must open doc first");
return -1;
}
// defaut save into file
QString tf = ScMW->doc->PDF_Options.Datei;
QString tf = ScCore->primaryMainWindow()->doc->PDF_Options.Datei;
if (tf.isEmpty()) {
QFileInfo fi = QFileInfo(ScMW->doc->DocName);
QFileInfo fi = QFileInfo(ScCore->primaryMainWindow()->doc->DocName);
tf = fi.dirPath()+"/"+fi.baseName()+".pdf";
}
PyObject *file = NULL;
276,7 → 276,7
return -1;
}
// get all used fonts
QMap<QString,int> ReallyUsed = ScMW->doc->UsedFonts;
QMap<QString,int> ReallyUsed = ScCore->primaryMainWindow()->doc->UsedFonts;
// create list of all used fonts
QValueList<QString> tmpEm;
tmpEm = ReallyUsed.keys();
303,8 → 303,8
PyObject *pages = NULL;
int num = 0;
// which one should I use ???
// new = ScMW->view->Pages.count()
num = ScMW->doc->Pages->count();
// new = ScCore->primaryMainWindow()->view->Pages.count()
num = ScCore->primaryMainWindow()->doc->Pages->count();
pages = PyList_New(num);
if (!pages){
PyErr_SetString(PyExc_SystemError, "Can not initialize 'pages' attribute");
323,12 → 323,12
Py_DECREF(self->pages);
self->pages = pages;
// do not print thumbnails
self->thumbnails = ScMW->doc->PDF_Options.Thumbnails;
self->thumbnails = ScCore->primaryMainWindow()->doc->PDF_Options.Thumbnails;
// set automatic compression
self->compress = ScMW->doc->PDF_Options.Compress;
self->compressmtd = ScMW->doc->PDF_Options.CompressMethod;
self->compress = ScCore->primaryMainWindow()->doc->PDF_Options.Compress;
self->compressmtd = ScCore->primaryMainWindow()->doc->PDF_Options.CompressMethod;
// use maximum image quality
self->quality = ScMW->doc->PDF_Options.Quality;
self->quality = ScCore->primaryMainWindow()->doc->PDF_Options.Quality;
// default resolution
PyObject *resolution = NULL;
resolution = PyInt_FromLong(300);
340,7 → 340,7
return -1;
}
// do not downsample images
int down = ScMW->doc->PDF_Options.RecalcPic ? ScMW->doc->PDF_Options.PicRes : 0;
int down = ScCore->primaryMainWindow()->doc->PDF_Options.RecalcPic ? ScCore->primaryMainWindow()->doc->PDF_Options.PicRes : 0;
PyObject *downsample = NULL;
downsample = PyInt_FromLong(down);
if (downsample){
351,26 → 351,26
return -1;
}
// no bookmarks
self->bookmarks = ScMW->doc->PDF_Options.Bookmarks;
self->bookmarks = ScCore->primaryMainWindow()->doc->PDF_Options.Bookmarks;
// left margin binding
self->binding = ScMW->doc->PDF_Options.Binding;
self->binding = ScCore->primaryMainWindow()->doc->PDF_Options.Binding;
// do not enable presentation effects
self->presentation = ScMW->doc->PDF_Options.PresentMode;
self->presentation = ScCore->primaryMainWindow()->doc->PDF_Options.PresentMode;
// set effects values for all pages
PyObject *effval = NULL;
num = 0;
// which one should I use ???
// new = ScMW->view->Pages.count();
num = ScMW->doc->Pages->count();
// new = ScCore->primaryMainWindow()->view->Pages.count();
num = ScCore->primaryMainWindow()->doc->Pages->count();
effval = PyList_New(num);
if (!effval){
PyErr_SetString(PyExc_SystemError, "Can not initialize 'effval' attribute");
return -1;
}
int num2 = ScMW->doc->PDF_Options.PresentVals.count();
int num2 = ScCore->primaryMainWindow()->doc->PDF_Options.PresentVals.count();
for (i = 0; i<num2; ++i) {
PyObject *tmp;
PDFPresentationData t = ScMW->doc->PDF_Options.PresentVals[i];
PDFPresentationData t = ScCore->primaryMainWindow()->doc->PDF_Options.PresentVals[i];
tmp = Py_BuildValue(const_cast<char*>("[iiiiii]"), t.pageEffectDuration, t.pageViewDuration, t.effectType, t.Dm, t.M, t.Di );
if (tmp)
PyList_SetItem(effval, i, tmp);
392,22 → 392,22
Py_DECREF(self->effval);
self->effval = effval;
// do not save linked text frames as PDF article
self->article = ScMW->doc->PDF_Options.Articles;
self->article = ScCore->primaryMainWindow()->doc->PDF_Options.Articles;
// do not encrypt file
self->encrypt = ScMW->doc->PDF_Options.Encrypt;
self->encrypt = ScCore->primaryMainWindow()->doc->PDF_Options.Encrypt;
// do not Use Custom Rendering Settings
self->uselpi = ScMW->doc->PDF_Options.UseLPI;
self->usespot = ScMW->doc->PDF_Options.UseSpotColors;
self->domulti = ScMW->doc->PDF_Options.doMultiFile;
self->uselpi = ScCore->primaryMainWindow()->doc->PDF_Options.UseLPI;
self->usespot = ScCore->primaryMainWindow()->doc->PDF_Options.UseSpotColors;
self->domulti = ScCore->primaryMainWindow()->doc->PDF_Options.doMultiFile;
// get default values for lpival
int n = ScMW->doc->PDF_Options.LPISettings.size();
int n = ScCore->primaryMainWindow()->doc->PDF_Options.LPISettings.size();
PyObject *lpival=PyList_New(n);
if (!lpival){
PyErr_SetString(PyExc_SystemError, "Can not initialize 'lpival' attribute");
return -1;
}
QMap<QString,LPIData>::Iterator it = ScMW->doc->PDF_Options.LPISettings.begin();
while (it != ScMW->doc->PDF_Options.LPISettings.end()) {
QMap<QString,LPIData>::Iterator it = ScCore->primaryMainWindow()->doc->PDF_Options.LPISettings.begin();
while (it != ScCore->primaryMainWindow()->doc->PDF_Options.LPISettings.end()) {
PyObject *tmp;
tmp = Py_BuildValue(const_cast<char*>("[siii]"), it.key().ascii(), it.data().Frequency, it.data().Angle, it.data().SpotFunc);
if (!tmp) {
422,7 → 422,7
self->lpival = lpival;
// set owner's password
PyObject *owner = NULL;
owner = PyString_FromString(ScMW->doc->PDF_Options.PassOwner.ascii());
owner = PyString_FromString(ScCore->primaryMainWindow()->doc->PDF_Options.PassOwner.ascii());
if (owner){
Py_DECREF(self->owner);
self->owner = owner;
432,7 → 432,7
}
// set user'a password
PyObject *user = NULL;
user = PyString_FromString(ScMW->doc->PDF_Options.PassUser.ascii());
user = PyString_FromString(ScCore->primaryMainWindow()->doc->PDF_Options.PassUser.ascii());
if (user){
Py_DECREF(self->user);
self->user = user;
441,26 → 441,26
return -1;
}
// allow printing document
self->aprint = ScMW->doc->PDF_Options.Permissions & 4;
self->aprint = ScCore->primaryMainWindow()->doc->PDF_Options.Permissions & 4;
// allow changing document
self->achange = ScMW->doc->PDF_Options.Permissions & 8;
self->achange = ScCore->primaryMainWindow()->doc->PDF_Options.Permissions & 8;
// allow copying document
self->acopy = ScMW->doc->PDF_Options.Permissions & 16;
self->acopy = ScCore->primaryMainWindow()->doc->PDF_Options.Permissions & 16;
// allow adding annotation and fields
self->aanot = ScMW->doc->PDF_Options.Permissions & 32;
self->aanot = ScCore->primaryMainWindow()->doc->PDF_Options.Permissions & 32;
// use 1.4 pdf version *aka. Acrobat 5)
self->version = ScMW->doc->PDF_Options.Version;
self->version = ScCore->primaryMainWindow()->doc->PDF_Options.Version;
// output destination is screen
self->outdst = ScMW->doc->PDF_Options.UseRGB ? 0 : 1;
self->outdst = ScCore->primaryMainWindow()->doc->PDF_Options.UseRGB ? 0 : 1;
 
self->profiles = ScMW->doc->PDF_Options.UseProfiles; // bool
self->profilei = ScMW->doc->PDF_Options.UseProfiles2; // bool
self->noembicc = ScMW->doc->PDF_Options.EmbeddedI; // bool
self->intents = ScMW->doc->PDF_Options.Intent; // int - 0 - 3
self->intenti = ScMW->doc->PDF_Options.Intent2; // int - 0 - 3
QString tp = ScMW->doc->PDF_Options.SolidProf;
self->profiles = ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles; // bool
self->profilei = ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles2; // bool
self->noembicc = ScCore->primaryMainWindow()->doc->PDF_Options.EmbeddedI; // bool
self->intents = ScCore->primaryMainWindow()->doc->PDF_Options.Intent; // int - 0 - 3
self->intenti = ScCore->primaryMainWindow()->doc->PDF_Options.Intent2; // int - 0 - 3
QString tp = ScCore->primaryMainWindow()->doc->PDF_Options.SolidProf;
if (!ScCore->InputProfiles.contains(tp))
tp = ScMW->view->Doc->CMSSettings.DefaultSolidColorRGBProfile;
tp = ScCore->primaryMainWindow()->view->Doc->CMSSettings.DefaultSolidColorRGBProfile;
PyObject *solidpr = NULL;
solidpr = PyString_FromString(tp.ascii());
if (solidpr){
470,9 → 470,9
PyErr_SetString(PyExc_SystemError, "Can not initialize 'solidpr' attribute");
return -1;
}
QString tp2 = ScMW->doc->PDF_Options.ImageProf;
QString tp2 = ScCore->primaryMainWindow()->doc->PDF_Options.ImageProf;
if (!ScCore->InputProfiles.contains(tp2))
tp2 = ScMW->view->Doc->CMSSettings.DefaultSolidColorRGBProfile;
tp2 = ScCore->primaryMainWindow()->view->Doc->CMSSettings.DefaultSolidColorRGBProfile;
PyObject *imagepr = NULL;
imagepr = PyString_FromString(tp2.ascii());
if (imagepr){
482,9 → 482,9
PyErr_SetString(PyExc_SystemError, "Can not initialize 'imagepr' attribute");
return -1;
}
QString tp3 = ScMW->doc->PDF_Options.PrintProf;
QString tp3 = ScCore->primaryMainWindow()->doc->PDF_Options.PrintProf;
if (!ScCore->PDFXProfiles.contains(tp3))
tp3 = ScMW->view->Doc->CMSSettings.DefaultPrinterProfile;
tp3 = ScCore->primaryMainWindow()->view->Doc->CMSSettings.DefaultPrinterProfile;
PyObject *printprofc = NULL;
printprofc = PyString_FromString(tp3.ascii());
if (printprofc){
494,7 → 494,7
PyErr_SetString(PyExc_SystemError, "Can not initialize 'printprofc' attribute");
return -1;
}
QString tinfo = ScMW->doc->PDF_Options.Info;
QString tinfo = ScCore->primaryMainWindow()->doc->PDF_Options.Info;
PyObject *info = NULL;
info = PyString_FromString(tinfo.ascii());
if (info){
504,10 → 504,10
PyErr_SetString(PyExc_SystemError, "Can not initialize 'info' attribute");
return -1;
}
self->bleedt = ScMW->doc->PDF_Options.BleedTop*ScMW->doc->unitRatio(); // double -
self->bleedl = ScMW->doc->PDF_Options.BleedLeft*ScMW->doc->unitRatio(); // double -
self->bleedr = ScMW->doc->PDF_Options.BleedRight*ScMW->doc->unitRatio(); // double -
self->bleedb = ScMW->doc->PDF_Options.BleedBottom*ScMW->doc->unitRatio(); // double -
self->bleedt = ScCore->primaryMainWindow()->doc->PDF_Options.BleedTop*ScCore->primaryMainWindow()->doc->unitRatio(); // double -
self->bleedl = ScCore->primaryMainWindow()->doc->PDF_Options.BleedLeft*ScCore->primaryMainWindow()->doc->unitRatio(); // double -
self->bleedr = ScCore->primaryMainWindow()->doc->PDF_Options.BleedRight*ScCore->primaryMainWindow()->doc->unitRatio(); // double -
self->bleedb = ScCore->primaryMainWindow()->doc->PDF_Options.BleedBottom*ScCore->primaryMainWindow()->doc->unitRatio(); // double -
 
return 0;
}
627,7 → 627,7
PyErr_SetString(PyExc_TypeError, "'pages' list must contain only integers.");
return -1;
}
if (PyInt_AsLong(tmp) > static_cast<int>(ScMW->doc->Pages->count()) || PyInt_AsLong(tmp) < 1) {
if (PyInt_AsLong(tmp) > static_cast<int>(ScCore->primaryMainWindow()->doc->Pages->count()) || PyInt_AsLong(tmp) < 1) {
PyErr_SetString(PyExc_ValueError, "'pages' value out of range.");
return -1;
}
952,7 → 952,7
 
static PyObject *PDFfile_save(PDFfile *self)
{
if (!ScMW->HaveDoc) {
if (!ScCore->primaryMainWindow()->HaveDoc) {
PyErr_SetString(PyExc_SystemError, "Need to open document first");
return NULL;
};
961,21 → 961,21
//void ScribusMainWindow::SaveAsPDF()
int Components = 3;
QString nam = "";
if (ScMW->bookmarkPalette->BView->childCount() == 0)
ScMW->doc->PDF_Options.Bookmarks = false;
if (ScCore->primaryMainWindow()->bookmarkPalette->BView->childCount() == 0)
ScCore->primaryMainWindow()->doc->PDF_Options.Bookmarks = false;
 
// apply fonts attribute
ScMW->doc->PDF_Options.EmbedList.clear();
ScCore->primaryMainWindow()->doc->PDF_Options.EmbedList.clear();
int n = PyList_Size(self->fonts);
for ( int i=0; i<n; ++i){
QString tmpFon;
tmpFon = QString(PyString_AsString(PyList_GetItem(self->fonts, i)));
ScMW->doc->PDF_Options.EmbedList.append(tmpFon);
ScCore->primaryMainWindow()->doc->PDF_Options.EmbedList.append(tmpFon);
}
// apply file attribute
QString fn;
fn = QString(PyString_AsString(self->file));
ScMW->doc->PDF_Options.Datei = fn;
ScCore->primaryMainWindow()->doc->PDF_Options.Datei = fn;
// apply pages attribute
std::vector<int> pageNs;
int nn=PyList_Size(self->pages);
983,28 → 983,28
pageNs.push_back((int)PyInt_AsLong(PyList_GetItem(self->pages, i)));
}
// apply thumbnails attribute
ScMW->doc->PDF_Options.Thumbnails = self->thumbnails;
ScCore->primaryMainWindow()->doc->PDF_Options.Thumbnails = self->thumbnails;
// apply compress attribute
self->compressmtd = minmaxi(self->compressmtd, 0, 3);
ScMW->doc->PDF_Options.Compress = self->compress;
ScMW->doc->PDF_Options.CompressMethod = self->compressmtd;
ScCore->primaryMainWindow()->doc->PDF_Options.Compress = self->compress;
ScCore->primaryMainWindow()->doc->PDF_Options.CompressMethod = self->compressmtd;
// apply quality attribute
self->quality = minmaxi(self->quality, 0, 4);
ScMW->doc->PDF_Options.Quality = self->quality;
ScCore->primaryMainWindow()->doc->PDF_Options.Quality = self->quality;
// apply resolusion attribute
ScMW->doc->PDF_Options.Resolution = PyInt_AsLong(self->resolution);
ScCore->primaryMainWindow()->doc->PDF_Options.Resolution = PyInt_AsLong(self->resolution);
// apply downsample attribute
ScMW->doc->PDF_Options.RecalcPic = PyInt_AsLong(self->downsample);
if (ScMW->doc->PDF_Options.RecalcPic)
ScMW->doc->PDF_Options.PicRes = PyInt_AsLong(self->downsample);
ScCore->primaryMainWindow()->doc->PDF_Options.RecalcPic = PyInt_AsLong(self->downsample);
if (ScCore->primaryMainWindow()->doc->PDF_Options.RecalcPic)
ScCore->primaryMainWindow()->doc->PDF_Options.PicRes = PyInt_AsLong(self->downsample);
else
ScMW->doc->PDF_Options.PicRes = ScMW->doc->PDF_Options.Resolution;
ScCore->primaryMainWindow()->doc->PDF_Options.PicRes = ScCore->primaryMainWindow()->doc->PDF_Options.Resolution;
// apply bookmarks attribute
ScMW->doc->PDF_Options.Bookmarks = self->bookmarks;
ScCore->primaryMainWindow()->doc->PDF_Options.Bookmarks = self->bookmarks;
// apply binding attribute
ScMW->doc->PDF_Options.Binding = self->binding;
ScCore->primaryMainWindow()->doc->PDF_Options.Binding = self->binding;
// apply presentation attribute
ScMW->doc->PDF_Options.PresentMode = self->presentation;
ScCore->primaryMainWindow()->doc->PDF_Options.PresentMode = self->presentation;
 
QValueList<PDFPresentationData> PresentVals;
PresentVals.clear();
1037,7 → 1037,7
 
}
 
ScMW->doc->PDF_Options.PresentVals = PresentVals;
ScCore->primaryMainWindow()->doc->PDF_Options.PresentVals = PresentVals;
// apply lpival
int n2 = PyList_Size(self->lpival);
for (int i=0; i<n2; ++i){
1050,27 → 1050,27
// PyErr_SetString(PyExc_SystemError, "while parsing 'lpival'. WHY THIS HAPPENED????");
// return NULL;
// }
// ScMW->doc->PDF_Options.LPISettings[QString(s)]=lpi;
// ScCore->primaryMainWindow()->doc->PDF_Options.LPISettings[QString(s)]=lpi;
QString st;
st = QString(PyString_AsString(PyList_GetItem(t,0)));
lpi.Frequency = PyInt_AsLong(PyList_GetItem(t, 1));
lpi.Angle = PyInt_AsLong(PyList_GetItem(t, 2));
lpi.SpotFunc = PyInt_AsLong(PyList_GetItem(t, 3));
ScMW->doc->PDF_Options.LPISettings[st]=lpi;
ScCore->primaryMainWindow()->doc->PDF_Options.LPISettings[st]=lpi;
}
 
ScMW->doc->PDF_Options.Articles = self->article;
ScMW->doc->PDF_Options.Encrypt = self->encrypt;
ScMW->doc->PDF_Options.UseLPI = self->uselpi;
ScMW->doc->PDF_Options.UseSpotColors = self->usespot;
ScMW->doc->PDF_Options.doMultiFile = self->domulti;
ScCore->primaryMainWindow()->doc->PDF_Options.Articles = self->article;
ScCore->primaryMainWindow()->doc->PDF_Options.Encrypt = self->encrypt;
ScCore->primaryMainWindow()->doc->PDF_Options.UseLPI = self->uselpi;
ScCore->primaryMainWindow()->doc->PDF_Options.UseSpotColors = self->usespot;
ScCore->primaryMainWindow()->doc->PDF_Options.doMultiFile = self->domulti;
self->version = minmaxi(self->version, 12, 14);
// FIXME: Sanity check version
ScMW->doc->PDF_Options.Version = (PDFOptions::PDFVersion)self->version;
ScCore->primaryMainWindow()->doc->PDF_Options.Version = (PDFOptions::PDFVersion)self->version;
if (self->encrypt)
{
int Perm = -64;
if (ScMW->doc->PDF_Options.Version == PDFOptions::PDFVersion_14)
if (ScCore->primaryMainWindow()->doc->PDF_Options.Version == PDFOptions::PDFVersion_14)
Perm &= ~0x00240000;
if (self->aprint)
Perm += 4;
1080,38 → 1080,38
Perm += 16;
if (self->aanot)
Perm += 32;
ScMW->doc->PDF_Options.Permissions = Perm;
ScMW->doc->PDF_Options.PassOwner = QString(PyString_AsString(self->owner));
ScMW->doc->PDF_Options.PassUser = QString(PyString_AsString(self->user));
ScCore->primaryMainWindow()->doc->PDF_Options.Permissions = Perm;
ScCore->primaryMainWindow()->doc->PDF_Options.PassOwner = QString(PyString_AsString(self->owner));
ScCore->primaryMainWindow()->doc->PDF_Options.PassUser = QString(PyString_AsString(self->user));
}
if (self->outdst == 0)
{
ScMW->doc->PDF_Options.UseRGB = true;
ScMW->doc->PDF_Options.UseProfiles = false;
ScMW->doc->PDF_Options.UseProfiles2 = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseRGB = true;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles2 = false;
}
else
{
ScMW->doc->PDF_Options.UseRGB = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseRGB = false;
#ifdef HAVE_CMS
if (CMSuse)
{
ScMW->doc->PDF_Options.UseProfiles = self->profiles;
ScMW->doc->PDF_Options.UseProfiles2 = self->profilei;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles = self->profiles;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles2 = self->profilei;
self->intents = minmaxi(self->intents, 0, 3);
ScMW->doc->PDF_Options.Intent = self->intents;
ScCore->primaryMainWindow()->doc->PDF_Options.Intent = self->intents;
self->intenti = minmaxi(self->intenti, 0, 3);
ScMW->doc->PDF_Options.Intent2 = self->intenti;
ScMW->doc->PDF_Options.EmbeddedI = self->noembicc;
ScMW->doc->PDF_Options.SolidProf = PyString_AsString(self->solidpr);
ScMW->doc->PDF_Options.ImageProf = PyString_AsString(self->imagepr);
ScMW->doc->PDF_Options.PrintProf = PyString_AsString(self->printprofc);
if (ScMW->doc->PDF_Options.Version == PDFOptions::PDFVersion_X3)
ScCore->primaryMainWindow()->doc->PDF_Options.Intent2 = self->intenti;
ScCore->primaryMainWindow()->doc->PDF_Options.EmbeddedI = self->noembicc;
ScCore->primaryMainWindow()->doc->PDF_Options.SolidProf = PyString_AsString(self->solidpr);
ScCore->primaryMainWindow()->doc->PDF_Options.ImageProf = PyString_AsString(self->imagepr);
ScCore->primaryMainWindow()->doc->PDF_Options.PrintProf = PyString_AsString(self->printprofc);
if (ScCore->primaryMainWindow()->doc->PDF_Options.Version == PDFOptions::PDFVersion_X3)
{
// Where does compiler find cms function when I have not included header for it
const char *Descriptor;
cmsHPROFILE hIn;
hIn = cmsOpenProfileFromFile(ScCore->PrinterProfiles[ScMW->doc->PDF_Options.PrintProf], "r");
hIn = cmsOpenProfileFromFile(ScCore->PrinterProfiles[ScCore->primaryMainWindow()->doc->PDF_Options.PrintProf], "r");
Descriptor = cmsTakeProductDesc(hIn);
nam = QString(Descriptor);
if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData)
1121,27 → 1121,27
if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmyData)
Components = 3;
cmsCloseProfile(hIn);
ScMW->doc->PDF_Options.Info = PyString_AsString(self->info);
self->bleedt = minmaxd(self->bleedt, 0, ScMW->view->Doc->pageHeight*ScMW->view->Doc->unitRatio());
ScMW->doc->PDF_Options.BleedTop = self->bleedt/ScMW->view->Doc->unitRatio();
self->bleedl = minmaxd(self->bleedl, 0, ScMW->view->Doc->pageWidth*ScMW->view->Doc->unitRatio());
ScMW->doc->PDF_Options.BleedLeft = self->bleedl/ScMW->view->Doc->unitRatio();
self->bleedr = minmaxd(self->bleedr, 0, ScMW->view->Doc->pageWidth*ScMW->view->Doc->unitRatio());
ScMW->doc->PDF_Options.BleedRight = self->bleedr/ScMW->view->Doc->unitRatio();
self->bleedb = minmaxd(self->bleedb, 0, ScMW->view->Doc->pageHeight*ScMW->view->Doc->unitRatio());
ScMW->doc->PDF_Options.BleedBottom = self->bleedb/ScMW->view->Doc->unitRatio();
ScMW->doc->PDF_Options.Encrypt = false;
ScMW->doc->PDF_Options.PresentMode = false;
ScCore->primaryMainWindow()->doc->PDF_Options.Info = PyString_AsString(self->info);
self->bleedt = minmaxd(self->bleedt, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight*ScCore->primaryMainWindow()->view->Doc->unitRatio());
ScCore->primaryMainWindow()->doc->PDF_Options.BleedTop = self->bleedt/ScCore->primaryMainWindow()->view->Doc->unitRatio();
self->bleedl = minmaxd(self->bleedl, 0, ScCore->primaryMainWindow()->view->Doc->pageWidth*ScCore->primaryMainWindow()->view->Doc->unitRatio());
ScCore->primaryMainWindow()->doc->PDF_Options.BleedLeft = self->bleedl/ScCore->primaryMainWindow()->view->Doc->unitRatio();
self->bleedr = minmaxd(self->bleedr, 0, ScCore->primaryMainWindow()->view->Doc->pageWidth*ScCore->primaryMainWindow()->view->Doc->unitRatio());
ScCore->primaryMainWindow()->doc->PDF_Options.BleedRight = self->bleedr/ScCore->primaryMainWindow()->view->Doc->unitRatio();
self->bleedb = minmaxd(self->bleedb, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight*ScCore->primaryMainWindow()->view->Doc->unitRatio());
ScCore->primaryMainWindow()->doc->PDF_Options.BleedBottom = self->bleedb/ScCore->primaryMainWindow()->view->Doc->unitRatio();
ScCore->primaryMainWindow()->doc->PDF_Options.Encrypt = false;
ScCore->primaryMainWindow()->doc->PDF_Options.PresentMode = false;
}
}
else
{
ScMW->doc->PDF_Options.UseProfiles = false;
ScMW->doc->PDF_Options.UseProfiles2 = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles2 = false;
}
#else
ScMW->doc->PDF_Options.UseProfiles = false;
ScMW->doc->PDF_Options.UseProfiles2 = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles2 = false;
#endif
 
}
1149,12 → 1149,12
for (uint ap = 0; ap < pageNs.size(); ++ap)
{
QPixmap pm(10,10);
if (ScMW->doc->PDF_Options.Thumbnails)
pm = ScMW->view->PageToPixmap(pageNs[ap]-1, 100);
if (ScCore->primaryMainWindow()->doc->PDF_Options.Thumbnails)
pm = ScCore->primaryMainWindow()->view->PageToPixmap(pageNs[ap]-1, 100);
thumbs.insert(pageNs[ap], pm);
}
ReOrderText(ScMW->doc, ScMW->view);
if (!ScMW->getPDFDriver(fn, nam, Components, pageNs, thumbs)) {
ReOrderText(ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow()->view);
if (!ScCore->primaryMainWindow()->getPDFDriver(fn, nam, Components, pageNs, thumbs)) {
fn = "Cannot write the File: " + fn;
PyErr_SetString(PyExc_SystemError, fn.ascii());
return NULL;
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
143,6 → 143,7
 
void ScripterCore::FinishScriptRun()
{
ScribusMainWindow* ScMW=ScCore->primaryMainWindow();
if (ScMW->HaveDoc)
{
ScMW->propertiesPalette->setDoc(ScMW->doc);
150,7 → 151,7
ScMW->propertiesPalette->Spal->setFormats(ScMW->doc);
ScMW->propertiesPalette->SetLineFormats(ScMW->doc);
ScMW->propertiesPalette->updateColorList();
ScMW->layerPalette->setLayers(&ScMW->doc->Layers, ScMW->doc->activeLayer());
ScMW->layerPalette->setDoc(ScMW->doc);
ScMW->outlinePalette->setDoc(ScMW->doc);
ScMW->outlinePalette->BuildTree();
ScMW->pagePalette->setView(ScMW->view);
215,7 → 216,7
{
QString fileName;
QString curDirPath = QDir::currentDirPath();
RunScriptDialog dia( ScMW, m_enableExtPython );
RunScriptDialog dia( ScCore->primaryMainWindow(), m_enableExtPython );
if (dia.exec())
{
fileName = dia.selectedFile();
268,7 → 269,7
// Set up a sub-interpreter if needed:
if (!inMainInterpreter)
{
ScMW->ScriptRunning = true;
ScCore->primaryMainWindow()->ScriptRunning = true;
qApp->setOverrideCursor(QCursor(waitCursor), false);
// Create the sub-interpreter
// FIXME: This calls abort() in a Python debug build. We're doing something wrong.
277,7 → 278,7
// Chdir to the dir the script is in
QDir::setCurrent(fi.dirPath(true));
// Init the scripter module in the sub-interpreter
initscribus(ScMW);
initscribus(ScCore->primaryMainWindow());
}
// Make sure sys.argv[0] is the path to the script
char* comm[2];
353,7 → 354,7
QClipboard *cp = QApplication::clipboard();
cp->setText(errorMsg);
ScCore->closeSplash();
QMessageBox::warning(ScMW,
QMessageBox::warning(ScCore->primaryMainWindow(),
tr("Script error"),
tr("If you are running an official script report it at <a href=\"http://bugs.scribus.net\">bugs.scribus.net</a> please.")
+ "<pre>" +errorMsg + "</pre>"
369,18 → 370,18
PyEval_RestoreThread(stateo);
qApp->restoreOverrideCursor();
}
ScMW->ScriptRunning = false;
ScCore->primaryMainWindow()->ScriptRunning = false;
}
 
void ScripterCore::slotRunScript(const QString Script)
{
ScMW->ScriptRunning = true;
ScCore->primaryMainWindow()->ScriptRunning = true;
inValue = Script;
QString cm;
cm = "# -*- coding: utf8 -*- \n";
if (PyThreadState_Get() != NULL)
{
initscribus(ScMW);
initscribus(ScCore->primaryMainWindow());
/* HACK: following loop handles all input line by line.
It *should* use I.C. because of docstrings etc. I.I. cannot
handle docstrings right.
421,13 → 422,13
if (result == NULL)
{
PyErr_Print();
QMessageBox::warning(ScMW, tr("Script error"),
QMessageBox::warning(ScCore->primaryMainWindow(), tr("Script error"),
"<qt>" + tr("There was an internal error while trying the "
"command you entered. Details were printed to "
"stderr. ") + "</qt>");
}
}
ScMW->ScriptRunning = false;
ScCore->primaryMainWindow()->ScriptRunning = false;
}
 
void ScripterCore::slotInteractiveScript(bool visible)
497,7 → 498,7
 
void ScripterCore::aboutScript()
{
QString fname = ScMW->CFileDialog(".", tr("Examine Script"), tr("Python Scripts (*.py);;All Files (*)"), "", 0, 0, 0, 0);
QString fname = ScCore->primaryMainWindow()->CFileDialog(".", tr("Examine Script"), tr("Python Scripts (*.py);;All Files (*)"), "", 0, 0, 0, 0);
if (fname == QString::null)
return;
QString html("<html><body>");
574,7 → 575,7
if (PyRun_SimpleString(cmd.data()))
{
PyErr_Print();
QMessageBox::warning(ScMW, tr("Script error"),
QMessageBox::warning(ScCore->primaryMainWindow(), tr("Script error"),
tr("Setting up the Python plugin failed. "
"Error details were printed to stderr. "));
return false;
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/objprinter.cpp
14,6 → 14,7
#include <vector>
#include "pslib.h"
#include "gsutil.h"
#include "scribuscore.h"
#include "util.h"
 
#ifdef HAVE_CUPS
61,7 → 62,7
static PyObject * Printer_new(PyTypeObject *type, PyObject */*args*/, PyObject */*kwds*/)
{
// do not create new object if there is no opened document
if (!ScMW->HaveDoc) {
if (!ScCore->primaryMainWindow()->HaveDoc) {
PyErr_SetString(PyExc_SystemError, "Need to open document first");
return NULL;
}
182,9 → 183,9
self->printer = printer;
}
// set defaul name of file to print into
QString tf = ScMW->doc->PDF_Options.Datei;
QString tf = ScCore->primaryMainWindow()->doc->PDF_Options.Datei;
if (tf.isEmpty()) {
QFileInfo fi = QFileInfo(ScMW->doc->DocName);
QFileInfo fi = QFileInfo(ScCore->primaryMainWindow()->doc->DocName);
tf = fi.dirPath()+"/"+fi.baseName()+".pdf";
}
PyObject *file = NULL;
207,10 → 208,10
// set to print all pages
PyObject *pages = NULL;
int num = 0;
if (ScMW->HaveDoc)
if (ScCore->primaryMainWindow()->HaveDoc)
// which one should I use ???
// new = ScMW->view->Pages.count()
num = ScMW->doc->Pages->count();
// new = ScCore->primaryMainWindow()->view->Pages.count()
num = ScCore->primaryMainWindow()->doc->Pages->count();
pages = PyList_New(num);
if (pages){
Py_DECREF(self->pages);
369,7 → 370,7
PyErr_SetString(PyExc_TypeError, "'pages' attribute must be list containing only integers.");
return -1;
}
if (PyInt_AsLong(tmp) > static_cast<int>(ScMW->doc->Pages->count()) || PyInt_AsLong(tmp) < 1) {
if (PyInt_AsLong(tmp) > static_cast<int>(ScCore->primaryMainWindow()->doc->Pages->count()) || PyInt_AsLong(tmp) < 1) {
PyErr_SetString(PyExc_ValueError, "'pages' value out of range.");
return -1;
}
416,7 → 417,7
// Here we actually print
static PyObject *Printer_print(Printer *self)
{
if (!ScMW->HaveDoc) {
if (!ScCore->primaryMainWindow()->HaveDoc) {
PyErr_SetString(PyExc_SystemError, "Need to open documetnt first");
return NULL;
}
427,7 → 428,7
bool fil, sep, color, PSfile, mirrorH, mirrorV, useICC, DoGCR;
PSfile = false;
 
// ReOrderText(ScMW->doc, ScMW->view);
// ReOrderText(ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow()->view);
prn = QString(PyString_AsString(self->printer));
fna = QString(PyString_AsString(self->file));
fil = (QString(PyString_AsString(self->printer)) == QString("File")) ? true : false;
454,25 → 455,25
printcomm = QString(PyString_AsString(self->cmd));
QMap<QString, QMap<uint, FPointArray> > ReallyUsed;
ReallyUsed.clear();
ScMW->doc->getUsedFonts(ReallyUsed);
ScCore->primaryMainWindow()->doc->getUsedFonts(ReallyUsed);
PrefsManager *prefsManager=PrefsManager::instance();
PSLib *dd = new PSLib(true, prefsManager->appPrefs.AvailFonts, ReallyUsed, ScMW->doc->PageColors, false, true);
PSLib *dd = new PSLib(true, prefsManager->appPrefs.AvailFonts, ReallyUsed, ScCore->primaryMainWindow()->doc->PageColors, false, true);
if (dd != NULL)
{
if (!fil)
fna = ScMW->PrefsPfad+"/tmp.ps";
fna = ScCore->primaryMainWindow()->PrefsPfad+"/tmp.ps";
PSfile = dd->PS_set_file(fna);
fna = QDir::convertSeparators(fna);
if (PSfile)
{
QStringList spots;
dd->CreatePS(ScMW->doc, /*ScMW->view, */pageNs, sep, SepName, spots, color, mirrorH, mirrorV, useICC, DoGCR, false, false);
dd->CreatePS(ScCore->primaryMainWindow()->doc, /*ScCore->primaryMainWindow()->view, */pageNs, sep, SepName, spots, color, mirrorH, mirrorV, useICC, DoGCR, false, false);
if (PSLevel != 3)
{
QString tmp;
QStringList opts;
opts.append( QString("-dDEVICEWIDTHPOINTS=%1").arg(tmp.setNum(ScMW->doc->pageWidth)) );
opts.append( QString("-dDEVICEHEIGHTPOINTS=%1").arg(tmp.setNum(ScMW->doc->pageHeight)) );
opts.append( QString("-dDEVICEWIDTHPOINTS=%1").arg(tmp.setNum(ScCore->primaryMainWindow()->doc->pageWidth)) );
opts.append( QString("-dDEVICEHEIGHTPOINTS=%1").arg(tmp.setNum(ScCore->primaryMainWindow()->doc->pageHeight)) );
convertPS2PS(fna, fna+".tmp", opts, PSLevel);
moveFile( fna + ".tmp", fna );
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
21,7 → 21,7
return NULL;
if(!checkHaveDocument())
return NULL;
ScMW->doc->DoDrawing = static_cast<bool>(e);
ScCore->primaryMainWindow()->doc->DoDrawing = static_cast<bool>(e);
Py_INCREF(Py_None);
return Py_None;
}
146,9 → 146,9
if(!checkHaveDocument())
return NULL;
PyObject *l;
l = PyList_New(ScMW->doc->Layers.count());
for (uint lam=0; lam < ScMW->doc->Layers.count(); lam++)
PyList_SetItem(l, lam, PyString_FromString(ScMW->doc->Layers[lam].Name.utf8()));
l = PyList_New(ScCore->primaryMainWindow()->doc->Layers.count());
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
PyList_SetItem(l, lam, PyString_FromString(ScCore->primaryMainWindow()->doc->Layers[lam].Name.utf8()));
return l;
}
 
164,9 → 164,9
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
return NULL;
}
bool found = ScMW->doc->setActiveLayer(QString::fromUtf8(Name));
bool found = ScCore->primaryMainWindow()->doc->setActiveLayer(QString::fromUtf8(Name));
if (found)
ScMW->changeLayer(ScMW->doc->activeLayer());
ScCore->primaryMainWindow()->changeLayer(ScCore->primaryMainWindow()->doc->activeLayer());
else
{
PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
180,7 → 180,7
{
if(!checkHaveDocument())
return NULL;
return PyString_FromString(ScMW->doc->activeLayerName().utf8());
return PyString_FromString(ScCore->primaryMainWindow()->doc->activeLayerName().utf8());
}
 
PyObject *scribus_senttolayer(PyObject* /* self */, PyObject* args)
199,13 → 199,13
PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
if (i == NULL)
return NULL;
ScMW->view->SelectItemNr(i->ItemNr);
ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
bool found = false;
for (uint lam=0; lam < ScMW->doc->Layers.count(); ++lam)
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
{
ScMW->view->SelectItemNr(i->ItemNr);
for (uint lam=0; lam < ScMW->doc->Layers.count(); ++lam)
if (ScMW->doc->Layers[lam].Name == QString::fromUtf8(Layer))
ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Layer))
{
i->LayerNr = static_cast<int>(lam);
found = true;
236,11 → 236,11
return NULL;
}
bool found = false;
for (uint lam=0; lam < ScMW->doc->Layers.count(); ++lam)
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
{
if (ScMW->doc->Layers[lam].Name == QString::fromUtf8(Name))
if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
{
ScMW->doc->Layers[lam].isViewable = vis;
ScCore->primaryMainWindow()->doc->Layers[lam].isViewable = vis;
found = true;
break;
}
268,11 → 268,11
return NULL;
}
bool found = false;
for (uint lam=0; lam < ScMW->doc->Layers.count(); ++lam)
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
{
if (ScMW->doc->Layers[lam].Name == QString::fromUtf8(Name))
if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
{
ScMW->doc->Layers[lam].isPrintable = vis;
ScCore->primaryMainWindow()->doc->Layers[lam].isPrintable = vis;
found = true;
break;
}
300,11 → 300,11
}
int i = 0;
bool found = false;
for (uint lam=0; lam < ScMW->doc->Layers.count(); lam++)
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
{
if (ScMW->doc->Layers[lam].Name == QString::fromUtf8(Name))
if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
{
i = static_cast<int>(ScMW->doc->Layers[lam].isViewable);
i = static_cast<int>(ScCore->primaryMainWindow()->doc->Layers[lam].isViewable);
found = true;
break;
}
331,11 → 331,11
}
int i = 0;
bool found = false;
for (uint lam=0; lam < ScMW->doc->Layers.count(); ++lam)
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
{
if (ScMW->doc->Layers[lam].Name == QString::fromUtf8(Name))
if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
{
i = static_cast<int>(ScMW->doc->Layers[lam].isPrintable);
i = static_cast<int>(ScCore->primaryMainWindow()->doc->Layers[lam].isPrintable);
found = true;
break;
}
361,17 → 361,17
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
return NULL;
}
if (ScMW->doc->Layers.count() == 1)
if (ScCore->primaryMainWindow()->doc->Layers.count() == 1)
{
PyErr_SetString(ScribusException, QObject::tr("Cannot remove the last layer.","python error"));
return NULL;
}
bool found = false;
for (uint lam=0; lam < ScMW->doc->Layers.count(); ++lam)
for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
{
if (ScMW->doc->Layers[lam].Name == QString::fromUtf8(Name))
if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
{
QValueList<Layer>::iterator it2 = ScMW->doc->Layers.at(lam);
QValueList<Layer>::iterator it2 = ScCore->primaryMainWindow()->doc->Layers.at(lam);
int num2 = (*it2).LNr;
if (!num2)
{
380,17 → 380,17
return Py_None;
}
int num = (*it2).Level;
ScMW->doc->Layers.remove(it2);
ScCore->primaryMainWindow()->doc->Layers.remove(it2);
QValueList<Layer>::iterator it;
for (uint l = 0; l < ScMW->doc->Layers.count(); l++)
for (uint l = 0; l < ScCore->primaryMainWindow()->doc->Layers.count(); l++)
{
it = ScMW->doc->Layers.at(l);
it = ScCore->primaryMainWindow()->doc->Layers.at(l);
if ((*it).Level > num)
(*it).Level -= 1;
}
ScMW->doc->removeLayer(num2);
ScMW->doc->setActiveLayer(0);
ScMW->changeLayer(0);
ScCore->primaryMainWindow()->doc->removeLayer(num2);
ScCore->primaryMainWindow()->doc->setActiveLayer(0);
ScCore->primaryMainWindow()->changeLayer(0);
found = true;
break;
}
416,8 → 416,8
PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot create layer without a name.","python error"));
return NULL;
}
ScMW->doc->addLayer(QString::fromUtf8(Name), true);
ScMW->changeLayer(ScMW->doc->activeLayer());
ScCore->primaryMainWindow()->doc->addLayer(QString::fromUtf8(Name), true);
ScCore->primaryMainWindow()->changeLayer(ScCore->primaryMainWindow()->doc->activeLayer());
Py_INCREF(Py_None);
return Py_None;
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmddialog.cpp
6,6 → 6,7
*/
#include "cmddialog.h"
#include "cmdutil.h"
#include "scribuscore.h"
#include "valuedialog.h"
#include "editformats.h"
 
15,7 → 16,7
PyObject *scribus_newdocdia(PyObject* /* self */)
{
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
bool ret = ScMW->slotFileNew();
bool ret = ScCore->primaryMainWindow()->slotFileNew();
QApplication::restoreOverrideCursor();
return PyInt_FromLong(static_cast<long>(ret));
}
46,7 → 47,7
Due the 'isdir' parameter. CFileDialog needs the last 2 pointers
initialized. */
bool nobool = false;
QString fName = ScMW->CFileDialog(".",
QString fName = ScCore->primaryMainWindow()->CFileDialog(".",
QString::fromUtf8(caption),
QString::fromUtf8(filter),
QString::fromUtf8(defName),
78,7 → 79,7
if (!PyArg_ParseTupleAndKeywords(args, kw, "eses|iiii", kwargs, "utf-8", &caption, "utf-8", &message, &ico, &butt1, &butt2, &butt3))
return NULL;
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
QMessageBox mb(QString::fromUtf8(caption), QString::fromUtf8(message), ico, butt1, butt2, butt3, ScMW);
QMessageBox mb(QString::fromUtf8(caption), QString::fromUtf8(message), ico, butt1, butt2, butt3, ScCore->primaryMainWindow());
result = mb.exec();
QApplication::restoreOverrideCursor();
return PyInt_FromLong(static_cast<long>(result));
92,7 → 93,7
if (!PyArg_ParseTuple(args, "eses|es", "utf-8", &caption, "utf-8", &message, "utf-8", &value))
return NULL;
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
ValueDialog *d = new ValueDialog(ScMW, "d", true, 0);
ValueDialog *d = new ValueDialog(ScCore->primaryMainWindow(), "d", true, 0);
d->dialogLabel->setText(QString::fromUtf8(message));
d->valueEdit->setText(QString::fromUtf8(value));
d->setCaption(QString::fromUtf8(caption));
108,17 → 109,17
series.
It simulates user mouse clicking in the style dialogs. Ugly.
Unpleasant. Etc. But working. */
uint styleCount = ScMW->doc->docParagraphStyles.count();
StilFormate *dia2 = new StilFormate(ScMW, ScMW->doc);
uint styleCount = ScCore->primaryMainWindow()->doc->docParagraphStyles.count();
StilFormate *dia2 = new StilFormate(ScCore->primaryMainWindow(), ScCore->primaryMainWindow()->doc);
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
dia2->neuesFormat();
QApplication::restoreOverrideCursor();
ScMW->saveStyles(dia2);
ScCore->primaryMainWindow()->saveStyles(dia2);
delete dia2;
if (styleCount == ScMW->doc->docParagraphStyles.count())
if (styleCount == ScCore->primaryMainWindow()->doc->docParagraphStyles.count())
{
Py_INCREF(Py_None);
return Py_None;
}
return PyString_FromString(ScMW->doc->docParagraphStyles[ScMW->doc->docParagraphStyles.count() - 1].name().utf8());
return PyString_FromString(ScCore->primaryMainWindow()->doc->docParagraphStyles[ScCore->primaryMainWindow()->doc->docParagraphStyles.count() - 1].name().utf8());
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
44,7 → 44,7
#include "guiapp.h"
#include "svgimport.h"
#include "scriptercore.h"
 
#include "scribuscore.h"
#include "customfdialog.h"
#include "helpbrowser.h"
#include "mpalette.h"
169,9 → 169,9
PyErr_Clear();
}
 
scripterCore = new ScripterCore(ScMW);
scripterCore = new ScripterCore(ScCore->primaryMainWindow());
Q_CHECK_PTR(scripterCore);
initscribus(ScMW);
initscribus(ScCore->primaryMainWindow());
#ifdef HAVE_SCRIPTER2
scripter2_init();
#endif
207,7 → 207,7
QString pfad = ScPaths::instance().docDir();
QString pfad2;
pfad2 = QDir::convertSeparators(pfad + "en/Scripter/index.html");
HelpBrowser *dia = new HelpBrowser(0, QObject::tr("Online Reference"), ScMW->getGuiLanguage(), "scripter");
HelpBrowser *dia = new HelpBrowser(0, QObject::tr("Online Reference"), ScCore->primaryMainWindow()->getGuiLanguage(), "scripter");
dia->show();
}
*/
641,7 → 641,7
else
qDebug("Couldn't parse version string '%s' in scripter", VERSION);
 
ScMW = pl;
// ScMW = pl;
// Function aliases for compatibility
// We need to import the __builtins__, warnings and exceptions modules to be able to run
// the generated Python functions from inside the `scribus' module's context.
735,7 → 735,7
Py_DECREF(wrappedQApp);
wrappedQApp = NULL;
 
wrappedMainWindow = wrapQObject(ScMW);
wrappedMainWindow = wrapQObject(pl);
if (!wrappedMainWindow)
{
qDebug("Failed to wrap up ScMW");
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/guiapp.cpp
6,7 → 6,7
*/
#include "guiapp.h"
#include "cmdutil.h"
 
#include "scribuscore.h"
#include <qstring.h>
#include <qcursor.h>
 
15,7 → 15,7
char *aText;
if (!PyArg_ParseTuple(args, "es", "utf-8", &aText))
return NULL;
ScMW->mainWindowStatusLabel->setText(QString::fromUtf8(aText));
ScCore->primaryMainWindow()->setStatusBarInfoText(QString::fromUtf8(aText));
Py_INCREF(Py_None);
return Py_None;
}
22,7 → 22,7
 
PyObject *scribus_progressreset(PyObject* /* self */)
{
ScMW->mainWindowProgressBar->reset();
ScCore->primaryMainWindow()->mainWindowProgressBar->reset();
qApp->processEvents();
Py_INCREF(Py_None);
return Py_None;
33,8 → 33,8
int steps;
if (!PyArg_ParseTuple(args, "i", &steps))
return NULL;
ScMW->mainWindowProgressBar->setTotalSteps(steps);
ScMW->mainWindowProgressBar->setProgress(0);
ScCore->primaryMainWindow()->mainWindowProgressBar->setTotalSteps(steps);
ScCore->primaryMainWindow()->mainWindowProgressBar->setProgress(0);
qApp->processEvents();
Py_INCREF(Py_None);
return Py_None;
45,12 → 45,12
int position;
if (!PyArg_ParseTuple(args, "i", &position))
return NULL;
if (position > ScMW->mainWindowProgressBar->totalSteps())
if (position > ScCore->primaryMainWindow()->mainWindowProgressBar->totalSteps())
{
PyErr_SetString(PyExc_ValueError, QString("Tried to set progress > maximum progress"));
return NULL;
}
ScMW->mainWindowProgressBar->setProgress(position);
ScCore->primaryMainWindow()->mainWindowProgressBar->setProgress(position);
qApp->processEvents();
Py_INCREF(Py_None);
return Py_None;
78,12 → 78,12
return NULL;
if(!checkHaveDocument())
return NULL;
ScMW->slotDocCh(static_cast<bool>(aValue));
ScCore->primaryMainWindow()->slotDocCh(static_cast<bool>(aValue));
/*
if (aValue>0)
ScMW->slotDocCh(true);
ScCore->primaryMainWindow()->slotDocCh(true);
else
ScMW->slotDocCh(false);*/
ScCore->primaryMainWindow()->slotDocCh(false);*/
Py_INCREF(Py_None);
return Py_None;
}
96,7 → 96,7
if(!checkHaveDocument())
return NULL;
if (zoomFactor > 0.0 || zoomFactor == -100.0)
ScMW->slotZoom(zoomFactor);
ScCore->primaryMainWindow()->slotZoom(zoomFactor);
else
{
PyErr_SetString(PyExc_ValueError, QString("The zoom factor should be greater than 0.0 or equal to -100.0. See help(zoomFactor)."));
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/svgimport.cpp
12,6 → 12,7
// loadsaveplugin.h for the FileFormat interface.
#include "../formatidlist.h"
#include "loadsaveplugin.h"
#include "scribuscore.h"
 
#include <qstring.h>
 
36,7 → 37,7
return NULL;
}
 
ScMW->doc->setLoading(false);
ScCore->primaryMainWindow()->doc->setLoading(false);
 
Py_INCREF(Py_None);
return Py_None;
/branches/Version13x/Scribus/scribus/plugins/gettext/textfilter/textfilter.h
8,9 → 8,9
#define TEXTFILTER_H
 
#include "pluginapi.h"
#include <scribus.h>
#include "scribus.h"
#include <prefscontext.h>
#include <gtwriter.h>
#include "gtwriter.h"
#include "tffilter.h"
 
extern "C" PLUGIN_API void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer);
/branches/Version13x/Scribus/scribus/plugins/gettext/textfilter/tffilter.cpp
9,12 → 9,11
 
#include <qlayout.h>
#include <qtooltip.h>
#include <scribusapi.h>
#include <scribus.h>
#include "scribusapi.h"
#include "scribuscore.h"
#include "prefsmanager.h"
#include <prefsfile.h>
#include "prefsfile.h"
 
extern ScribusMainWindow SCRIBUS_API *ScMW;
extern QPixmap SCRIBUS_API loadIcon(QString nam);
 
tfFilter::tfFilter(QWidget *parent, const char *name,
476,9 → 475,9
void tfFilter::getParagraphStyles()
{
thirdCombo->insertItem("");
for (uint i = 5; i < ScMW->doc->docParagraphStyles.size(); ++i)
for (uint i = 5; i < ScCore->primaryMainWindow()->doc->docParagraphStyles.size(); ++i)
{
thirdCombo->insertItem(ScMW->doc->docParagraphStyles[i].name());
thirdCombo->insertItem(ScCore->primaryMainWindow()->doc->docParagraphStyles[i].name());
}
}
 
/branches/Version13x/Scribus/scribus/plugins/gettext/textfilter/tfdia.cpp
7,7 → 7,7
#include "tfdia.h"
#include "tfdia.moc"
#include "prefsmanager.h"
#include <prefsfile.h>
#include "prefsfile.h"
#include <qpixmap.h>
#include <qtooltip.h>
#include <qlabel.h>
/branches/Version13x/Scribus/scribus/plugins/gettext/textfilter/textfilter.cpp
14,10 → 14,10
#include <qregexp.h>
#include <qmap.h>
#include "prefsmanager.h"
#include <prefsfile.h>
#include "prefsfile.h"
#include <vector>
#include <gtframestyle.h>
#include <gtparagraphstyle.h>
#include "gtframestyle.h"
#include "gtparagraphstyle.h"
#include "tfdia.h"
 
QString FileFormatName()
/branches/Version13x/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
17,7 → 17,7
#include "gtwriter.h"
#include "gtparagraphstyle.h"
#include "scribusstructs.h"
#include "scribus.h"
#include "scribuscore.h"
 
 
/*! \brief A dummy 0 filler (helper procedure)
44,11 → 44,11
if (filename.isNull())
return;
qApp->setOverrideCursor(QCursor(Qt::WaitCursor), true);
ScMW->mainWindowProgressBar->reset();
ScCore->primaryMainWindow()->mainWindowProgressBar->reset();
PdbIm *im = new PdbIm(filename, encoding, writer);
im->write();
delete im;
ScMW->mainWindowProgressBar->reset();
ScCore->primaryMainWindow()->mainWindowProgressBar->reset();
qApp->restoreOverrideCursor();
}
 
88,7 → 88,7
 
if (!m_pdfp)
{
QMessageBox::warning(ScMW, QObject::tr("PDB Import", "PDB Importer"),
QMessageBox::warning(ScCore->primaryMainWindow(), QObject::tr("PDB Import", "PDB Importer"),
"<qt>" + QObject::tr("Could not open file %1", "PDB Importer").arg(fname) + "</qt>",
0);
return;
97,7 → 97,7
if (strncmp(m_header.type, DOC_TYPE, sizeof(m_header.type) ) ||
strncmp( m_header.creator, DOC_CREATOR, sizeof(m_header.creator)))
{
QMessageBox::warning(ScMW, QObject::tr("PDB Import", "PDB Importer"),
QMessageBox::warning(ScCore->primaryMainWindow(), QObject::tr("PDB Import", "PDB Importer"),
"<qt>" + QObject::tr("This file is not recognized as a PDB document. Please, report this as a bug if you are sure it is one.", "PDB Importer") + "</qt>",
0);
return;
105,7 → 105,7
 
// progressbar
int num_records = swap_Word( m_header.numRecords ) - 1;
ScMW->mainWindowProgressBar->setTotalSteps(num_records);
ScCore->primaryMainWindow()->mainWindowProgressBar->setTotalSteps(num_records);
fseek(m_pdfp, PDB_HEADER_SIZE, SEEK_SET);
GET_DWord(m_pdfp, offset);
fseek(m_pdfp, offset, SEEK_SET);
120,7 → 120,7
{
DWord next_offset;
 
ScMW->mainWindowProgressBar->setProgress(rec_num);
ScCore->primaryMainWindow()->mainWindowProgressBar->setProgress(rec_num);
fseek( m_pdfp, PDB_HEADER_SIZE + PDB_RECORD_HEADER_SIZE * rec_num, SEEK_SET);
GET_DWord( m_pdfp, offset );
if( rec_num < num_records )
/branches/Version13x/Scribus/scribus/plugins/newfromtemplateplugin/nftemplate.cpp
92,29 → 92,30
delete about;
}
 
bool NewFromTemplatePlugin::run(QString target)
bool NewFromTemplatePlugin::run(ScribusDoc* doc, QString target)
{
Q_ASSERT(target.isNull());
Nft = new MenuNFT(ScMW);
Nft = new MenuNFT();
Q_CHECK_PTR(Nft);
Nft->RunNFTPlug();
Nft->RunNFTPlug(doc);
return true;
}
 
 
void MenuNFT::RunNFTPlug()
void MenuNFT::RunNFTPlug(ScribusDoc* /*doc*/)
{
nftdialog* nftdia = new nftdialog(ScMW, ScCore->getGuiLanguage(), PrefsManager::instance()->appPrefs.documentTemplatesDir);
ScribusMainWindow* mw=ScCore->primaryMainWindow();
nftdialog* nftdia = new nftdialog(mw, ScCore->getGuiLanguage(), PrefsManager::instance()->appPrefs.documentTemplatesDir);
if (nftdia->exec())
{
qApp->setOverrideCursor(QCursor(Qt::WaitCursor), true);
ScMW->loadDoc(QDir::cleanDirPath(nftdia->currentDocumentTemplate->file));
ScMW->doc->hasName = false;
mw->loadDoc(QDir::cleanDirPath(nftdia->currentDocumentTemplate->file));
mw->doc->hasName = false;
UndoManager::instance()->renameStack(nftdia->currentDocumentTemplate->name);
ScMW->doc->DocName = nftdia->currentDocumentTemplate->name;
ScMW->updateActiveWindowCaption(QObject::tr("Document Template: ") + nftdia->currentDocumentTemplate->name);
mw->doc->DocName = nftdia->currentDocumentTemplate->name;
mw->updateActiveWindowCaption(QObject::tr("Document Template: ") + nftdia->currentDocumentTemplate->name);
QDir::setCurrent(PrefsManager::instance()->documentDir());
ScMW->removeRecent(QDir::cleanDirPath(nftdia->currentDocumentTemplate->file));
mw->removeRecent(QDir::cleanDirPath(nftdia->currentDocumentTemplate->file));
qApp->restoreOverrideCursor();
}
delete nftdia;
/branches/Version13x/Scribus/scribus/plugins/newfromtemplateplugin/nftemplate.h
11,6 → 11,7
#include "scplugin.h"
 
class ScrAction;
class ScribusDoc;
 
class PLUGIN_API NewFromTemplatePlugin : public ScActionPlugin
{
21,7 → 22,7
NewFromTemplatePlugin();
virtual ~NewFromTemplatePlugin();
//! \brief main method
virtual bool run(QString target = QString::null);
virtual bool run(ScribusDoc* doc, QString target = QString::null);
virtual const QString fullTrName() const;
virtual const AboutData* getAboutData() const;
virtual void deleteAboutData(const AboutData* about) const;
40,11 → 41,11
Q_OBJECT
 
public:
MenuNFT(QWidget* /*parent*/) {};
MenuNFT() {};
~MenuNFT() {};
 
public slots:
void RunNFTPlug();
void RunNFTPlug(ScribusDoc*);
};
 
static MenuNFT* Nft;
/branches/Version13x/Scribus/scribus/plugins/short-words/shortwords.cpp
107,38 → 107,38
delete about;
}
 
bool ShortWordsPlugin::run(QString target)
bool ShortWordsPlugin::run(ScribusDoc* doc, QString target)
{
Q_ASSERT(target.isEmpty());
 
uint originalPage = ScMW->doc->currentPage()->pageNr();
SWDialog *dlg = new SWDialog(ScMW, "dlg", true, 0);
uint originalPage = doc->currentPage()->pageNr();
SWDialog *dlg = new SWDialog(doc->scMW(), "dlg", true, 0);
if (dlg->exec() == QDialog::Accepted) {
SWParse *parse = new SWParse();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
ScMW->mainWindowStatusLabel->setText(QObject::tr("Short Words processing. Wait please...", "short words plugin"));
doc->scMW()->setStatusBarInfoText(QObject::tr("Short Words processing. Wait please...", "short words plugin"));
switch (dlg->actionSelected) {
case 0:
parse->parseSelection();
parse->parseSelection(doc);
break;
case 1:
parse->parsePage(ScMW->doc->currentPage()->pageNr());
parse->parsePage(doc, doc->currentPage()->pageNr());
break;
case 2:
parse->parseAll();
parse->parseAll(doc);
break;
} // switch
// enable "Save" icon
if (parse->modify > 0)
ScMW->slotDocCh(true);
doc->changed();
delete parse;
// redraw document
ScMW->view->DrawNew();
doc->view()->DrawNew();
QApplication::restoreOverrideCursor();
ScMW->mainWindowStatusLabel->setText(QObject::tr("Short Words processing. Done.", "short words plugin"));
ScMW->mainWindowProgressBar->reset();
doc->scMW()->setStatusBarInfoText(QObject::tr("Short Words processing. Done.", "short words plugin"));
doc->scMW()->mainWindowProgressBar->reset();
// set page where user calls vlna
ScMW->view->GotoPage(originalPage);
doc->view()->GotoPage(originalPage);
} // action
delete dlg;
return true;
/branches/Version13x/Scribus/scribus/plugins/short-words/parse.h
40,14 → 40,14
\param aFrame pointer to the existing text frame */
void parseItem(PageItem *aFrame);
/*! \brief selcted frames on the page */
void parseSelection();
void parseSelection(ScribusDoc* doc);
/*! \brief one page - using actual page */
void parsePage();
void parsePage(ScribusDoc* doc);
/*! \brief one page
\param page page number*/
void parsePage(int page);
void parsePage(ScribusDoc* doc, int page);
/*! \brief all pages in the document */
void parseAll();
void parseAll(ScribusDoc* doc);
};
 
#endif
/branches/Version13x/Scribus/scribus/plugins/short-words/vlnadialog.cpp
41,9 → 41,6
 
#include "commonstrings.h"
 
extern ScribusMainWindow SCRIBUS_API *ScMW;
 
 
SWDialog::SWDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog(parent, name, modal, fl)
{
/branches/Version13x/Scribus/scribus/plugins/short-words/shortwords.h
26,7 → 26,7
// Standard plugin implementation
ShortWordsPlugin();
virtual ~ShortWordsPlugin();
virtual bool run(QString target = QString::null);
virtual bool run(ScribusDoc* doc, QString target = QString::null);
virtual const QString fullTrName() const;
virtual const AboutData* getAboutData() const;
virtual void deleteAboutData(const AboutData* about) const;
/branches/Version13x/Scribus/scribus/plugins/short-words/configuration.cpp
24,7 → 24,7
#include "scpaths.h"
#include "version.h"
 
#include "scribus.h"
#include "langmgr.h"
#include "prefsmanager.h"
#include "prefscontext.h"
#include "prefsfile.h"
31,7 → 31,6
#include <qdir.h>
#include <qstringlist.h>
 
extern ScribusMainWindow SCRIBUS_API *ScMW;
 
SWConfig::SWConfig()
{
147,12 → 146,14
{
QMap<QString,QString>::Iterator it;
QString lang;
 
for (it = ScMW->Sprachen.begin(); it != ScMW->Sprachen.end(); ++it)
{
lang = getLangCodeFromHyph(it.data());
LanguageManager langmgr;
langmgr.init(false);
// for (it = ScMW->Sprachen.begin(); it != ScMW->Sprachen.end(); ++it)
// {
lang = langmgr.getAbbrevFromLang(it.data());
// lang = getLangCodeFromHyph(it.data());
if (lang == code)
return it.key();
}
// }
return code;
}
/branches/Version13x/Scribus/scribus/plugins/short-words/parse.cpp
29,9 → 29,6
#include "pageitem.h"
#include "selection.h"
 
extern ScribusMainWindow SCRIBUS_API *ScMW;
 
 
SWParse::SWParse()
{
modify = 0;
59,8 → 56,8
 
// an ugly hack to get the language code from the item language property
lang = aFrame->itemText.charStyle(0).language();
if (ScMW->Sprachen.contains(lang))
lang = cfg->getLangCodeFromHyph(ScMW->Sprachen[lang]);
if (aFrame->doc()->scMW()->Sprachen.contains(lang))
lang = cfg->getLangCodeFromHyph(aFrame->doc()->scMW()->Sprachen[lang]);
// apply spaces after shorts
shorts = cfg->getShortWords(lang);
if (shorts.count()==0)
119,53 → 116,51
delete(cfg);
} // end of method
 
void SWParse::parseSelection()
void SWParse::parseSelection(ScribusDoc* doc)
{
//uint docSelectionCount = ScMW->view->SelItem.count();
uint docSelectionCount = ScMW->doc->m_Selection->count();
ScMW->mainWindowProgressBar->setTotalSteps(docSelectionCount);
uint docSelectionCount = doc->m_Selection->count();
doc->scMW()->mainWindowProgressBar->setTotalSteps(docSelectionCount);
for (uint i=0; i < docSelectionCount; ++i)
{
ScMW->mainWindowProgressBar->setProgress(i);
//parseItem(ScMW->view->SelItem.at(i));
parseItem(ScMW->doc->m_Selection->itemAt(i));
doc->scMW()->mainWindowProgressBar->setProgress(i);
parseItem(doc->m_Selection->itemAt(i));
} // for items
ScMW->mainWindowProgressBar->setProgress(docSelectionCount);
doc->scMW()->mainWindowProgressBar->setProgress(docSelectionCount);
}
 
 
void SWParse::parsePage()
void SWParse::parsePage(ScribusDoc* doc)
{
parsePage(ScMW->doc->currentPageNumber());
parsePage(doc, doc->currentPageNumber());
}
 
void SWParse::parsePage(int page)
void SWParse::parsePage(ScribusDoc* doc, int page)
{
uint cnt = 0;
uint docItemsCount=ScMW->doc->Items->count();
uint docItemsCount=doc->Items->count();
for (uint a = 0; a < docItemsCount; ++a)
{
PageItem* b = ScMW->doc->Items->at(a);
PageItem* b = doc->Items->at(a);
if (b->OwnPage == page)
++cnt;
}
ScMW->mainWindowProgressBar->setTotalSteps(cnt);
ScMW->view->GotoPage(page);
doc->scMW()->mainWindowProgressBar->setTotalSteps(cnt);
doc->view()->GotoPage(page);
uint i = 0;
for (uint a = 0; a < docItemsCount; ++a)
{
PageItem* b = ScMW->doc->Items->at(a);
PageItem* b = doc->Items->at(a);
if (b->OwnPage == page)
{
ScMW->mainWindowProgressBar->setProgress(++i);
doc->scMW()->mainWindowProgressBar->setProgress(++i);
parseItem(b);
}
}
ScMW->mainWindowProgressBar->setProgress(cnt);
doc->scMW()->mainWindowProgressBar->setProgress(cnt);
}
 
void SWParse::parseAll()
void SWParse::parseAll(ScribusDoc* doc)
{
for (uint i=0; i < ScMW->doc->Pages->count(); ++i)
parsePage(i);
for (uint i=0; i < doc->Pages->count(); ++i)
parsePage(doc, i);
}
/branches/Version13x/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
10,8 → 10,9
#include "satemplate.h"
#include "satemplate.moc"
#include "satdialog.h"
#include "scribus.h"
 
#include "scribuscore.h"
#include "scribusdoc.h"
#include "prefsfile.h"
#include "prefsmanager.h"
 
85,7 → 86,7
delete about;
}
 
bool SaveAsTemplatePlugin::run(QString target)
bool SaveAsTemplatePlugin::run(ScribusDoc* doc, QString target)
/*{
Q_ASSERT(target.isEmpty());
Sat = new MenuSAT();
97,17 → 98,18
*/
/* jghali's fix when the new file dialog is cancelled SaT is still active in the menu - PL */
{
if ( ScMW->doc )
{
Q_ASSERT(target.isEmpty());
Sat = new MenuSAT();
Sat->RunSATPlug();
delete Sat;
Sat = 0;
}
m_Doc=doc;
if ( m_Doc )
{
Q_ASSERT(target.isEmpty());
Sat = new MenuSAT();
Sat->RunSATPlug(m_Doc);
delete Sat;
Sat = 0;
}
return true;
}
void MenuSAT::RunSATPlug()
void MenuSAT::RunSATPlug(ScribusDoc* doc)
{
QDir templates(QDir::homeDirPath() + "/.scribus");
if (!templates.exists("templates"))
115,9 → 117,9
templates.mkdir("templates");
}
QString currentDirPath = QDir::currentDirPath();
QString currentFile = ScMW->doc->DocName;
bool hasName = ScMW->doc->hasName;
bool isModified = ScMW->doc->isModified();
QString currentFile = doc->DocName;
bool hasName = doc->hasName;
bool isModified = doc->isModified();
QString userTemplatesDir = PrefsManager::instance()->appPrefs.documentTemplatesDir;
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString oldCollect = dirs->get("collect", ".");
131,36 → 133,36
templatesDir = userTemplatesDir;
}
dirs->set("collect", templatesDir);
if (ScMW->Collect().isEmpty())
if (doc->scMW()->Collect().isEmpty())
return;
if (oldCollect != ".")
dirs->set("collect", oldCollect);
QString docPath = ScMW->doc->DocName;
QString docPath = doc->DocName;
QString docDir = docPath.left(docPath.findRev('/'));
QString docName = docPath.right(docPath.length() - docPath.findRev('/') - 1);
docName = docName.left(docName.findRev(".s"));
 
if (currentFile != ScMW->doc->DocName)
if (currentFile != doc->DocName)
{
satdialog* satdia = new satdialog(ScMW,docName,
static_cast<int>(ScMW->doc->pageWidth + 0.5),
static_cast<int>(ScMW->doc->pageHeight + 0.5));
satdialog* satdia = new satdialog(doc->scMW(),docName,
static_cast<int>(doc->pageWidth + 0.5),
static_cast<int>(doc->pageHeight + 0.5));
if (satdia->exec())
{
sat* s = new sat(ScMW, satdia, docPath.right(docPath.length() - docPath.findRev('/') - 1),docDir);
sat* s = new sat(doc, satdia, docPath.right(docPath.length() - docPath.findRev('/') - 1),docDir);
s->createImages();
s->createTmplXml();
delete s;
}
// Restore the state that was before ScMW->Collect()
ScMW->doc->DocName = currentFile;
ScMW->doc->hasName = hasName;
ScMW->doc->setModified(isModified);
doc->DocName = currentFile;
doc->hasName = hasName;
doc->setModified(isModified);
QString newCaption=currentFile;
if (isModified)
newCaption.append('*');
ScMW->updateActiveWindowCaption(newCaption);
ScMW->removeRecent(docPath);
doc->scMW()->updateActiveWindowCaption(newCaption);
doc->scMW()->removeRecent(docPath);
QDir::setCurrent(currentDirPath);
delete satdia;
}
168,10 → 170,10
 
// --------------------- CLASS sat ------------------------------------------------//
 
sat::sat(ScribusMainWindow* scribusApp, satdialog* satdia, QString fileName, QString tmplDir)
sat::sat(ScribusDoc* doc, satdialog* satdia, QString fileName, QString tmplDir)
{
lang = ScCore->getGuiLanguage();
sapp = scribusApp;
m_Doc = doc;
dia = satdia;
dir = tmplDir;
if (dir.right(1) == "/")
205,8 → 207,8
{
QString tnsmallName = dia->nameEdit->text() + "tn.png";
QString tnlargeName = dia->nameEdit->text() + ".png";
double pageh = sapp->doc->pageHeight;
double pagew = sapp->doc->pageWidth;
double pageh = m_Doc->pageHeight;
double pagew = m_Doc->pageWidth;
int pageSizeSmall = 0;
int pageSizeLarge = 0;
if (pageh > pagew)
219,8 → 221,8
pageSizeSmall = static_cast<int>(pagew / 10);
pageSizeLarge = static_cast<int>(pagew / 3);
}
QImage tnsmall = sapp->view->PageToPixmap(0,pageSizeSmall);
QImage tnlarge = sapp->view->PageToPixmap(0,pageSizeLarge);
QImage tnsmall = m_Doc->view()->PageToPixmap(0,pageSizeSmall);
QImage tnlarge = m_Doc->view()->PageToPixmap(0,pageSizeLarge);
tnsmall.save(dir+"/"+tnsmallName,"PNG",70);
tnlarge.save(dir+"/"+tnlargeName, "PNG", 70);
}
/branches/Version13x/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h
22,7 → 22,7
// Standard plugin implementation
SaveAsTemplatePlugin();
virtual ~SaveAsTemplatePlugin();
virtual bool run(QString target = QString::null);
virtual bool run(ScribusDoc* doc, QString target = QString::null);
virtual const QString fullTrName() const;
virtual const AboutData* getAboutData() const;
virtual void deleteAboutData(const AboutData* about) const;
49,7 → 49,7
~MenuSAT() {};
 
public slots:
void RunSATPlug();
void RunSATPlug(ScribusDoc*);
};
 
// static MenuSAT* satm;
57,7 → 57,7
class sat
{
private:
ScribusMainWindow* sapp;
ScribusDoc* m_Doc;
satdialog* dia;
QString file;
QString dir;
70,7 → 70,7
public:
void createTmplXml();
void createImages();
sat(ScribusMainWindow* scribusApp, satdialog* satdia, QString fileName, QString tmplDir);
sat(ScribusDoc* doc, satdialog* satdia, QString fileName, QString tmplDir);
~sat();
};
 
/branches/Version13x/Scribus/scribus/plugins/pixmapexport/export.cpp
88,17 → 88,17
delete about;
}
 
bool PixmapExportPlugin::run(QString target)
bool PixmapExportPlugin::run(ScribusDoc* doc, QString target)
{
Q_ASSERT(target.isEmpty());
Q_ASSERT(!ScMW->doc->masterPageMode());
Q_ASSERT(!doc->masterPageMode());
bool res;
ExportBitmap *ex = new ExportBitmap();
ExportForm *dia = new ExportForm(ScMW, ex->pageDPI, ex->quality, ex->bitmapType, ScMW->doc->pageWidth, ScMW->doc->pageHeight);
ExportForm *dia = new ExportForm(doc->scMW(), ex->pageDPI, ex->quality, ex->bitmapType, doc->pageWidth, doc->pageHeight);
 
// interval widgets handling
QString tmp;
dia->RangeVal->setText(tmp.setNum(ScMW->doc->currentPageNumber()+1));
dia->RangeVal->setText(tmp.setNum(doc->currentPageNumber()+1));
// main "loop"
if (dia->exec()==QDialog::Accepted)
{
109,27 → 109,27
ex->quality = dia->QualityBox->value();
ex->exportDir = dia->OutputDirectory->text();
ex->bitmapType = dia->bitmapType;
ScMW->mainWindowProgressBar->reset();
doc->scMW()->mainWindowProgressBar->reset();
if (dia->OnePageRadio->isChecked())
res = ex->exportActual();
res = ex->exportCurrent(doc);
else
{
if (dia->AllPagesRadio->isChecked())
parsePagesString("*", &pageNs, ScMW->doc->DocPages.count());
parsePagesString("*", &pageNs, doc->DocPages.count());
else
parsePagesString(dia->RangeVal->text(), &pageNs, ScMW->doc->DocPages.count());
res = ex->exportInterval(pageNs);
parsePagesString(dia->RangeVal->text(), &pageNs, doc->DocPages.count());
res = ex->exportInterval(doc, pageNs);
}
ScMW->mainWindowProgressBar->reset();
doc->scMW()->mainWindowProgressBar->reset();
QApplication::restoreOverrideCursor();
if (!res)
{
QMessageBox::warning(ScMW, QObject::tr("Save as Image"), QObject::tr("Error writing the output file(s)."));
ScMW->mainWindowStatusLabel->setText(QObject::tr("Error writing the output file(s)."));
QMessageBox::warning(doc->scMW(), QObject::tr("Save as Image"), QObject::tr("Error writing the output file(s)."));
doc->scMW()->setStatusBarInfoText(QObject::tr("Error writing the output file(s)."));
}
else
{
ScMW->mainWindowStatusLabel->setText(QObject::tr("Export successful."));
doc->scMW()->setStatusBarInfoText(QObject::tr("Export successful."));
}
} // if accepted
// clean the trash
149,9 → 149,9
overwrite = false;
}
 
QString ExportBitmap::getFileName(uint pageNr)
QString ExportBitmap::getFileName(ScribusDoc* doc, uint pageNr)
{
return QDir::cleanDirPath(QDir::convertSeparators(exportDir + "/" + getFileNameByPage(pageNr, bitmapType.lower())));
return QDir::cleanDirPath(QDir::convertSeparators(exportDir + "/" + getFileNameByPage(doc, pageNr, bitmapType.lower())));
}
 
ExportBitmap::~ExportBitmap()
158,12 → 158,12
{
}
 
bool ExportBitmap::exportPage(uint pageNr, bool single = true)
bool ExportBitmap::exportPage(ScribusDoc* doc, uint pageNr, bool single = true)
{
uint over = 0;
QString fileName = getFileName(pageNr);
QString fileName = getFileName(doc, pageNr);
 
if (!ScMW->doc->Pages->at(pageNr))
if (!doc->Pages->at(pageNr))
return false;
 
/* a little magic here - I need to compute the "maxGr" value...
171,10 → 171,8
* portrait and user defined sizes.
*/
double pixmapSize;
(ScMW->doc->pageHeight > ScMW->doc->pageWidth)
? pixmapSize = ScMW->doc->pageHeight
: pixmapSize = ScMW->doc->pageWidth;
QImage im = ScMW->view->PageToPixmap(pageNr, qRound(pixmapSize * enlargement * (pageDPI / 72.0) / 100.0), false);
pixmapSize = (doc->pageHeight > doc->pageWidth) ? doc->pageHeight : doc->pageWidth;
QImage im = doc->view()->PageToPixmap(pageNr, qRound(pixmapSize * enlargement * (pageDPI / 72.0) / 100.0), false);
int dpm = qRound(100.0 / 2.54 * pageDPI);
im.setDotsPerMeterY(dpm);
im.setDotsPerMeterX(dpm);
184,7 → 182,7
/* Changed the following Code from the original QMessageBox::question to QMessageBox::warning
to keep the Code compatible to Qt-3.1.x
f.s 12.05.2004 */
over = ScMessageBox::warning(ScMW,
over = ScMessageBox::warning(doc->scMW(),
QObject::tr("File exists. Overwrite?"),
fileName +"\n"+ QObject::tr("exists already. Overwrite?"),
QObject::tr("Yes"),
201,19 → 199,19
return im.save(fileName, bitmapType, quality);
}
 
bool ExportBitmap::exportActual()
bool ExportBitmap::exportCurrent(ScribusDoc* doc)
{
return exportPage(ScMW->doc->currentPageNumber(), true);
return exportPage(doc, doc->currentPageNumber(), true);
}
 
bool ExportBitmap::exportInterval(std::vector<int> &pageNs)
bool ExportBitmap::exportInterval(ScribusDoc* doc, std::vector<int> &pageNs)
{
bool res;
ScMW->mainWindowProgressBar->setTotalSteps(pageNs.size());
doc->scMW()->mainWindowProgressBar->setTotalSteps(pageNs.size());
for (uint a = 0; a < pageNs.size(); ++a)
{
ScMW->mainWindowProgressBar->setProgress(a);
res = exportPage(pageNs[a]-1, false);
doc->scMW()->mainWindowProgressBar->setProgress(a);
res = exportPage(doc, pageNs[a]-1, false);
if (!res)
return false;
}
/branches/Version13x/Scribus/scribus/plugins/pixmapexport/export.h
23,7 → 23,7
// Standard plugin implementation
PixmapExportPlugin();
virtual ~PixmapExportPlugin();
virtual bool run(QString target = QString::null);
virtual bool run(ScribusDoc* doc, QString target = QString::null);
virtual const QString fullTrName() const;
virtual const AboutData* getAboutData() const;
virtual void deleteAboutData(const AboutData* about) const;
64,20 → 64,20
 
/*! \brief Exports only the actual page
\retval bool true on success */
bool exportActual();
bool exportCurrent(ScribusDoc* doc);
/*! \brief Exports chosen interval of the pages
\param pageNs interval of the page numbers
\retval true on success */
bool exportInterval(std::vector<int> &pageNs);
bool exportInterval(ScribusDoc* doc, std::vector<int> &pageNs);
private:
/*! \brief create specified filename "docfilename-005.ext" */
QString getFileName(uint pageNr);
QString getFileName(ScribusDoc* doc, uint pageNr);
/*! \brief export one specified page
\param pageNr number of the page
\param single bool TRUE if only the one page is exported
\retval bool true on success
*/
bool exportPage(uint pageNr, bool single);
bool exportPage(ScribusDoc* doc, uint pageNr, bool single);
};
 
ScrAction *fileNewFromTemplateAction;
/branches/Version13x/Scribus/scribus/plugins/colorwheel/cwdialog.h
11,7 → 11,7
#include <qvariant.h>
#include <qdialog.h>
#include "colorwheelwidget.h"
#include <scribus.h>
#include "scribus.h"
 
class QVBoxLayout;
class QHBoxLayout;
25,8 → 25,8
class QGroupBox;
class QSlider;
class ColorListBox;
class ScribusDoc;
 
 
/*! \brief GUI for colors from preferences/document.
List all available colors in one dialog with samples.
\author Petr Vanek; petr@yarpen.cz
36,7 → 36,7
Q_OBJECT
 
public:
ScribusColorList(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
ScribusColorList(ScribusDoc* doc, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~ScribusColorList(){};
 
ColorListBox* listView;
47,6 → 47,7
QColor selectedColor;
 
protected:
ScribusDoc* m_Doc;
QGridLayout* ScribusColorListLayout;
QVBoxLayout* listLayout;
QHBoxLayout* btnLayout;
67,7 → 68,7
Q_OBJECT
 
public:
ColorWheelDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
ColorWheelDialog( ScribusDoc* doc, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~ColorWheelDialog();
 
QLabel* typeLabel;
84,6 → 85,7
QComboBox* defectCombo;
 
protected:
ScribusDoc* m_Doc;
/** \brief It fills a colors into list view.
It takes colors from ColorWheel widget. */
void fillColorList();
/branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheel.cpp
10,7 → 10,7
#include "cwdialog.h"
#include <qcursor.h>
#include <qlistview.h>
#include "scribus.h"
#include "scribuscore.h"
 
int colorwheel_getPluginAPIVersion()
{
79,10 → 79,13
}
 
/** Create dialog. Everything else is handled in separated classes. */
bool ColorWheelPlugin::run(QString target)
bool ColorWheelPlugin::run(ScribusDoc* doc, QString target)
{
Q_ASSERT(target.isNull());
ColorWheelDialog *dlg = new ColorWheelDialog(ScMW, "dlg", true, 0);
ScribusDoc* currDoc=doc;
if (currDoc==0)
currDoc=ScCore->primaryMainWindow()->doc;
ColorWheelDialog *dlg = new ColorWheelDialog(currDoc, currDoc->scMW(), "dlg", true, 0);
if (dlg)
{
dlg->exec();
/branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheel.h
27,7 → 27,7
// Standard plugin implementation
ColorWheelPlugin();
virtual ~ColorWheelPlugin();
virtual bool run(QString target = QString::null);
virtual bool run(ScribusDoc* doc, QString target = QString::null);
virtual const QString fullTrName() const;
virtual const AboutData* getAboutData() const;
virtual void deleteAboutData(const AboutData* about) const;
/branches/Version13x/Scribus/scribus/plugins/colorwheel/cwdialog.cpp
34,10 → 34,9
#include "colorm.h"
 
 
extern ScribusMainWindow SCRIBUS_API *ScMW;
 
ScribusColorList::ScribusColorList(QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog(parent, name, modal, fl)
ScribusColorList::ScribusColorList(ScribusDoc* doc, QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog(parent, name, modal, fl),
m_Doc(doc)
{
if (!name)
setName("ScribusColorList");
47,7 → 46,7
 
listView = new ColorListBox(this, "listView");
listLayout->addWidget(listView);
listView->updateBox(ScMW->doc->PageColors, ColorListBox::fancyPixmap);
listView->updateBox(m_Doc->PageColors, ColorListBox::fancyPixmap);
 
btnLayout = new QHBoxLayout(0, 0, 6, "btnLayout");
btnSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
79,14 → 78,15
 
void ScribusColorList::okButton_clicked()
{
ScColor c = ScMW->doc->PageColors[listView->currentText()];
ScColor c = m_Doc->PageColors[listView->currentText()];
selectedColor = c.getRGBColor();
accept();
}
 
 
ColorWheelDialog::ColorWheelDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog(parent, name, modal, fl)
ColorWheelDialog::ColorWheelDialog(ScribusDoc* doc, QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog(parent, name, modal, fl),
m_Doc(doc)
{
if (!name)
setName("ColorWheelDialog");
329,7 → 329,7
bool err = false;
for (ColorList::iterator it = colorWheel->colorList.begin(); it != colorWheel->colorList.end(); ++it)
{
if (ScMW->doc->PageColors.contains(it.key()))
if (m_Doc->PageColors.contains(it.key()))
{
status += "<b>" + tr("Error: ") + "</b>" + tr("Color %1 exists already!").arg(it.key()) + "<br/>";
err = true;
337,7 → 337,7
else
{
status += tr("Color %1 appended.").arg(it.key()) + "<br/>";
ScMW->doc->PageColors[it.key()] = it.data();
m_Doc->PageColors[it.key()] = it.data();
}
}
status += "<p>" + tr("Now opening the color manager.") + "</p></qt>";
344,11 → 344,11
if (err)
{
QMessageBox::information(this, tr("Color Merging"), status);
ScMW->slotEditColors();
m_Doc->scMW()->slotEditColors();
return;
}
ScMW->propertiesPalette->updateColorList();
ScMW->propertiesPalette->updateCList();
m_Doc->scMW()->propertiesPalette->updateColorList();
m_Doc->scMW()->propertiesPalette->updateCList();
accept();
}
 
356,10 → 356,10
{
for (ColorList::iterator it = colorWheel->colorList.begin(); it != colorWheel->colorList.end(); ++it)
{
ScMW->doc->PageColors[it.key()] = it.data();
m_Doc->PageColors[it.key()] = it.data();
}
ScMW->propertiesPalette->updateColorList();
ScMW->propertiesPalette->updateCList();
m_Doc->scMW()->propertiesPalette->updateColorList();
m_Doc->scMW()->propertiesPalette->updateCList();
accept();
}
 
442,7 → 442,7
 
void ColorWheelDialog::importColor()
{
ScribusColorList *dia = new ScribusColorList(this, "dia", true, 0);
ScribusColorList *dia = new ScribusColorList(m_Doc, this, "dia", true, 0);
if (dia->exec())
userColorInput(dia->selectedColor);
delete dia;
/branches/Version13x/Scribus/scribus/plugins/myplugin/myplugin.cpp
58,11 → 58,11
delete about;
}
 
bool MyPlugin::run(QString target)
bool MyPlugin::run(ScribusDoc* doc, QString target)
{
MyPluginImpl *myPluginImpl = new MyPluginImpl();
Q_CHECK_PTR(myPluginImpl);
bool result = myPluginImpl->run(target);
bool result = myPluginImpl->run(target, doc);
delete myPluginImpl;
return result;
}
/branches/Version13x/Scribus/scribus/plugins/myplugin/mypluginimpl.cpp
5,7 → 5,7
for which a new license (GPL+exception) is in place.
*/
#include "mypluginimpl.h"
#include "scribus.h"
#include "scribusdoc.h"
 
#include <qstring.h>
#include <qmessagebox.h>
15,11 → 15,11
{
}
 
bool MyPluginImpl::run(const QString & target)
bool MyPluginImpl::run(const QString & target, ScribusDoc* doc)
{
// Do the bulk of your work here
QMessageBox::information(
ScMW,
(QWidget*)doc->scMW(),
tr("Scribus - My Plugin"),
tr("The plugin worked!"),
QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape,
/branches/Version13x/Scribus/scribus/plugins/myplugin/myplugin.h
23,7 → 23,7
MyPlugin();
virtual ~MyPlugin();
//! \brief main method to run the plug
virtual bool run(QString target = QString::null);
virtual bool run(ScribusDoc* doc, QString target = QString::null);
virtual const QString fullTrName() const;
virtual const AboutData* getAboutData() const;
virtual void deleteAboutData(const AboutData* about) const;
/branches/Version13x/Scribus/scribus/plugins/myplugin/mypluginimpl.h
10,6 → 10,7
#include <qobject.h>
 
class QString;
class ScribusDoc;
 
class MyPluginImpl : public QObject
{
17,7 → 18,7
public:
MyPluginImpl();
~MyPluginImpl() {};
bool run(const QString & target);
bool run(const QString & target, ScribusDoc* doc=0);
};
 
#endif
/branches/Version13x/Scribus/scribus/plugins/svgimplugin/svgplugin.cpp
31,6 → 31,7
#include "pageitem.h"
#include "scfontmetrics.h"
#include "scraction.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "selection.h"
#include "undomanager.h"
145,6 → 146,8
{
if (!checkFlags(flags))
return false;
m_Doc=ScCore->primaryMainWindow()->doc;
ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
if (filename.isEmpty())
{
flags |= lfInteractive;
151,9 → 154,9
PrefsContext* prefs = PrefsManag