Rev 1357 |
Rev 1371 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/***************************************************************************
scribus.cpp - description
-------------------
begin : Fre Apr 6 21:09:31 CEST 2001
copyright : (C) 2001 by Franz Schmid
email : Franz.Schmid@altmuehlnet.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <qaccel.h>
#include <qapplication.h>
#include <qeventloop.h>
#include <qcolordialog.h>
#include <qcolor.h>
#include <qiconset.h>
#include <qtextstream.h>
#include <qstylefactory.h>
#include <qregexp.h>
#include <qtextcodec.h>
#include <qcursor.h>
#include <qvbox.h>
#include <qpixmap.h>
#include <qkeysequence.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <dlfcn.h>
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include <string>
#include "scribus.h"
#include "scribus.moc"
#include "newfile.h"
#include "page.h"
#include "query.h"
#include "mdup.h"
#include "docinfo.h"
#include "reformdoc.h"
#include "serializer.h"
#include "align.h"
#include "fmitem.h"
#include "fontprefs.h"
#include "libprefs/prefs.h"
#include "prefstable.h"
#include "pdfopts.h"
#include "inspage.h"
#include "delpages.h"
#include "movepage.h"
#include "helpbrowser.h"
#include "scribusXml.h"
#include "libabout/about.h"
#include "libpostscript/pslib.h"
#include "druck.h"
#include "editformats.h"
#include "muster.h"
#include "applytemplate.h"
#include "picstatus.h"
#include "customfdialog.h"
#include "cmsprefs.h"
#include "annot.h"
#include "annota.h"
#include "javadocs.h"
#include "colorm.h"
#include "mpalette.h"
#include "measurements.h"
#include "gtgettext.h"
#include "fileloader.h"
#include "arrowchooser.h"
#include "tabtypography.h"
#include "tabguides.h"
#include "tabtools.h"
#include "undogui.h"
#include "filewatcher.h"
#include "charselect.h"
#include "checkDocument.h"
#include "tabcheckdoc.h"
#include "tabpdfoptions.h"
#ifdef _MSC_VER
#if (_MSC_VER >= 1200)
#include "win-config.h"
#endif
#else
#include "config.h"
#endif
#include "fpoint.h"
#include "fpointarray.h"
#include "hysettings.h"
#include "guidemanager.h"
#include "keymanager.h"
#include "mergedoc.h"
#include "lineformats.h"
#include "story.h"
#include "autoform.h"
#include "tabmanager.h"
#include "search.h"
#include "fontcombo.h"
#include "prefsfile.h"
#include "undomanager.h"
#include "polygonwidget.h"
#include "werktoolb.h"
#include "units.h"
#include "hruler.h"
#include "vruler.h"
#include "scraction.h"
#include "menumanager.h"
#include "undostate.h"
extern QPixmap loadIcon(QString nam);
extern bool overwrite(QWidget *parent, QString filename);
extern void CopyPageItem(struct CopyPasteBuffer *Buffer, PageItem *b);
extern void ReOrderText(ScribusDoc *doc, ScribusView *view);
extern int copyFile(QString source, QString target);
extern int moveFile(QString source, QString target);
using namespace std;
#ifdef HAVE_CMS
cmsHPROFILE CMSoutputProf;
cmsHPROFILE CMSprinterProf;
cmsHTRANSFORM stdTrans;
cmsHTRANSFORM stdProof;
cmsHTRANSFORM stdTransImg;
cmsHTRANSFORM stdProofImg;
bool SoftProofing;
bool Gamut;
bool CMSuse;
int IntentMonitor;
int IntentPrinter;
#endif
bool CMSavail;
ProfilesL InputProfiles;
double UmReFaktor;
QString DocDir;
ScribusApp* ScApp;
PrefsFile* prefsFile;
ScribusApp::ScribusApp()
{} // ScribusApp::ScribusApp()
/*
* retval 0 - ok, 1 - no fonts, ...
*/
int ScribusApp::initScribus(bool showSplash, const QString newGuiLanguage)
{
int retVal=0;
ExternalApp = 0;
guiLanguage = newGuiLanguage;
initSplash(showSplash);
setUsesBigPixmaps(true);
ScApp = this;
CurrStED = NULL;
setCaption( tr("Scribus " VERSION));
setKeyCompression(false);
setIcon(loadIcon("AppIcon.png"));
scrActionGroups.clear();
scrActionGroups.setAutoDelete(true);
scrActions.clear();
scrActions.setAutoDelete(true);
scrRecentFileActions.clear();
scrRecentFileActions.setAutoDelete(true);
scrWindowsActions.clear();
scrWindowsActions.setAutoDelete(true);
scrMenuMgr = new MenuManager(this->menuBar());
PrefsPfad = getPreferencesLocation();
prefsFile = new PrefsFile(QDir::convertSeparators(PrefsPfad + "/prefs13.xml"));
convertToXMLPreferences(PrefsPfad);
undoManager = UndoManager::instance();
initFileMenuActions();
initEditMenuActions();
initStyleMenuActions();
initItemMenuActions();
initPageMenuActions();
initViewMenuActions();
initToolsMenuActions();
initExtrasMenuActions();
initWindowsMenuActions();
initScriptMenuActions();
initHelpMenuActions();
initMenuBar();
initStatusBar();
initToolBars();
qApp->processEvents();
BuFromApp = false;
initFonts();
if (NoFonts)
retVal=1;
else
{
initDefaultValues();
buildFontMenu();
initDefaultPrefs();
initArrowStyles();
initKeyboardShortcuts();
resize(610, 600);
QVBox* vb = new QVBox( this );
vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
wsp = new QWorkspace( vb );
setCentralWidget( vb );
connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *)));
initPalettes();
fileWatcher = new FileWatcher(this);
if (splashScreen != NULL)
splashScreen->setStatus( tr("Reading Preferences"));
qApp->processEvents();
ReadPrefs();
HaveGS = system(Prefs.gs_exe+" -h > /dev/null 2>&1");
HavePngAlpha = system(Prefs.gs_exe+" -sDEVICE=pngalpha -c quit > /dev/null 2>&1");
DocDir = Prefs.DocDir;
if (splashScreen != NULL)
splashScreen->setStatus( tr("Getting ICC Profiles"));
CMSavail = false;
GetCMSProfiles();
initCMS();
if (splashScreen != NULL)
splashScreen->setStatus( tr("Init Hyphenator"));
qApp->processEvents();
initHyphenator();
if (splashScreen != NULL)
splashScreen->setStatus( tr("Reading Scrapbook"));
initScrapbook();
if (splashScreen != NULL)
splashScreen->setStatus( tr("Initializing Plugins"));
qApp->processEvents();
initPlugs();
if (splashScreen != NULL)
splashScreen->setStatus( tr("Setting up Shortcuts"));
qApp->processEvents();
SetShortCut();
connect(fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecent(QString)));
connect(this, SIGNAL(TextIFont(QString)), this, SLOT(AdjustFontMenu(QString)));
connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int)));
connect(this, SIGNAL(TextISize(int)), Mpal, SLOT(setSize(int)));
connect(this, SIGNAL(TextUSval(double)), Mpal, SLOT(setExtra(double)));
connect(this, SIGNAL(TextStil(int)), Mpal, SLOT(setStil(int)));
connect(this, SIGNAL(TextScale(int)), Mpal, SLOT(setTScale(int)));
connect(this, SIGNAL(TextFarben(QString, QString, int, int)), Mpal, SLOT(setActFarben(QString, QString, int, int)));
initCrashHandler();
}
closeSplash();
return retVal;
}
void ScribusApp::initSplash(bool showSplash)
{
if (showSplash)
{
splashScreen = new SplashScreen();
splashScreen->setStatus(QObject::tr("Initializing..."));
}
else
splashScreen = NULL;
}
void ScribusApp::closeSplash()
{
if (splashScreen!=NULL)
{
splashScreen->close();
delete splashScreen;
splashScreen = NULL;
}
}
void ScribusApp::initToolBars()
{
WerkTools2 = new QToolBar( tr("File"), this);
scrActions["fileNew"]->addTo(WerkTools2);
scrActions["fileOpen"]->addTo(WerkTools2);
scrMenuMgr->addMenuToWidgetOfAction("FileOpenRecent", scrActions["fileOpen"]);
scrActions["fileSave"]->addTo(WerkTools2);
scrActions["fileClose"]->addTo(WerkTools2);
scrActions["filePrint"]->addTo(WerkTools2);
scrActions["toolsPreflightVerifier"]->addTo(WerkTools2);
scrActions["fileExportAsPDF"]->addTo(WerkTools2);
editToolBar = new QToolBar(tr("Edit"), this);
UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget");
undoManager->registerGui(uWidget);
WerkTools = new WerkToolB(this);
setDockEnabled(WerkTools, DockLeft, false);
setDockEnabled(WerkTools, DockRight, false);
WerkTools->Sichtbar = true;
WerkTools->setEnabled(false);
WerkToolsP = new WerkToolBP(this);
setDockEnabled(WerkToolsP, DockLeft, false);
setDockEnabled(WerkToolsP, DockRight, false);
WerkToolsP->setEnabled(false);
WerkToolsP->Sichtbar = true;
connect(WerkTools, SIGNAL(NewMode(int)), this, SLOT(ModeFromTB(int)));
connect(WerkTools, SIGNAL(Schliessen()), this, SLOT(ToggleTools()));
connect(WerkToolsP, SIGNAL(NewMode(int)), this, SLOT(ModeFromTB(int)));
connect(WerkToolsP, SIGNAL(Schliessen()), this, SLOT(TogglePDFTools()));
}
void ScribusApp::initFonts()
{
if (splashScreen!=NULL) {
splashScreen->setStatus( tr("Searching for Fonts"));
qApp->processEvents();
}
NoFonts=GetAllFonts();
if (NoFonts)
{
if (splashScreen!=NULL)
splashScreen->close(); // 10/10/2004 pv fix #1200
QString mess = tr("There are no Postscript fonts on your system");
mess += "\n" + tr("Exiting now");
QMessageBox::critical(this, tr("Fatal Error"), mess, 1, 0, 0);
}
else
if (splashScreen!=NULL)
{
splashScreen->setStatus( tr("Font System Initialized"));
qApp->processEvents();
}
}
void ScribusApp::initDefaultPrefs()
{
/** Default font and size **/
SCFontsIterator it(Prefs.AvailFonts);
Prefs.toolSettings.defFont = it.currentKey();
Prefs.toolSettings.defSize = 120;
Prefs.AppFontSize = qApp->font().pointSize();
/** Default colours **/
Prefs.DColors.clear();
QString pfadC = LIBDIR;
QString pfadC2 = pfadC + "rgbscribus.txt";
QFile fiC(pfadC2);
if (!fiC.exists())
{
Prefs.DColors.insert("White", CMYKColor(0, 0, 0, 0));
Prefs.DColors.insert("Black", CMYKColor(0, 0, 0, 255));
Prefs.DColors.insert("Blue", CMYKColor(255, 255, 0, 0));
Prefs.DColors.insert("Cyan", CMYKColor(255, 0, 0, 0));
Prefs.DColors.insert("Green", CMYKColor(255, 0, 255, 0));
Prefs.DColors.insert("Red", CMYKColor(0, 255, 255, 0));
Prefs.DColors.insert("Yellow", CMYKColor(0, 0, 255, 0));
Prefs.DColors.insert("Magenta", CMYKColor(0, 255, 0, 0));
Prefs.DColorSet = "Scribus-Small";
}
else
{
if (fiC.open(IO_ReadOnly))
{
QString ColorEn, Cname;
int Rval, Gval, Bval;
QTextStream tsC(&fiC);
ColorEn = tsC.readLine();
while (!tsC.atEnd())
{
ColorEn = tsC.readLine();
QTextStream CoE(&ColorEn, IO_ReadOnly);
CoE >> Rval;
CoE >> Gval;
CoE >> Bval;
CoE >> Cname;
CMYKColor tmp;
tmp.setColorRGB(Rval, Gval, Bval);
Prefs.DColors.insert(Cname, tmp);
}
fiC.close();
}
Prefs.DColorSet = "X11 RGB-Set";
}
Prefs.Wheelval = 40;
Prefs.guidesSettings.marginsShown = true;
Prefs.guidesSettings.framesShown = true;
Prefs.guidesSettings.gridShown = false;
Prefs.guidesSettings.guidesShown = false;
Prefs.guidesSettings.baseShown = false;
Prefs.guidesSettings.showPic = true;
Prefs.guidesSettings.linkShown = false;
Prefs.guidesSettings.grabRad = 4;
Prefs.guidesSettings.guideRad = 10;
Prefs.guidesSettings.minorGrid = 20;
Prefs.guidesSettings.majorGrid = 100;
Prefs.guidesSettings.minorColor = QColor(green);
Prefs.guidesSettings.majorColor = QColor(green);
Prefs.guidesSettings.margColor = QColor(blue);
Prefs.guidesSettings.guideColor = QColor(darkBlue);
Prefs.guidesSettings.baseColor = QColor(lightGray);
Prefs.typographicSetttings.valueSuperScript = 33;
Prefs.typographicSetttings.scalingSuperScript = 100;
Prefs.typographicSetttings.valueSubScript = 33;
Prefs.typographicSetttings.scalingSubScript = 100;
Prefs.typographicSetttings.valueSmallCaps = 75;
Prefs.typographicSetttings.autoLineSpacing = 20;
Prefs.typographicSetttings.valueBaseGrid = 14.4;
Prefs.typographicSetttings.offsetBaseGrid = 0.0;
Prefs.GUI = "Default";
Prefs.toolSettings.dPen = "Black";
Prefs.toolSettings.dBrush = "Black";
Prefs.toolSettings.dShade = 100;
Prefs.toolSettings.dShade2 = 100;
Prefs.toolSettings.dLineArt = SolidLine;
Prefs.toolSettings.dWidth = 1;
Prefs.toolSettings.dPenLine = "Black";
Prefs.toolSettings.dPenText = "Black";
Prefs.toolSettings.dStrokeText = "Black";
Prefs.DpapColor = QColor(white);
Prefs.toolSettings.dCols = 1;
Prefs.toolSettings.dGap = 0.0;
Prefs.toolSettings.dShadeLine = 100;
Prefs.toolSettings.dLstyleLine = SolidLine;
Prefs.toolSettings.dWidthLine = 1;
Prefs.toolSettings.dStartArrow = 0;
Prefs.toolSettings.dEndArrow = 0;
Prefs.toolSettings.magMin = 10;
Prefs.toolSettings.magMax = 3200;
Prefs.toolSettings.magStep = 25;
Prefs.toolSettings.dBrushPict = "White";
Prefs.toolSettings.shadePict = 100;
Prefs.toolSettings.scaleX = 1;
Prefs.toolSettings.scaleY = 1;
Prefs.guidesSettings.before = true;
Prefs.docUnitIndex = 0;
Prefs.toolSettings.polyC = 4;
Prefs.toolSettings.polyF = 0.5;
Prefs.toolSettings.polyS = false;
Prefs.toolSettings.polyFd = 0;
Prefs.toolSettings.polyR = 0;
Prefs.checkPalSettings.visible = false;
Prefs.mainToolBarSettings.visible = true;
Prefs.pdfToolBarSettings.visible = true;
Prefs.mPaletteSettings.visible = false;
Prefs.measurePalSettings.visible = false;
Prefs.treePalSettings.visible = false;
Prefs.scrapPalSettings.visible = false;
Prefs.layerPalSettings.visible = false;
Prefs.bookmPalSettings.visible = false;
Prefs.pagePalSettings.visible = false;
Prefs.measurePalSettings.xPosition = 0;
Prefs.measurePalSettings.yPosition = 0;
Prefs.treePalSettings.xPosition = 0;
Prefs.treePalSettings.yPosition = 0;
Prefs.scrapPalSettings.xPosition = 0;
Prefs.scrapPalSettings.yPosition = 0;
Prefs.scrapPalSettings.width = 100;
Prefs.scrapPalSettings.height = 200;
Prefs.pagePalSettings.xPosition = 0;
Prefs.pagePalSettings.yPosition = 0;
Prefs.bookmPalSettings.xPosition = 0;
Prefs.bookmPalSettings.yPosition = 0;
Prefs.layerPalSettings.xPosition = 0;
Prefs.layerPalSettings.yPosition = 0;
Prefs.PSize = 40;
Prefs.SaveAtQ = true;
Prefs.ClipMargin = true;
Prefs.GCRMode = true;
Prefs.RecentDocs.clear();
Prefs.RecentDCount = 5;
Prefs.marginColored = false;
Prefs.PageFormat = 4;
Prefs.Ausrichtung = 0;
Prefs.PageBreite = 595;
Prefs.PageHoehe = 842;
Prefs.RandOben = 9;
Prefs.RandUnten = 40;
Prefs.RandLinks = 9;
Prefs.RandRechts = 9;
Prefs.DoppelSeiten = false;
Prefs.ErsteLinks = false;
Prefs.toolSettings.scaleType = true;
Prefs.toolSettings.aspectRatio = true;
Prefs.MinWordLen = 3;
Prefs.HyCount = 2;
Prefs.Language = "";
Prefs.Automatic = true;
Prefs.AutoCheck = false;
Prefs.AutoSave = false;
Prefs.AutoSaveTime = 600000;
Prefs.DisScale = 1.0;
Prefs.DocDir = QDir::homeDirPath();
Prefs.ProfileDir = "";
Prefs.ScriptDir = "";
Prefs.TemplateDir = "";
Prefs.CustomColorSets.clear();
Prefs.PrPr_Mode = false;
Prefs.Gcr_Mode = true;
Prefs.PrPr_AlphaText = false;
Prefs.PrPr_AlphaGraphics = false;
Prefs.PrPr_Transparency = false;
Prefs.PrPr_C = true;
Prefs.PrPr_M = true;
Prefs.PrPr_Y = true;
Prefs.PrPr_K = true;
Prefs.gimp_exe = "gimp";
Prefs.gs_antiGraph = true;
Prefs.gs_antiText = true;
Prefs.gs_exe = "gs";
Prefs.STEcolor = QColor(white);
Prefs.STEfont = font().toString();
Prefs.DCMSset.DefaultMonitorProfile = "";
Prefs.DCMSset.DefaultPrinterProfile = "";
Prefs.DCMSset.DefaultInputProfile = "";
Prefs.DCMSset.DefaultInputProfile2 = "";
Prefs.DCMSset.CMSinUse = false;
Prefs.DCMSset.SoftProofOn = false;
Prefs.DCMSset.GamutCheck = false;
Prefs.DCMSset.BlackPoint = true;
Prefs.DCMSset.DefaultIntentMonitor = 1;
Prefs.DCMSset.DefaultIntentMonitor2 = 1;
Prefs.DCMSset.DefaultIntentPrinter = 0;
Prefs.GFontSub.clear();
Prefs.ScratchLeft = 100;
Prefs.ScratchRight = 100;
Prefs.ScratchTop = 20;
Prefs.ScratchBottom = 20;
struct checkerPrefs checkerSettings;
checkerSettings.ignoreErrors = false;
checkerSettings.autoCheck = true;
checkerSettings.checkGlyphs = true;
checkerSettings.checkOrphans = true;
checkerSettings.checkOverflow = true;
checkerSettings.checkPictures = true;
checkerSettings.checkResolution = true;
checkerSettings.checkTransparency = true;
checkerSettings.checkAnnotations = false;
checkerSettings.checkRasterPDF = true;
checkerSettings.minResolution = 72.0;
Prefs.checkerProfiles.insert( tr("Postscript"), checkerSettings);
Prefs.checkerProfiles.insert( tr("PDF-1.3"), checkerSettings);
checkerSettings.checkTransparency = false;
Prefs.checkerProfiles.insert( tr("PDF-1.4"), checkerSettings);
checkerSettings.checkTransparency = true;
checkerSettings.checkAnnotations = true;
checkerSettings.minResolution = 144.0;
Prefs.checkerProfiles.insert( tr("PDF/X-3"), checkerSettings);
Prefs.curCheckProfile = tr("Postscript");
Prefs.PDF_Optionen.Thumbnails = false;
Prefs.PDF_Optionen.Articles = false;
Prefs.PDF_Optionen.Compress = true;
Prefs.PDF_Optionen.CompressMethod = 0;
Prefs.PDF_Optionen.Quality = 0;
Prefs.PDF_Optionen.RecalcPic = false;
Prefs.PDF_Optionen.Bookmarks = false;
Prefs.PDF_Optionen.PicRes = 300;
Prefs.PDF_Optionen.Version = 14;
Prefs.PDF_Optionen.Resolution = 300;
Prefs.PDF_Optionen.Binding = 0;
Prefs.PDF_Optionen.EmbedList.clear();
Prefs.PDF_Optionen.SubsetList.clear();
Prefs.PDF_Optionen.MirrorH = false;
Prefs.PDF_Optionen.MirrorV = false;
Prefs.PDF_Optionen.RotateDeg = 0;
Prefs.PDF_Optionen.PresentMode = false;
Prefs.PDF_Optionen.Datei = "";
Prefs.PDF_Optionen.PresentVals.clear();
Prefs.PDF_Optionen.UseRGB = true;
Prefs.PDF_Optionen.UseProfiles = false;
Prefs.PDF_Optionen.UseProfiles2 = false;
Prefs.PDF_Optionen.SolidProf = "";
Prefs.PDF_Optionen.SComp = 3;
Prefs.PDF_Optionen.ImageProf = "";
Prefs.PDF_Optionen.PrintProf = "";
Prefs.PDF_Optionen.Info = "";
Prefs.PDF_Optionen.Intent = 0;
Prefs.PDF_Optionen.Intent2 = 0;
Prefs.PDF_Optionen.BleedTop = 0;
Prefs.PDF_Optionen.BleedLeft = 0;
Prefs.PDF_Optionen.BleedRight = 0;
Prefs.PDF_Optionen.BleedBottom = 0;
Prefs.PDF_Optionen.EmbeddedI = false;
Prefs.PDF_Optionen.Encrypt = false;
Prefs.PDF_Optionen.PassOwner = "";
Prefs.PDF_Optionen.PassUser = "";
Prefs.PDF_Optionen.Permissions = -4;
Prefs.PDF_Optionen.UseLPI = false;
Prefs.PDF_Optionen.LPISettings.clear();
}
void ScribusApp::initDefaultValues()
{
dirs = prefsFile->getContext("dirs");
HaveDoc = 0;
singleClose = false;
ScriptRunning = false;
DLLReturn = "";
DLLinput = "";
view = NULL;
doc = NULL;
Buffer2 = "";
UniCinp = false;
UniCinC = 0;
UniCinS = "";
DispX = 10;
DispY = 10;
DocNr = 1;
UmReFaktor = 1.0;
PrinterUsed = false;
PDef.Pname = "";
PDef.Dname = "";
PDef.Command = "";
keyrep = false;
_arrowKeyDown = false;
ClipB = QApplication::clipboard();
PalettesStat[0] = false;
GuidesStat[0] = false;
connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange()));
}
void ScribusApp::initKeyboardShortcuts()
{
//Set up key entries
//CB TODO Need to rewrite this key management stuff.. these would be much simpler done in the action themselves.
//FILE MENU
SetKeyEntry(0, scrActions["fileNew"]->cleanMenuText(), 0, scrActions["fileNew"]->accel(), "fileNew");
SetKeyEntry(1, scrActions["fileOpen"]->cleanMenuText(), 0, scrActions["fileOpen"]->accel(), "fileOpen");
SetKeyEntry(2, scrActions["fileClose"]->cleanMenuText(), 0, scrActions["fileClose"]->accel(), "fileClose");
SetKeyEntry(3, scrActions["fileSave"]->cleanMenuText(), 0, scrActions["fileSave"]->accel(), "fileSave");
SetKeyEntry(4, scrActions["fileSaveAs"]->cleanMenuText(), 0, scrActions["fileSaveAs"]->accel(), "fileSaveAs");
//SetKeyEntry(, scrActions["fileRevert"]->cleanMenuText(), 0, scrActions["fileRevert"]->accel(), "fileRevert");
//SetKeyEntry(, scrActions["fileCollect"]->cleanMenuText(), 0, scrActions["fileCollect"]->accel(), "fileCollect");
SetKeyEntry(6, scrActions["fileDocSetup"]->cleanMenuText(), 0, scrActions["fileDocSetup"]->accel(), "fileDocSetup");
SetKeyEntry(8, scrActions["fileQuit"]->cleanMenuText(), 0, scrActions["fileQuit"]->accel(), "fileQuit");
//Included import & export options
//SetKeyEntry(, scrActions["fileImportText"]->cleanMenuText(), 0, scrActions["fileImportText"]->accel(), "fileImportText");
//SetKeyEntry(, scrActions["fileImportAppendText"]->cleanMenuText(), 0, scrActions["fileImportAppendText"]->accel(), "fileImportAppendText");
//SetKeyEntry(, scrActions["fileImportImage"]->cleanMenuText(), 0, scrActions["fileImportImage"]->accel(), "fileImportImage");
//SetKeyEntry(, scrActions["fileImportPage"]->cleanMenuText(), 0, scrActions["fileImportPage"]->accel(), "fileImportPage");
//SetKeyEntry(, scrActions["fileExportText"]->cleanMenuText(), 0, scrActions["fileExportText"]->accel(), "fileExportText");
//SetKeyEntry(, scrActions["fileExportAsEPS"]->cleanMenuText(), 0, scrActions["fileExportAsEPS"]->accel(), "fileExportAsEPS");
//SetKeyEntry(, scrActions["fileExportAsPDF"]->cleanMenuText(), 0, scrActions["fileExportAsPDF"]->accel(), "fileExportAsPDF");
//EDIT MENU
SetKeyEntry(9, scrActions["editCut"]->cleanMenuText(), 0, scrActions["editCut"]->accel(), "editCut");
SetKeyEntry(10, scrActions["editCopy"]->cleanMenuText(), 0, scrActions["editCopy"]->accel(), "editCopy");
SetKeyEntry(11, scrActions["editPaste"]->cleanMenuText(), 0, scrActions["editPaste"]->accel(), "editPaste");
SetKeyEntry(12, scrActions["editClear"]->cleanMenuText(), 0, scrActions["editClear"]->accel(), "editClear");
SetKeyEntry(13, scrActions["editSelectAll"]->cleanMenuText(), 0, scrActions["editSelectAll"]->accel(), "editSelectAll");
SetKeyEntry(14, scrActions["editColors"]->cleanMenuText(), 0, scrActions["editColors"]->accel(), "editColors");
SetKeyEntry(15, scrActions["editParaStyles"]->cleanMenuText(), 0, scrActions["editParaStyles"]->accel(), "editParaStyles");
SetKeyEntry(16, scrActions["editTemplates"]->cleanMenuText(), 0, scrActions["editTemplates"]->accel(), "editTemplates");
//SetKeyEntry(, scrActions["editSearchReplace"]->cleanMenuText(), 0, scrActions["editSearchReplace"]->accel(), "editSearchReplace");
//SetKeyEntry(, scrActions["editLineStyles"]->cleanMenuText(), 0, scrActions["editLineStyles"]->accel(), "editLineStyles");
//SetKeyEntry(, scrActions["editFonts"]->cleanMenuText(), 0, scrActions["editFonts"]->accel(), "editFonts");
SetKeyEntry(19, tr("Select New Font"), 0, 0);
//ITEM MENU
SetKeyEntry(20, scrActions["itemDuplicate"]->cleanMenuText(), 0, scrActions["itemDuplicate"]->accel(), "itemDuplicate");
SetKeyEntry(21, scrActions["itemMulDuplicate"]->cleanMenuText(), 0, scrActions["itemMulDuplicate"]->accel(), "itemMulDuplicate");
SetKeyEntry(22, scrActions["itemDelete"]->cleanMenuText(), 0, scrActions["itemDelete"]->accel(), "itemDelete");
SetKeyEntry(23, scrActions["itemGroup"]->cleanMenuText(), 0, scrActions["itemGroup"]->accel(), "itemGroup");
SetKeyEntry(24, scrActions["itemUngroup"]->cleanMenuText(), 0, scrActions["itemUngroup"]->accel(), "itemUngroup");
SetKeyEntry(25, scrActions["itemSendToBack"]->cleanMenuText(), 0, scrActions["itemSendToBack"]->accel(), "itemSendToBack");
SetKeyEntry(26, scrActions["itemBringToFront"]->cleanMenuText(), 0, scrActions["itemBringToFront"]->accel(), "itemBringToFront");
SetKeyEntry(27, scrActions["itemLower"]->cleanMenuText(), 0, scrActions["itemLower"]->accel(), "itemLower");
SetKeyEntry(28, scrActions["itemRaise"]->cleanMenuText(), 0, scrActions["itemRaise"]->accel(), "itemRaise");
SetKeyEntry(29, scrActions["itemAlignDist"]->cleanMenuText(), 0, scrActions["itemAlignDist"]->accel(), "itemAlignDist");
SetKeyEntry(67, scrActions["itemLock"]->cleanMenuText(), 0, scrActions["itemLock"]->accel(), "itemLock");
//SetKeyEntry(, scrActions["itemShapeEdit"]->cleanMenuText(), 0, scrActions["itemShapeEdit"]->accel(), "itemShapeEdit");
//CBSetKeyEntry(61, tr("Attach Text to Path"), M_ItemAttachTextToPath, 0);
//SetKeyEntry(, scrActions["itemAttachTextToPath"]->cleanMenuText(), 0, scrActions["itemAttachTextToPath"]->accel(), "itemAttachTextToPath");
//SetKeyEntry(, scrActions["itemDetachTextFromPath"]->cleanMenuText(), 0, scrActions["itemDetachTextFromPath"]->accel(), "itemDetachTextFromPath");
//SetKeyEntry(, scrActions["itemCombinePolygons"]->cleanMenuText(), 0, scrActions["itemCombinePolygons"]->accel(), "itemCombinePolygons");
//SetKeyEntry(, scrActions["itemSplitPolygons"]->cleanMenuText(), 0, scrActions["itemSplitPolygons"]->accel(), "itemSplitPolygons");
//SetKeyEntry(, scrActions["itemConvertToOutlines"]->cleanMenuText(), 0, scrActions["itemConvertToOutlines"]->accel(), "itemConvertToOutlines");
//PAGE MENU
SetKeyEntry(30, scrActions["pageInsert"]->cleanMenuText(), 0, scrActions["pageInsert"]->accel(), "pageInsert");
SetKeyEntry(31, scrActions["pageDelete"]->cleanMenuText(), 0, scrActions["pageDelete"]->accel(), "pageDelete");
SetKeyEntry(32, scrActions["pageMove"]->cleanMenuText(), 0, scrActions["pageMove"]->accel(), "pageMove");
SetKeyEntry(33, scrActions["pageApplyTemplate"]->cleanMenuText(), 0, scrActions["pageApplyTemplate"]->accel(), "pageApplyTemplate");
SetKeyEntry(49, scrActions["pageManageGuides"]->cleanMenuText(), 0, scrActions["pageManageGuides"]->accel(), "pageManageGuides");
SetKeyEntry(61, scrActions["pageCopy"]->cleanMenuText(), 0, scrActions["pageCopy"]->accel(), "pageCopy");
//VIEW MENU
SetKeyEntry(34, scrActions["viewFitInWindow"]->cleanMenuText(), 0, scrActions["viewFitInWindow"]->accel(), "viewFitInWindow");
SetKeyEntry(35, scrActions["viewFit50"]->cleanMenuText(), 0, scrActions["viewFit50"]->accel(), "viewFit50");
SetKeyEntry(36, scrActions["viewFit75"]->cleanMenuText(), 0, scrActions["viewFit75"]->accel(), "viewFit75");
SetKeyEntry(37, scrActions["viewFit100"]->cleanMenuText(), 0, scrActions["viewFit100"]->accel(), "viewFit100");
SetKeyEntry(38, scrActions["viewFit200"]->cleanMenuText(), 0, scrActions["viewFit200"]->accel(), "viewFit200");
SetKeyEntry(39, scrActions["viewFit20"]->cleanMenuText(), 0, scrActions["viewFit20"]->accel(), "viewFit20");
SetKeyEntry(40, scrActions["viewShowMargins"]->cleanMenuText(), 0, scrActions["viewShowMargins"]->accel(), "viewShowMargins");
SetKeyEntry(41, scrActions["viewShowFrames"]->cleanMenuText(), 0, scrActions["viewShowFrames"]->accel(), "viewShowFrames");
SetKeyEntry(42, scrActions["viewShowImages"]->cleanMenuText(), 0, scrActions["viewShowImages"]->accel(), "viewShowImages");
SetKeyEntry(43, scrActions["viewShowGrid"]->cleanMenuText(), 0, scrActions["viewShowGrid"]->accel(), "viewShowGrid");
SetKeyEntry(44, scrActions["viewSnapToGrid"]->cleanMenuText(), 0, scrActions["viewSnapToGrid"]->accel(), "viewSnapToGrid");
//TOOLS MENU
SetKeyEntry(46, scrActions["toolsProperties"]->cleanMenuText(), 0, scrActions["toolsProperties"]->accel(), "toolsProperties");
SetKeyEntry(47, scrActions["toolsOutline"]->cleanMenuText(), 0, scrActions["toolsOutline"]->accel(), "toolsOutline");
SetKeyEntry(48, scrActions["toolsScrapbook"]->cleanMenuText(), 0, scrActions["toolsScrapbook"]->accel(), "toolsScrapbook");
SetKeyEntry(45, scrActions["toolsToolbarTools"]->cleanMenuText(), 0, scrActions["toolsToolbarTools"]->accel(), "toolsToolbarTools");
SetKeyEntry(46, tr("Properties"), viewMpal, 0);
SetKeyEntry(47, tr("Outline"), viewTpal, 0);
SetKeyEntry(48, tr("Scrapbook"), viewBpal, 0);
SetKeyEntry(45, tr("Tools"), toolbarMenuTools, 0);
//SetKeyEntry(55, tr("Tooltips"), tip, 0);
//EXTRAS MENU
SetKeyEntry(51, scrActions["extrasManagePictures"]->cleanMenuText(), 0, scrActions["extrasManagePictures"]->accel(), "extrasManagePictures");
SetKeyEntry(50, scrActions["extrasHyphenateText"]->cleanMenuText(), 0, scrActions["extrasHyphenateText"]->accel(), "extrasHyphenateText");
//HELP MENU
/*
SetKeyEntry(52, tr("About Scribus"), MenID, 0);
SetKeyEntry(53, tr("About Qt"), MenID, 0);
SetKeyEntry(54, tr("Online-Help..."), MenID, 0);
*/
//EXTRAS
SetKeyEntry(56, tr("Smart Hyphen"), 0, CTRL+Key_Minus);
SetKeyEntry(57, tr("Align Left"), 0, CTRL+Key_L);
SetKeyEntry(58, tr("Align Right"), 0, CTRL+Key_R);
SetKeyEntry(59, tr("Align Center"), 0, CTRL+Key_E);
SetKeyEntry(60, tr("Insert Page Number"), 0, CTRL+Key_NumberSign);
SetKeyEntry(62, tr("Show Layers"), viewLpal, 0);
SetKeyEntry(63, scrActions["editJavascripts"]->cleanMenuText(), 0, scrActions["editJavascripts"]->accel(), "editJavascripts");
SetKeyEntry(64, scrActions["editUndoAction"]->cleanMenuText(), 0, scrActions["editUndoAction"]->accel(), "editUndoAction");
SetKeyEntry(65, scrActions["editRedoAction"]->cleanMenuText(), 0, scrActions["editRedoAction"]->accel(), "editRedoAction");
SetKeyEntry(66, tr("Show Page Palette"), viewSepal, 0);
SetKeyEntry(68, tr("Non Breaking Space"), 0, CTRL+Key_Space);
}
void ScribusApp::initArrowStyles()
{
struct ArrowDesc arrow;
FPointArray points;
QWMatrix arrowScaling;
arrowScaling.scale(0.5, 0.5);
arrow.name = "Arrow1L";
arrow.userArrow = false;
points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0);
points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5);
points.addQuadPoint(12, 0, 12, 0, 12, 0, 12, 0);
points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5);
points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "Arrow1M";
points.map(arrowScaling);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "Arrow1S";
points.map(arrowScaling);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "SquareL";
points.resize(0);
points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5);
points.addQuadPoint(5, -5, 5, -5, 5, -5, 5, -5);
points.addQuadPoint(5, 5, 5, 5, 5, 5, 5, 5);
points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5);
points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "SquareM";
points.map(arrowScaling);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "SquareS";
points.map(arrowScaling);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "TriangleInL";
points.resize(0);
points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0);
points.addQuadPoint(-2.88, 5, -2.88, 5, -2.88, 5, -2.88, 5);
points.addQuadPoint(-2.88, -5, -2.88, -5, -2.88, -5, -2.88, -5);
points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "TriangleInM";
points.map(arrowScaling);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "TriangleInS";
points.map(arrowScaling);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "TriangleOutL";
points.resize(0);
points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0);
points.addQuadPoint(2.88, 5, 2.88, 5, 2.88, 5, 2.88, 5);
points.addQuadPoint(2.88, -5, 2.88, -5, 2.88, -5, 2.88, -5);
points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "TriangleOutM";
points.map(arrowScaling);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
arrow.name = "TriangleOutS";
points.map(arrowScaling);
arrow.points = points.copy();
Prefs.arrowStyles.append(arrow);
}
void ScribusApp::initPalettes()
{
Tpal = new Tree(this, 0);
Mpal = new Mpalette(this, &Prefs);
Mpal->Cpal->SetColors(Prefs.DColors);
Mpal->Cpal->UseTrans(true);
Mpal->Fonts->RebuildList(&Prefs, 0);
Npal = new NodePalette(this);
Lpal = new LayerPalette(this);
ScBook = new Biblio(this, &Prefs);
Sepal = new SeitenPal(this);
BookPal = new BookPalette(this);
MaPal = new Measurements(this);
MaPal->hide();
docChecker = new CheckDocument(this, false);
docChecker->hide();
undoPalette = new UndoPalette(this, "undoPalette");
undoManager->registerGui(undoPalette);
connect(undoPalette, SIGNAL(closePalette(bool)), this, SLOT(setUndoPalette(bool)));
connect(MaPal, SIGNAL(Schliessen(bool)), this, SLOT(setMapal(bool)));
connect(Mpal, SIGNAL(DocChanged()), this, SLOT(slotDocCh()));
connect(Mpal, SIGNAL(NewAbStyle(int)), this, SLOT(setNewAbStyle(int)));
connect(Mpal, SIGNAL(BackHome()), this, SLOT(Aktiv()));
connect(Mpal, SIGNAL(Stellung(int)), this, SLOT(setItemHoch(int)));
connect(Mpal, SIGNAL(Schliessen()), this, SLOT(ToggleMpal()));
connect(Mpal, SIGNAL(EditCL()), this, SLOT(ToggleFrameEdit()));
connect(Mpal, SIGNAL(NewTF(QString)), this, SLOT(SetNewFont(QString)));
connect(Mpal, SIGNAL(UpdtGui(int)), this, SLOT(HaveNewSel(int)));
connect(Mpal->Cpal, SIGNAL(NewPen(QString)), this, SLOT(setPenFarbe(QString)));
connect(Mpal->Cpal, SIGNAL(NewBrush(QString)), this, SLOT(setBrushFarbe(QString)));
connect(Mpal->Cpal, SIGNAL(NewPenShade(int)), this, SLOT(setPenShade(int)));
connect(Mpal->Cpal, SIGNAL(NewBrushShade(int)), this, SLOT(setBrushShade(int)));
connect(Mpal->Cpal, SIGNAL(NewTrans(double)), this, SLOT(SetTranspar(double)));
connect(Mpal->Cpal, SIGNAL(NewTransS(double)), this, SLOT(SetTransparS(double)));
connect(Mpal->Cpal, SIGNAL(NewGradient(int)), this, SLOT(setGradFill(int)));
connect(Mpal->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), this, SLOT(updtGradFill()));
connect(Mpal->Cpal, SIGNAL(gradientChanged()), this, SLOT(updtGradFill()));
connect(Mpal->Cpal, SIGNAL(QueryItem()), this, SLOT(GetBrushPen()));
connect(docChecker, SIGNAL(closePal(bool)), this, SLOT(setCheckPal(bool)));
connect(docChecker, SIGNAL(rescan()), this, SLOT(slotCheckDoc()));
connect(docChecker, SIGNAL(selectElement(int, int)), this, SLOT(SelectFromOutl(int, int)));
connect(docChecker, SIGNAL(selectPage(int)), this, SLOT(SelectFromOutlS(int)));
connect(docChecker, SIGNAL(selectTemplatePage(QString)), this, SLOT(ManageTemp(QString)));
connect(Tpal, SIGNAL(Schliessen()), this, SLOT(ToggleTpal()));
connect(Tpal, SIGNAL(CloseMpal()), this, SLOT(ToggleMpal()));
connect(Tpal, SIGNAL(CloseSpal()), this, SLOT(ToggleBpal()));
connect(Tpal, SIGNAL(SelectElement(int, int)), this, SLOT(SelectFromOutl(int, int)));
connect(Tpal, SIGNAL(SelectSeite(int)), this, SLOT(SelectFromOutlS(int)));
connect(Tpal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
connect(Mpal->Spal, SIGNAL(newStyle(int)), this, SLOT(setNewAbStyle(int)));
connect(Mpal, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles()));
connect(Mpal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
connect(Mpal, SIGNAL(CloseTpal()), this, SLOT(ToggleTpal()));
connect(Mpal, SIGNAL(CloseBpal()), this, SLOT(ToggleBpal()));
connect(Npal, SIGNAL(Schliessen()), this, SLOT(NoFrameEdit()));
connect(Lpal, SIGNAL(LayerActivated(int)), this, SLOT(changeLayer(int)));
connect(Lpal, SIGNAL(LayerRemoved(int, bool)), this, SLOT(LayerRemove(int, bool)));
connect(Lpal, SIGNAL(LayerChanged()), this, SLOT(showLayer()));
connect(Lpal, SIGNAL(Schliessen()), this, SLOT(ToggleLpal()));
connect(Lpal->Table, SIGNAL(Schliessen()), this, SLOT(ToggleLpal()));
connect(Lpal->Table, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
connect(Sepal, SIGNAL(Schliessen()), this, SLOT(ToggleSepal()));
connect(Sepal, SIGNAL(EditTemp(QString)), this, SLOT(ManageTemp(QString)));
connect(Sepal->PageView, SIGNAL(UseTemp(QString, int)), this, SLOT(Apply_Temp(QString, int)));
connect(Sepal->PageView, SIGNAL(NewPage(int, QString)), this, SLOT(slotNewPageP(int, QString)));
connect(Sepal->Trash, SIGNAL(DelPage(int)), this, SLOT(DeletePage2(int)));
connect(Sepal, SIGNAL(GotoSeite(int)), this, SLOT(SelectFromOutlS(int)));
connect(Sepal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
connect(BookPal->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks()));
connect(BookPal->BView, SIGNAL(ChangeBMNr(int, int, int)), this, SLOT(ChBookmarks(int, int, int)));
connect(BookPal->BView, SIGNAL(SelectElement(int, int)), this, SLOT(SelectFromOutl(int, int)));
connect(BookPal, SIGNAL(Schliessen()), this, SLOT(ToggleBookpal()));
connect(BookPal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
}
void ScribusApp::initScrapbook()
{
QString scrapbookFile = PrefsPfad+"/scrap13.scs";
QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile);
if (scrapbookFileInfo.exists())
ScBook->BibWin->ReadContents(scrapbookFile);
ScBook->ScFilename = scrapbookFile;
ScBook->AdjustMenu();
connect(ScBook, SIGNAL(Schliessen()), this, SLOT(ToggleBpal()));
connect(ScBook->BibWin, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
connect(ScBook->BibWin, SIGNAL(Schliessen()), this, SLOT(ToggleBpal()));
connect(ScBook->BibWin, SIGNAL(CloseTpal()), this, SLOT(ToggleTpal()));
connect(ScBook->BibWin, SIGNAL(CloseMpal()), this, SLOT(ToggleMpal()));
}
void ScribusApp::initCrashHandler()
{
typedef void (*HandlerType)(int);
HandlerType handler = 0;
handler = ScribusApp::defaultCrashHandler;
if (!handler)
handler = SIG_DFL;
sigset_t mask;
sigemptyset(&mask);
#ifdef SIGSEGV
signal (SIGSEGV, handler);
sigaddset(&mask, SIGSEGV);
#endif
#ifdef SIGFPE
signal (SIGFPE, handler);
sigaddset(&mask, SIGFPE);
#endif
#ifdef SIGILL
signal (SIGILL, handler);
sigaddset(&mask, SIGILL);
#endif
#ifdef SIGABRT
signal (SIGABRT, handler);
sigaddset(&mask, SIGABRT);
#endif
sigprocmask(SIG_UNBLOCK, &mask, 0);
}
const QString ScribusApp::getGuiLanguage()
{
return guiLanguage;
}
/*!
\fn QString ScribusApp::getPreferencesLocation()
\author Craig Bradney
\date Thu 18 Nov 2004
\brief Get the user's preference file location. Rename any existing old preferences files
\param None
\retval QString Location of the user's preferences
*/
QString ScribusApp::getPreferencesLocation()
{
QString Pff = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus");
QFileInfo Pffi = QFileInfo(Pff);
QString PrefsPfad;
//If we are using ~/.scribus
if (Pffi.exists())
{
if (Pffi.isDir())
PrefsPfad = Pff;
else
PrefsPfad = QDir::homeDirPath();
}
else // Move to using ~/.scribus/scribus.* from ~/.scribus.*
{
QDir prefsDirectory = QDir();
prefsDirectory.mkdir(Pff);
PrefsPfad = Pff;
QString oldPR = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus.rc");
QFileInfo oldPi = QFileInfo(oldPR);
if (oldPi.exists())
moveFile(oldPR, Pff+"/scribus.rc");
QString oldPR2 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusfont.rc");
QFileInfo oldPi2 = QFileInfo(oldPR2);
if (oldPi2.exists())
moveFile(oldPR2, Pff+"/scribusfont.rc");
QString oldPR3 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusscrap.scs");
QFileInfo oldPi3 = QFileInfo(oldPR3);
if (oldPi3.exists())
moveFile(oldPR3, Pff+"/scrap.scs");
}
//Now make copies for 1.3 use and leave the old ones alone for <1.3.0 usage
QString oldPR =QDir::convertSeparators(PrefsPfad+"/scribus.rc");
QString oldPR2=QDir::convertSeparators(PrefsPfad+"/scribusfont.rc");
QString oldPR3=QDir::convertSeparators(PrefsPfad+"/scrap.scs");
QString oldPR4=QDir::convertSeparators(PrefsPfad+"/prefs.xml");
QString oldPR5=QDir::convertSeparators(PrefsPfad+"/scripter.rc");
QString newPR =QDir::convertSeparators(PrefsPfad+"/scribus13.rc");
QString newPR2=QDir::convertSeparators(PrefsPfad+"/scribusfont13.rc");
QString newPR3=QDir::convertSeparators(PrefsPfad+"/scrap13.scs");
QString newPR4=QDir::convertSeparators(PrefsPfad+"/prefs13.xml");
QString newPR5=QDir::convertSeparators(PrefsPfad+"/scripter13.rc");
bool existsOldPR =QFile::exists(oldPR);
bool existsOldPR2=QFile::exists(oldPR2);
bool existsOldPR3=QFile::exists(oldPR3);
bool existsOldPR4=QFile::exists(oldPR4);
bool existsOldPR5=QFile::exists(oldPR5);
bool existsNewPR =QFile::exists(newPR);
bool existsNewPR2=QFile::exists(newPR2);
bool existsNewPR3=QFile::exists(newPR3);
bool existsNewPR4=QFile::exists(newPR4);
bool existsNewPR5=QFile::exists(newPR5);
//Only check for these two as they will be autocreated if they dont exist.
if( (existsOldPR && !existsNewPR) || (existsOldPR4 && !existsNewPR4) )
{
if (splashScreen)
splashScreen->hide();
if ( (QMessageBox::question( this, 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 )
{
if (existsOldPR && !existsNewPR)
copyFile(oldPR, newPR);
if (existsOldPR2 && !existsNewPR2)
copyFile(oldPR2, newPR2);
if (existsOldPR3 && !existsNewPR3)
copyFile(oldPR3, newPR3);
if (existsOldPR4 && !existsNewPR4)
copyFile(oldPR4, newPR4);
if (existsOldPR5 && !existsNewPR5)
copyFile(oldPR5, newPR5);
}
if (splashScreen)
splashScreen->show();
}
return PrefsPfad;
}
/*!
\fn QString ScribusApp::convertToXMLPreferences(QString prefsLocation)
\author Craig Bradney
\date Sun 09 Jan 2005
\brief Convert 1.2 prefs to 1.3 prefs
\param prefsLocation Location of user preferences
\retval None
*/
void ScribusApp::convertToXMLPreferences(const QString prefsLocation)
{
}
void ScribusApp::initFileMenuActions()
{
//File Menu
scrActions.insert("fileNew", new ScrAction(QIconSet(loadIcon("DateiNeu16.png"), loadIcon("DateiNeu.xpm")), tr("&New"), CTRL+Key_N, this, "fileNew"));
scrActions.insert("fileOpen", new ScrAction(QIconSet(loadIcon("DateiOpen16.png"), loadIcon("DateiOpen.xpm")), tr("&Open..."), CTRL+Key_O, this, "fileOpen"));
scrActions.insert("fileClose", new ScrAction(QIconSet(loadIcon("DateiClos16.png"), loadIcon("DateiClose.png")), tr("&Close"), CTRL+Key_W, this, "fileClose"));
scrActions.insert("fileSave", new ScrAction(QIconSet(loadIcon("DateiSave16.png"), loadIcon("DateiSave2.png")), tr("&Save"), CTRL+Key_S, this, "fileSave"));
scrActions.insert("fileSaveAs", new ScrAction(QPixmap(loadIcon("filesaveas.png")), tr("Save &As..."), QKeySequence(), this, "fileSaveAs"));
scrActions.insert("fileRevert", new ScrAction(QPixmap(loadIcon("revert.png")), tr("Re&vert to Saved"), QKeySequence(), this, "fileRevert"));
scrActions.insert("fileCollect", new ScrAction(tr("Collect for O&utput..."), QKeySequence(), this, "fileCollect"));
//File Import Menu
scrActions.insert("fileImportText", new ScrAction(tr("Get Text..."), QKeySequence(), this, "fileImportText"));
scrActions.insert("fileImportAppendText", new ScrAction(tr("Append &Text..."), QKeySequence(), this, "fileImportAppendText"));
scrActions.insert("fileImportImage", new ScrAction(tr("Get Image..."), QKeySequence(), this, "fileImportImage"));
scrActions.insert("fileImportEPS", new ScrAction(tr("Import EPS..."), QKeySequence(), this, "fileImportEPS"));
scrActions.insert("fileImportPage", new ScrAction(tr("Import Page(s)..."), QKeySequence(), this, "fileImportPage"));
scrActions.insert("fileImportOOorgDraw", new ScrAction(tr("Import OpenOffice.org Draw..."), QKeySequence(), this, "fileImportOOorgDraw"));
scrActions.insert("fileImportSVG", new ScrAction(tr("Import SVG..."), QKeySequence(), this, "fileImportSVG"));
//File Export Menu
scrActions.insert("fileExportText", new ScrAction(tr("Save &Text..."), QKeySequence(), this, "fileExportText"));
scrActions.insert("fileExportAsEPS", new ScrAction(tr("Save Page as &EPS..."), QKeySequence(), this, "fileExportAsEPS"));
scrActions.insert("fileExportAsPDF", new ScrAction(loadIcon("acrobat.png"), tr("Save as P&DF..."), QKeySequence(), this, "fileExportAsPDF"));
scrActions.insert("fileExportAsImage", new ScrAction(tr("Save as &Image..."), QKeySequence(), this, "fileExportAsImage"));
scrActions.insert("fileExportAsSVG", new ScrAction(tr("Save Page as &SVG..."), QKeySequence(), this, "fileExportAsSVG"));
//Rest of File Menu
scrActions.insert("fileDocInfo", new ScrAction(loadIcon("documentinfo.png"), tr("Document &Information..."), CTRL+Key_I, this, "fileDocSetup"));
scrActions.insert("fileDocSetup", new ScrAction(tr("Document &Setup..."), QKeySequence(), this, "fileDocSetup"));
scrActions.insert("filePrint", new ScrAction(QIconSet(loadIcon("DateiPrint16.png"), loadIcon("DateiPrint.xpm")), tr("&Print..."), CTRL+Key_P, this, "filePrint"));
scrActions.insert("fileQuit", new ScrAction(QPixmap(loadIcon("exit.png")), tr("&Quit"), CTRL+Key_Q, this, "fileQuit"));
//Set some tooltips, unsure yet whether to use these, probably not as they arent flexible like normal actions ones can be
/*
scrActions["fileNew"]->setToolTip(tr("Create a new document"));
scrActions["fileOpen"]->setToolTip(tr("Open a document"));
scrActions["fileSave"]->setToolTip(tr("Save the current document"));
scrActions["fileClose"]->setToolTip(tr("Close the current document"));
scrActions["filePrint"]->setToolTip(tr("Print the current document"));
scrActions["fileExportAsPDF"]->setToolTip(tr("Save the current document as PDF"));
*/
//Connect our signals and slots
//File Menu
connect( scrActions["fileNew"], SIGNAL(activated()) , this, SLOT(slotFileNew()) );
connect( scrActions["fileOpen"], SIGNAL(activated()) , this, SLOT(slotDocOpen()) );
connect( scrActions["fileClose"], SIGNAL(activated()) , this, SLOT(slotFileClose()) );
connect( scrActions["filePrint"], SIGNAL(activated()) , this, SLOT(slotFilePrint()) );
connect( scrActions["fileSave"], SIGNAL(activated()) , this, SLOT(slotFileSave()) );
connect( scrActions["fileSave"], SIGNAL(activated()) , this, SLOT(slotFileSave()) );
connect( scrActions["fileSaveAs"], SIGNAL(activated()) , this, SLOT(slotFileSaveAs()) );
connect( scrActions["fileDocInfo"], SIGNAL(activated()) , this, SLOT(InfoDoc()) );
connect( scrActions["fileDocSetup"], SIGNAL(activated()) , this, SLOT(SetupDoc()) );
connect( scrActions["fileRevert"], SIGNAL(activated()) , this, SLOT(slotFileRevert()) );
connect( scrActions["fileCollect"], SIGNAL(activated()) , this, SLOT(Collect()) );
connect( scrActions["fileQuit"], SIGNAL(activated()) , this, SLOT(slotFileQuit()) );
//File Import Menu
connect( scrActions["fileImportText"], SIGNAL(activated()) , this, SLOT(slotFileOpen()) );
connect( scrActions["fileImportAppendText"], SIGNAL(activated()) , this, SLOT(slotFileAppend()) );
connect( scrActions["fileImportImage"], SIGNAL(activated()) , this, SLOT(slotFileOpen()) );
connect( scrActions["fileImportPage"], SIGNAL(activated()) , this, SLOT(slotDocMerge()) );
//File Export Menu
connect( scrActions["fileExportText"], SIGNAL(activated()) , this, SLOT(SaveText()) );
connect( scrActions["fileExportAsEPS"], SIGNAL(activated()) , this, SLOT(SaveAsEps()) );
connect( scrActions["fileExportAsPDF"], SIGNAL(activated()) , this, SLOT(SaveAsPDF()) );
//The rest are plugins
}
void ScribusApp::initEditMenuActions()
{
//Edit Menu
scrActions.insert("editUndoAction", new ScrAction(ScrAction::DataInt, QIconSet(loadIcon("u_undo16.png"), loadIcon("u_undo.png")), tr("&Undo"), CTRL+Key_Z, this, "editUndo",1));
scrActions.insert("editRedoAction", new ScrAction(ScrAction::DataInt, QIconSet(loadIcon("u_redo16.png"), loadIcon("u_redo.png")), tr("&Redo"), CTRL+SHIFT+Key_Z, this, "editRedo", 1));
scrActions.insert("editActionMode", new ScrAction(tr("&Item Action Mode"), QKeySequence(), this, "editActionMode"));
scrActions.insert("editCut", new ScrAction(QIconSet(loadIcon("editcut.png"), loadIcon("editcut.png")), tr("Cu&t"), CTRL+Key_X, this, "editCut"));
scrActions.insert("editCopy", new ScrAction(QIconSet(loadIcon("editcopy.png"), loadIcon("editcopy.png")), tr("&Copy"), CTRL+Key_C, this, "editCopy"));
scrActions.insert("editPaste", new ScrAction(QIconSet(loadIcon("editpaste.png"), loadIcon("editpaste.png")), tr("&Paste"), CTRL+Key_V, this, "editPaste"));
scrActions.insert("editClear", new ScrAction(QIconSet(loadIcon("editClear.png"), loadIcon("editClear.png")), tr("C&lear"), QKeySequence(), this, "editClear"));
scrActions.insert("editSelectAll", new ScrAction(tr("Select &All"), CTRL+Key_A, this, "editSelectall"));
scrActions.insert("editSearchReplace", new ScrAction(QIconSet(loadIcon("find16.png"), loadIcon("find16.png")), tr("&Search/Replace..."), QKeySequence(), this, "editSearchReplace"));
scrActions.insert("editColors", new ScrAction(tr("C&olors..."), QKeySequence(), this, "editColors"));
scrActions.insert("editParaStyles", new ScrAction(tr("&Paragraph Styles..."), QKeySequence(), this, "editParaStyles"));
scrActions.insert("editLineStyles", new ScrAction(tr("&Line Styles..."), QKeySequence(), this, "editLineStyles"));
scrActions.insert("editTemplates", new ScrAction(tr("&Templates..."), QKeySequence(), this, "editTemplates"));
scrActions.insert("editJavascripts", new ScrAction(tr("&Javascripts..."), QKeySequence(), this, "editJavascripts"));
scrActions.insert("editPreferences", new ScrAction(tr("P&references..."), QKeySequence(), this, "editPreferences"));
connect( scrActions["editUndoAction"], SIGNAL(activatedData(int)) , undoManager, SLOT(undo(int)) );
connect( scrActions["editRedoAction"], SIGNAL(activatedData(int)) , undoManager, SLOT(redo(int)) );
//TODO connect( scrActions["editActionMode"], SIGNAL(activated()) , this, SLOT(RedoAction()) );
connect( scrActions["editCut"], SIGNAL(activated()) , this, SLOT(slotEditCut()) );
connect( scrActions["editCopy"], SIGNAL(activated()) , this, SLOT(slotEditCopy()) );
connect( scrActions["editPaste"], SIGNAL(activated()) , this, SLOT(slotEditPaste()) );
connect( scrActions["editClear"], SIGNAL(activated()) , this, SLOT(DeleteText()) );
connect( scrActions["editSelectAll"], SIGNAL(activated()) , this, SLOT(SelectAll()) );
connect( scrActions["editSearchReplace"], SIGNAL(activated()), this, SLOT(SearchText()) );
connect( scrActions["editColors"], SIGNAL(activated()) , this, SLOT(slotEditColors()) );
connect( scrActions["editParaStyles"], SIGNAL(activated()) , this, SLOT(slotEditStyles()) );
connect( scrActions["editLineStyles"], SIGNAL(activated()) , this, SLOT(slotEditLineStyles()) );
connect( scrActions["editTemplates"], SIGNAL(activated()) , this, SLOT(ManageTemp()) );
connect( scrActions["editJavascripts"], SIGNAL(activated()) , this, SLOT(ManageJava()) );
connect( scrActions["editPreferences"], SIGNAL(activated()) , this, SLOT(slotPrefsOrg()) );
}
void ScribusApp::initStyleMenuActions()
{
//Text Size actions
scrActionGroups.insert("fontSize", new QActionGroup(this, "fontSize", true));
scrActions.insert("fontSizeOther", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Other..."), QKeySequence(), scrActionGroups["fontSize"], "fontSizeOther", -1));
connect(scrActions["fontSizeOther"], SIGNAL(activatedData(int)), this, SLOT(setItemFSize(int)));
int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};
size_t f_size = sizeof(font_sizes) / sizeof(*font_sizes);
for (uint s = 0; s < f_size; ++s)
{
QString fontSizeName=QString("fontSize%1").arg(font_sizes[s]);
scrActions.insert(fontSizeName, new ScrAction(ScrAction::DataInt, QIconSet(), tr("%1 pt").arg(font_sizes[s]), QKeySequence(), scrActionGroups["fontSize"], fontSizeName, font_sizes[s]));
scrActions[fontSizeName]->setToggleAction(true);
connect(scrActions[fontSizeName], SIGNAL(activatedData(int)), this, SLOT(setItemFSize(int)));
}
//Alignment actions
scrActions.insert("alignLeft", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Left"), QKeySequence(), scrActionGroups["alignment"], "alignLeft", 0));
scrActions.insert("alignCenter", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Center"), QKeySequence(), scrActionGroups["alignment"], "alignCenter", 1));
scrActions.insert("alignRight", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Right"), QKeySequence(), scrActionGroups["alignment"], "alignRight", 2));
scrActions.insert("alignBlock", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Block"), QKeySequence(), scrActionGroups["alignment"], "alignBlock", 3));
scrActions.insert("alignForced", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Forced"), QKeySequence(), scrActionGroups["alignment"], "alignForced", 4));
scrActions["alignLeft"]->setToggleAction(true);
scrActions["alignCenter"]->setToggleAction(true);
scrActions["alignRight"]->setToggleAction(true);
scrActions["alignBlock"]->setToggleAction(true);
scrActions["alignForced"]->setToggleAction(true);
connect(scrActions["alignLeft"], SIGNAL(activatedData(int)), this, SLOT(setNewAbStyle(int)));
connect(scrActions["alignCenter"], SIGNAL(activatedData(int)), this, SLOT(setNewAbStyle(int)));
connect(scrActions["alignRight"], SIGNAL(activatedData(int)), this, SLOT(setNewAbStyle(int)));
connect(scrActions["alignBlock"], SIGNAL(activatedData(int)), this, SLOT(setNewAbStyle(int)));
connect(scrActions["alignForced"], SIGNAL(activatedData(int)), this, SLOT(setNewAbStyle(int)));
//Shade actions
scrActionGroups.insert("shade", new QActionGroup(this, "shade", true));
scrActions.insert("shadeOther", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Other..."), QKeySequence(), scrActionGroups["shade"], "shadeOther", -1));
connect(scrActions["shadeOther"], SIGNAL(activatedData(int)), this, SLOT(setItemShade(int)));
for (uint i=0; i<=100 ; i+=10)
{
QString shadeName=QString("shade%1").arg(i);
scrActions.insert(shadeName, new ScrAction(ScrAction::DataInt, QIconSet(), tr("&%1 %").arg(i), QKeySequence(), scrActionGroups["shade"], shadeName, i));
scrActions[shadeName]->setToggleAction(true);
connect(scrActions[shadeName], SIGNAL(activatedData(int)), this, SLOT(setItemShade(int)));
}
//Type Effects actions
scrActionGroups.insert("typeEffects", new QActionGroup(this, "typeEffects", false));
scrActions.insert("typeEffectNormal", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Normal"), QKeySequence(), scrActionGroups["typeEffects"], "typeEffectNormal", 0));
scrActions.insert("typeEffectUnderline", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Underline"), QKeySequence(), scrActionGroups["typeEffects"], "typeEffectUnderline", 1));
scrActions.insert("typeEffectStrikeThrough", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Strike Through"), QKeySequence(), scrActionGroups["typeEffects"], "typeEffectStrikeThrough", 2));
scrActions.insert("typeEffectSmallCaps", new ScrAction(ScrAction::DataInt, QIconSet(), tr("Small &Caps"), QKeySequence(), scrActionGroups["typeEffects"], "typeEffectSmallCaps", 3));
scrActions.insert("typeEffectSuperscript", new ScrAction(ScrAction::DataInt, QIconSet(), tr("Su&perscript"), QKeySequence(), scrActionGroups["typeEffects"], "typeEffectSuperscript", 4));
scrActions.insert("typeEffectSubscript", new ScrAction(ScrAction::DataInt, QIconSet(), tr("Su&bscript"), QKeySequence(), scrActionGroups["typeEffects"], "typeEffectSubscript", 5));
scrActions.insert("typeEffectOutline", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Outline"), QKeySequence(), scrActionGroups["typeEffects"], "typeEffectOutline", 6));
scrActions["typeEffectNormal"]->setToggleAction(true);
scrActions["typeEffectUnderline"]->setToggleAction(true);
scrActions["typeEffectStrikeThrough"]->setToggleAction(true);
scrActions["typeEffectSmallCaps"]->setToggleAction(true);
scrActions["typeEffectSuperscript"]->setToggleAction(true);
scrActions["typeEffectSubscript"]->setToggleAction(true);
scrActions["typeEffectOutline"]->setToggleAction(true);
connect(scrActions["typeEffectNormal"], SIGNAL(activatedData(int)), this, SLOT(setItemTypeStyle(int)));
connect(scrActions["typeEffectUnderline"], SIGNAL(activatedData(int)), this, SLOT(setItemTypeStyle(int)));
connect(scrActions["typeEffectStrikeThrough"], SIGNAL(activatedData(int)), this, SLOT(setItemTypeStyle(int)));
connect(scrActions["typeEffectSmallCaps"], SIGNAL(activatedData(int)), this, SLOT(setItemTypeStyle(int)));
connect(scrActions["typeEffectSuperscript"], SIGNAL(activatedData(int)), this, SLOT(setItemTypeStyle(int)));
connect(scrActions["typeEffectSubscript"], SIGNAL(activatedData(int)), this, SLOT(setItemTypeStyle(int)));
connect(scrActions["typeEffectOutline"], SIGNAL(activatedData(int)), this, SLOT(setItemTypeStyle(int)));
//Other Style menu items that get added in various places
scrActions.insert("styleInvertPict", new ScrAction(tr("&Invert"), QKeySequence(), this, "styleInvertPict"));
scrActions.insert("styleTabulators", new ScrAction(tr("&Tabulators..."), QKeySequence(), this, "styleTabulators"));
connect(scrActions["styleInvertPict"], SIGNAL(activated()), this, SLOT(InvertPict()));
connect(scrActions["styleTabulators"], SIGNAL(activated()), this, SLOT(EditTabs()));
}
void ScribusApp::initItemMenuActions()
{
//Item Menu
scrActions.insert("itemDuplicate", new ScrAction(tr("D&uplicate"), CTRL+Key_D, this, "itemDuplicate"));
scrActions.insert("itemMulDuplicate", new ScrAction(tr("&Multiple Duplicate"), QKeySequence(), this, "itemMulDuplicate"));
scrActions.insert("itemDelete", new ScrAction(tr("&Delete"), CTRL+Key_K, this, "itemDelete"));
scrActions.insert("itemGroup", new ScrAction(tr("&Group"), CTRL+Key_G, this, "itemGroup"));
scrActions.insert("itemUngroup", new ScrAction(tr("&Ungroup"), CTRL+Key_U, this, "itemUngroup"));
scrActions.insert("itemLock", new ScrAction(tr("Is &Locked"), CTRL+Key_F, this, "itemLock"));
scrActions["itemLock"]->setToggleAction(true);
scrActions.insert("itemSendToBack", new ScrAction(tr("Send to &Back"), QKeySequence(), this, "itemSendToBack"));
scrActions.insert("itemBringToFront", new ScrAction(tr("Bring to &Front"), QKeySequence(), this, "itemBringToFront"));
scrActions.insert("itemLower", new ScrAction(tr("&Lower"), QKeySequence(), this, "itemLower"));
scrActions.insert("itemRaise", new ScrAction(tr("&Raise"), QKeySequence(), this, "itemRaise"));
scrActions.insert("itemAlignDist", new ScrAction(tr("Distribute/&Align..."), QKeySequence(), this, "itemAlignDist"));
scrActions.insert("itemShapeEdit", new ScrAction(tr("&Edit Shape..."), QKeySequence(), this, "itemShapeEdit"));
scrActions["itemShapeEdit"]->setToggleAction(true);
scrActions.insert("itemAttachTextToPath", new ScrAction(tr("&Attach Text to Path"), QKeySequence(), this, "itemAttachTextToPath"));
scrActions.insert("itemDetachTextFromPath", new ScrAction(tr("&Detach Text from Path"), QKeySequence(), this, "itemDetachTextFromPath"));
scrActions.insert("itemCombinePolygons", new ScrAction(tr("&Combine Polygons"), QKeySequence(), this, "itemCombinePolygons"));
scrActions.insert("itemSplitPolygons", new ScrAction(tr("Split &Polygons"), QKeySequence(), this, "itemSplitPolygons"));
scrActions.insert("itemConvertToOutlines", new ScrAction(tr("C&onvert to Outlines"), QKeySequence(), this, "itemConvertToOutlines"));
connect( scrActions["itemDuplicate"], SIGNAL(activated()) , this, SLOT(ObjektDup()) );
connect( scrActions["itemMulDuplicate"], SIGNAL(activated()) , this, SLOT(ObjektDupM()) );
connect( scrActions["itemDelete"], SIGNAL(activated()) , this, SLOT(DeleteObjekt()) );
connect( scrActions["itemGroup"], SIGNAL(activated()) , this, SLOT(GroupObj()) );
connect( scrActions["itemUngroup"], SIGNAL(activated()) , this, SLOT(UnGroupObj()) );
connect( scrActions["itemLock"], SIGNAL(activated()) , this, SLOT(ToggleObjLock()) );
connect( scrActions["itemSendToBack"], SIGNAL(activated()) , this, SLOT(Objekt2Back()) );
connect( scrActions["itemBringToFront"], SIGNAL(activated()) , this, SLOT(Objekt2Front()) );
connect( scrActions["itemLower"], SIGNAL(activated()) , this, SLOT(ObjektLower()) );
connect( scrActions["itemRaise"], SIGNAL(activated()) , this, SLOT(ObjektRaise()) );
connect( scrActions["itemAlignDist"], SIGNAL(activated()) , this, SLOT(ObjektAlign()) );
connect( scrActions["itemShapeEdit"], SIGNAL(activated()) , this, SLOT(ToggleFrameEdit()) );
connect( scrActions["itemAttachTextToPath"], SIGNAL(activated()) , this, SLOT(Pfadtext()) );
connect( scrActions["itemDetachTextFromPath"], SIGNAL(activated()) , this, SLOT(noPfadtext()) );
connect( scrActions["itemCombinePolygons"], SIGNAL(activated()) , this, SLOT(UniteOb()) );
connect( scrActions["itemSplitPolygons"], SIGNAL(activated()) , this, SLOT(SplitUniteOb()) );
connect( scrActions["itemConvertToOutlines"], SIGNAL(activated()) , this, SLOT(TraceText()) );
}
void ScribusApp::initPageMenuActions()
{
//Page menu
scrActions.insert("pageInsert", new ScrAction(tr("&Insert..."), QKeySequence(), this, "PageInsert"));
scrActions.insert("pageDelete", new ScrAction(tr("&Delete..."), QKeySequence(), this, "pageDelete"));
scrActions.insert("pageCopy", new ScrAction(tr("&Copy..."), QKeySequence(), this, "pageCopy"));
scrActions.insert("pageMove", new ScrAction(tr("&Move..."), QKeySequence(), this, "pageMove"));
scrActions.insert("pageApplyTemplate", new ScrAction(tr("&Apply Template..."), QKeySequence(), this, "pageApplyTemplate"));
scrActions.insert("pageManageGuides", new ScrAction(tr("Manage &Guides..."), QKeySequence(), this, "pageManageGuides"));
connect( scrActions["pageInsert"], SIGNAL(activated()) , this, SLOT(slotNewPageM()) );
connect( scrActions["pageDelete"], SIGNAL(activated()) , this, SLOT(DeletePage()) );
connect( scrActions["pageCopy"], SIGNAL(activated()) , this, SLOT(CopyPage()) );
connect( scrActions["pageMove"], SIGNAL(activated()) , this, SLOT(MovePage()) );
connect( scrActions["pageApplyTemplate"], SIGNAL(activated()) , this, SLOT(ApplyTemp()) );
connect( scrActions["pageManageGuides"], SIGNAL(activated()) , this, SLOT(ManageGuides()) );
}
void ScribusApp::initViewMenuActions()
{
scrActions.insert("viewFitInWindow", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&Fit in window"), CTRL+Key_0, this, "viewFitInWindow", 0, -100.0));
scrActions.insert("viewFit50", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&50%"), QKeySequence(), this, "viewFit50", 0, 50.0));
scrActions.insert("viewFit75", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&75%"), QKeySequence(), this, "viewFit75", 0, 75.0));
scrActions.insert("viewFit100", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&100%"), CTRL+Key_1, this, "viewFit100", 0, 100.0));
scrActions.insert("viewFit200", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&200%"), QKeySequence(), this, "viewFit200", 0, 200.0));
scrActions.insert("viewFit20", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&Thumbnails"), QKeySequence(), this, "viewFit20", 0, 20.0));
scrActions.insert("viewShowMargins", new ScrAction(tr("Show &Margins"), QKeySequence(), this, "viewShowMargins"));
scrActions.insert("viewShowFrames", new ScrAction(tr("Show &Frames"), QKeySequence(), this, "viewShowFrames"));
scrActions.insert("viewShowImages", new ScrAction(tr("Show &Images"), QKeySequence(), this, "viewShowImages"));
scrActions.insert("viewShowGrid", new ScrAction(tr("Show &Grid"), QKeySequence(), this, "viewShowGrid"));
scrActions.insert("viewShowGuides", new ScrAction(tr("Show G&uides"), QKeySequence(), this, "viewShowGuides"));
scrActions.insert("viewShowBaseline", new ScrAction(tr("Show &Baseline Grid"), QKeySequence(), this, "viewShowBaseline"));
scrActions.insert("viewShowTextChain", new ScrAction(tr("Show &Text Chain"), QKeySequence(), this, "viewShowTextChain"));
scrActions.insert("viewSnapToGrid", new ScrAction(tr("Sn&ap to Grid"), QKeySequence(), this, "viewSnapToGrid"));
scrActions.insert("viewSnapToGuides", new ScrAction(tr("Sna&p to Guides"), QKeySequence(), this, "viewSnapToGuides"));
// scrActions.insert("viewNewView", new ScrAction(tr("New View"), QKeySequence(), this, "viewNewView"));
scrActions["viewShowMargins"]->setToggleAction(true);
scrActions["viewShowFrames"]->setToggleAction(true);
scrActions["viewShowImages"]->setToggleAction(true);
scrActions["viewShowGrid"]->setToggleAction(true);
scrActions["viewShowGuides"]->setToggleAction(true);
scrActions["viewShowBaseline"]->setToggleAction(true);
scrActions["viewShowTextChain"]->setToggleAction(true);
scrActions["viewSnapToGrid"]->setToggleAction(true);
scrActions["viewSnapToGuides"]->setToggleAction(true);
scrActions["viewShowMargins"]->setOn(true);
scrActions["viewShowFrames"]->setOn(true);
scrActions["viewShowImages"]->setOn(true);
scrActions["viewShowGuides"]->setOn(true);
connect( scrActions["viewFitInWindow"], SIGNAL(activatedData(double)) , this, SLOT(slotZoom(double)) );
connect( scrActions["viewFit50"], SIGNAL(activatedData(double)) , this, SLOT(slotZoom(double)) );
connect( scrActions["viewFit75"], SIGNAL(activatedData(double)) , this, SLOT(slotZoom(double)) );
connect( scrActions["viewFit100"], SIGNAL(activatedData(double)) , this, SLOT(slotZoom(double)) );
connect( scrActions["viewFit200"], SIGNAL(activatedData(double)) , this, SLOT(slotZoom(double)) );
connect( scrActions["viewFit20"], SIGNAL(activatedData(double)) , this, SLOT(slotZoom(double)) );
connect( scrActions["viewShowMargins"], SIGNAL(activated()) , this, SLOT(ToggleMarks()) );
connect( scrActions["viewShowFrames"], SIGNAL(activated()) , this, SLOT(ToggleFrames()) );
connect( scrActions["viewShowImages"], SIGNAL(activated()) , this, SLOT(TogglePics()) );
connect( scrActions["viewShowGrid"], SIGNAL(activated()) , this, SLOT(ToggleRaster()) );
connect( scrActions["viewShowGuides"], SIGNAL(activated()) , this, SLOT(ToggleGuides()) );
connect( scrActions["viewShowBaseline"], SIGNAL(activated()) , this, SLOT(ToggleBase()) );
connect( scrActions["viewShowTextChain"], SIGNAL(activated()) , this, SLOT(ToggleTextLinks()) );
connect( scrActions["viewSnapToGrid"], SIGNAL(activated()) , this, SLOT(ToggleURaster()) );
connect( scrActions["viewSnapToGuides"], SIGNAL(activated()) , this, SLOT(ToggleUGuides()) );
// connect( scrActions["viewNewView"], SIGNAL(activated()) , this, SLOT(newView()) );
}
void ScribusApp::initToolsMenuActions()
{
//Tool menu
scrActions.insert("toolsProperties", new ScrAction(tr("&Properties"), QKeySequence(), this, "toolsProperties"));
scrActions.insert("toolsOutline", new ScrAction(tr("&Outline"), QKeySequence(), this, "toolsOutline"));
scrActions.insert("toolsScrapbook", new ScrAction(tr("&Scrapbook"), QKeySequence(), this, "toolsScrapbook"));
scrActions.insert("toolsLayers", new ScrAction(tr("&Layers"), QKeySequence(), this, "toolsLayers"));
scrActions.insert("toolsPages", new ScrAction(tr("P&age Palette"), QKeySequence(), this, "toolsPages"));
scrActions.insert("toolsBookmarks", new ScrAction(tr("&Bookmarks"), QKeySequence(), this, "toolsBookmarks"));
scrActions.insert("toolsActionHistory", new ScrAction(tr("Action &History"), QKeySequence(), this, "toolsActionHistory"));
scrActions.insert("toolsPreflightVerifier", new ScrAction(QIconSet(loadIcon("launch16.png"), loadIcon("launch.png")),tr("Preflight &Verifier"), QKeySequence(), this, "toolsPreflightVerifier"));
scrActions.insert("toolsToolbarTools", new ScrAction(tr("&Tools"), QKeySequence(), this, "toolsToolbarTools"));
scrActions.insert("toolsToolbarPDF", new ScrAction(tr("P&DF Tools"), QKeySequence(), this, "toolsToolbarPDF"));
scrActions["toolsProperties"]->setToggleAction(true);
scrActions["toolsOutline"]->setToggleAction(true);
scrActions["toolsScrapbook"]->setToggleAction(true);
scrActions["toolsLayers"]->setToggleAction(true);
scrActions["toolsPages"]->setToggleAction(true);
scrActions["toolsBookmarks"]->setToggleAction(true);
scrActions["toolsActionHistory"]->setToggleAction(true);
scrActions["toolsPreflightVerifier"]->setToggleAction(true);
scrActions["toolsToolbarTools"]->setToggleAction(true);
scrActions["toolsToolbarPDF"]->setToggleAction(true);
connect( scrActions["toolsProperties"], SIGNAL(activated()) , this, SLOT(ToggleMpal()) );
connect( scrActions["toolsOutline"], SIGNAL(activated()) , this, SLOT(ToggleTpal()) );
connect( scrActions["toolsScrapbook"], SIGNAL(activated()) , this, SLOT(ToggleBpal()) );
connect( scrActions["toolsLayers"], SIGNAL(activated()) , this, SLOT(ToggleLpal()) );
connect( scrActions["toolsPages"], SIGNAL(activated()) , this, SLOT(ToggleSepal()) );
connect( scrActions["toolsBookmarks"], SIGNAL(activated()) , this, SLOT(ToggleBookpal()) );
connect( scrActions["toolsActionHistory"], SIGNAL(activated()) , this, SLOT(ToggleUndoPalette()) );
connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , this, SLOT(toggleCheckPal(bool)) );
connect( scrActions["toolsToolbarTools"], SIGNAL(activated()) , this, SLOT(ToggleTools()) );
connect( scrActions["toolsToolbarPDF"], SIGNAL(activated()) , this, SLOT(TogglePDFTools()) );
}
void ScribusApp::initExtrasMenuActions()
{
scrActions.insert("extrasManagePictures", new ScrAction(tr("&Manage Pictures"), QKeySequence(), this, "extrasManagePictures"));
scrActions.insert("extrasHyphenateText", new ScrAction(tr("&Hyphenate Text"), QKeySequence(), this, "extrasHyphenateText"));
scrActions.insert("extrasInsertSpecial", new ScrAction(tr("&Insert Special"), QKeySequence(), this, "extrasInsertSpecial"));
connect( scrActions["extrasManagePictures"], SIGNAL(activated()) , this, SLOT(StatusPic()) );
connect( scrActions["extrasHyphenateText"], SIGNAL(activated()) , this, SLOT(doHyphenate()) );
connect( scrActions["extrasInsertSpecial"], SIGNAL(activated()) , this, SLOT(slotCharSelect()) );
}
void ScribusApp::initWindowsMenuActions()
{
}
void ScribusApp::initScriptMenuActions()
{
}
void ScribusApp::initHelpMenuActions()
{
scrActions.insert("helpAboutScribus", new ScrAction(tr("&About Scribus"), QKeySequence(), this, "helpAboutScribus"));
scrActions.insert("helpAboutQt", new ScrAction(tr("About &Qt"), QKeySequence(), this, "helpAboutQt"));
scrActions.insert("helpTooltips", new ScrAction(tr("Toolti&ps"), QKeySequence(), this, "helpTooltips"));
scrActions.insert("helpManual", new ScrAction(tr("Scribus &Manual..."), QKeySequence(), this, "helpManual"));
scrActions["helpTooltips"]->setToggleAction(true);
scrActions["helpTooltips"]->setOn(true);
connect( scrActions["helpAboutScribus"], SIGNAL(activated()) , this, SLOT(slotHelpAbout()) );
connect( scrActions["helpAboutQt"], SIGNAL(activated()) , this, SLOT(slotHelpAboutQt()) );
connect( scrActions["helpTooltips"], SIGNAL(activated()) , this, SLOT(ToggleTips()) );
connect( scrActions["helpManual"], SIGNAL(activated()) , this, SLOT(slotOnlineHelp()) );
}
void ScribusApp::initMenuBar()
{
QFont tmp;
RecentDocs.clear();
scrMenuMgr->createMenu("File", tr("&File"));
scrMenuMgr->addMenuItem(scrActions["fileNew"], "File");
scrMenuMgr->addMenuItem(scrActions["fileOpen"], "File");
recentFileMenuName="FileOpenRecent";
scrMenuMgr->createMenu(recentFileMenuName, tr("Open &Recent"), "File");
scrMenuMgr->addMenuSeparator("File");
scrMenuMgr->addMenuItem(scrActions["fileClose"], "File");
scrMenuMgr->addMenuItem(scrActions["fileSave"], "File");
scrMenuMgr->addMenuItem(scrActions["fileSaveAs"], "File");
scrMenuMgr->addMenuItem(scrActions["fileRevert"], "File");
scrMenuMgr->addMenuItem(scrActions["fileCollect"], "File");
scrMenuMgr->addMenuSeparator("File");
scrMenuMgr->createMenu("FileImport", tr("&Import"), "File");
scrMenuMgr->addMenuItem(scrActions["fileImportText"], "FileImport");
scrMenuMgr->addMenuItem(scrActions["fileImportAppendText"], "FileImport");
scrMenuMgr->addMenuItem(scrActions["fileImportImage"], "FileImport");
scrMenuMgr->addMenuItem(scrActions["fileImportPage"], "FileImport");
scrMenuMgr->createMenu("FileExport", tr("&Export"), "File");
scrMenuMgr->addMenuItem(scrActions["fileExportText"], "FileExport");
scrMenuMgr->addMenuItem(scrActions["fileExportAsEPS"], "FileExport");
scrMenuMgr->addMenuItem(scrActions["fileExportAsPDF"], "FileExport");
scrMenuMgr->addMenuSeparator("File");
scrMenuMgr->addMenuItem(scrActions["fileDocInfo"], "File");
scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File");
scrMenuMgr->addMenuItem(scrActions["filePrint"], "File");
scrMenuMgr->addMenuSeparator("File");
scrMenuMgr->addMenuItem(scrActions["fileQuit"], "File");
scrActions["fileClose"]->setEnabled(false);
scrActions["fileSave"]->setEnabled(false);
scrActions["fileSaveAs"]->setEnabled(false);
scrActions["fileRevert"]->setEnabled(false);
scrActions["fileCollect"]->setEnabled(false);
scrActions["fileImportText"]->setEnabled(false);
scrActions["fileImportImage"]->setEnabled(false);
scrActions["fileImportAppendText"]->setEnabled(false);
scrActions["fileImportPage"]->setEnabled(false);
scrActions["fileExportText"]->setEnabled(false);
scrActions["fileExportAsEPS"]->setEnabled(false);
scrActions["fileExportAsPDF"]->setEnabled(false);
scrMenuMgr->setMenuEnabled("FileExport", false);
scrActions["fileDocInfo"]->setEnabled(false);
scrActions["fileDocSetup"]->setEnabled(false);
scrActions["filePrint"]->setEnabled(false);
scrMenuMgr->createMenu("Edit", tr("&Edit"));
scrMenuMgr->addMenuItem(scrActions["editUndoAction"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editRedoAction"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editActionMode"], "Edit");
scrMenuMgr->addMenuSeparator("Edit");
scrMenuMgr->addMenuItem(scrActions["editCut"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editCopy"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editPaste"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editClear"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editSelectAll"], "Edit");
scrMenuMgr->addMenuSeparator("Edit");
scrMenuMgr->addMenuItem(scrActions["editSearchReplace"], "Edit");
scrMenuMgr->addMenuSeparator("Edit");
scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editParaStyles"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editLineStyles"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editTemplates"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editJavascripts"], "Edit");
scrMenuMgr->addMenuSeparator("Edit");
scrMenuMgr->addMenuItem(scrActions["editPreferences"], "Edit");
scrActions["editUndoAction"]->setEnabled(false);
scrActions["editRedoAction"]->setEnabled(false);
scrActions["editActionMode"]->setEnabled(false);
scrActions["editCut"]->setEnabled(false);
scrActions["editCopy"]->setEnabled(false);
scrActions["editPaste"]->setEnabled(false);
scrActions["editClear"]->setEnabled(false);
scrActions["editSelectAll"]->setEnabled(false);
scrActions["editSearchReplace"]->setEnabled(false);
scrActions["editParaStyles"]->setEnabled(false);
scrActions["editLineStyles"]->setEnabled(false);
scrActions["editTemplates"]->setEnabled(false);
scrActions["editJavascripts"]->setEnabled(false);
//Style Menu
scrMenuMgr->createMenu("Style", tr("St&yle"));
//Item Menu
scrMenuMgr->createMenu("Item", tr("&Item"));
scrMenuMgr->addMenuItem(scrActions["itemDuplicate"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemMulDuplicate"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemDelete"], "Item");
scrMenuMgr->addMenuSeparator("Item");
scrMenuMgr->addMenuItem(scrActions["itemGroup"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemUngroup"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemLock"], "Item");
scrMenuMgr->addMenuSeparator("Item");
scrMenuMgr->addMenuItem(scrActions["itemSendToBack"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemBringToFront"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemLower"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemRaise"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemAlignDist"], "Item");
scrMenuMgr->addMenuSeparator("Item");
scrMenuMgr->createMenu("ItemShapes", tr("&Shape"), "Item");
// CB TODO
//Shape menu
SCustom = new Autoforms(0);
scrMenuMgr->addMenuItem(SCustom, "ItemShapes");
connect(SCustom, SIGNAL(FormSel(int, int, double *)), this, SLOT(MakeFrame(int, int, double *)));
scrMenuMgr->addMenuItem(scrActions["itemShapeEdit"], "ItemShapes");
scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemSplitPolygons"], "Item");
scrMenuMgr->addMenuItem(scrActions["itemConvertToOutlines"], "Item");
scrMenuMgr->setMenuEnabled("ItemShapes", false);
scrActions["itemAlignDist"]->setEnabled(false);
scrActions["itemGroup"]->setEnabled(false);
scrActions["itemUngroup"]->setEnabled(false);
scrActions["itemAttachTextToPath"]->setEnabled(false);
scrActions["itemDetachTextFromPath"]->setEnabled(false);
scrActions["itemCombinePolygons"]->setEnabled(false);
scrActions["itemSplitPolygons"]->setEnabled(false);
scrActions["itemLock"]->setEnabled(false);
scrActions["itemConvertToOutlines"]->setEnabled(false);
//Page menu
scrMenuMgr->createMenu("Page", tr("&Page"));
scrMenuMgr->addMenuItem(scrActions["pageInsert"], "Page");
scrMenuMgr->addMenuItem(scrActions["pageDelete"], "Page");
scrMenuMgr->addMenuItem(scrActions["pageCopy"], "Page");
scrMenuMgr->addMenuItem(scrActions["pageMove"], "Page");
scrMenuMgr->addMenuItem(scrActions["pageApplyTemplate"], "Page");
scrMenuMgr->addMenuItem(scrActions["pageManageGuides"], "Page");
scrActions["pageDelete"]->setEnabled(false);
scrActions["pageMove"]->setEnabled(false);
//View menu
scrMenuMgr->createMenu("View", tr("&View"));
scrMenuMgr->addMenuItem(scrActions["viewFitInWindow"], "View");
scrMenuMgr->addMenuItem(scrActions["viewFit50"], "View");
scrMenuMgr->addMenuItem(scrActions["viewFit75"], "View");
scrMenuMgr->addMenuItem(scrActions["viewFit100"], "View");
scrMenuMgr->addMenuItem(scrActions["viewFit200"], "View");
scrMenuMgr->addMenuItem(scrActions["viewFit20"], "View");
scrMenuMgr->addMenuSeparator("View");
scrMenuMgr->addMenuItem(scrActions["viewShowMargins"], "View");
scrMenuMgr->addMenuItem(scrActions["viewShowFrames"], "View");
scrMenuMgr->addMenuItem(scrActions["viewShowImages"], "View");
scrMenuMgr->addMenuItem(scrActions["viewShowGrid"], "View");
scrMenuMgr->addMenuItem(scrActions["viewShowGuides"], "View");
scrMenuMgr->addMenuItem(scrActions["viewShowBaseline"], "View");
scrMenuMgr->addMenuItem(scrActions["viewShowTextChain"], "View");
scrMenuMgr->addMenuSeparator("View");
scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "View");
scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "View");
// scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View");
//Tool menu
scrMenuMgr->createMenu("Tools", tr("&Tools"));
scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Tools");
scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Tools");
scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Tools");
scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Tools");
scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Tools");
scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Tools");
scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Tools");
scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Tools");
scrMenuMgr->addMenuSeparator("Tools");
scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Tools");
scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Tools");
//scrActions["toolsPreflightVerifier"]->setEnabled(false);
//Extra menu
scrMenuMgr->createMenu("Extras", tr("E&xtras"));
scrMenuMgr->addMenuItem(scrActions["extrasManagePictures"], "Extras");
scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras");
scrMenuMgr->addMenuItem(scrActions["extrasInsertSpecial"], "Extras");
scrMenuMgr->setMenuEnabled("Extras", false);
scrActions["extrasHyphenateText"]->setEnabled(false);
scrActions["extrasInsertSpecial"]->setEnabled(false);
//Window menu
scrMenuMgr->createMenu("Windows", tr("&Windows"));
connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow()));
//Help menu
scrMenuMgr->createMenu("Help", tr("&Help"));
scrMenuMgr->addMenuItem(scrActions["helpAboutScribus"], "Help");
scrMenuMgr->addMenuItem(scrActions["helpAboutQt"], "Help");
scrMenuMgr->addMenuSeparator("Help");
scrMenuMgr->addMenuItem(scrActions["helpTooltips"], "Help");
scrMenuMgr->addMenuItem(scrActions["helpManual"], "Help");
scrMenuMgr->addMenuToMenuBar("File");
scrMenuMgr->addMenuToMenuBar("Edit");
scrMenuMgr->addMenuToMenuBar("Style");
scrMenuMgr->setMenuEnabled("Style", false);
scrMenuMgr->addMenuToMenuBar("Item");
scrMenuMgr->addMenuToMenuBar("Page");
scrMenuMgr->setMenuEnabled("Item", false);
scrMenuMgr->setMenuEnabled("Page", false);
scrMenuMgr->addMenuToMenuBar("View");
scrMenuMgr->setMenuEnabled("View", false);
scrMenuMgr->addMenuToMenuBar("Tools");
scrMenuMgr->addMenuToMenuBar("Extras");
scrMenuMgr->setMenuEnabled("Extras", false);
scrMenuMgr->addMenuToMenuBar("Windows");
scrMenuMgr->setMenuEnabled("Windows", false);
menuBar()->insertSeparator();
scrMenuMgr->addMenuToMenuBar("Help");
//Alignment menu
scrMenuMgr->createMenu("Alignment", tr("&Alignment"));
scrMenuMgr->addMenuItem(scrActions["alignLeft"], "Alignment");
scrMenuMgr->addMenuItem(scrActions["alignCenter"], "Alignment");
scrMenuMgr->addMenuItem(scrActions["alignRight"], "Alignment");
scrMenuMgr->addMenuItem(scrActions["alignBlock"], "Alignment");
scrMenuMgr->addMenuItem(scrActions["alignForced"], "Alignment");
//Color menu
scrMenuMgr->createMenu("ItemShapes", tr("&Shape"), "Item");
// CB TODO
scrMenuMgr->createMenu("Color", tr("&Color"));
ColorMenC = new QComboBox(false);
ColorMenC->setEditable(false);
scrMenuMgr->addMenuItem(ColorMenC, "Color");
//Text size menu
scrMenuMgr->createMenu("FontSize", tr("&Size"));
scrActionGroups["fontSize"]->addTo(scrMenuMgr->getLocalPopupMenu("FontSize"));
//Shade menu
scrMenuMgr->createMenu("Shade", tr("&Shade"));
scrActionGroups["shade"]->addTo(scrMenuMgr->getLocalPopupMenu("Shade"));
//Font menu
scrMenuMgr->createMenu("Font", tr("&Font"));
FontMenu = scrMenuMgr->getLocalPopupMenu("Font");
//Type style menu
scrMenuMgr->createMenu("TypeEffects", tr("&Effects"));
scrActionGroups["typeEffects"]->addTo(scrMenuMgr->getLocalPopupMenu("TypeEffects"));
connect(undoManager, SIGNAL(newAction(UndoObject*, UndoState*)),
this, SLOT(refreshUndoRedoItems()));
connect(undoManager, SIGNAL(undoRedoDone()), this, SLOT(refreshUndoRedoItems()));
connect(ColorMenC, SIGNAL(activated(int)), this, SLOT(setItemFarbe(int)));
connect(FontMenu, SIGNAL(activated(int)), this, SLOT(setItemFont(int)));
}
void ScribusApp::initStatusBar()
{
FMess = new QLabel( " ", statusBar(), "ft");
FProg = new QProgressBar(statusBar(), "p");
FProg->setCenterIndicator(true);
FProg->setFixedWidth( 100 );
FProg->reset();
XMess = new QLabel( tr("X-Pos:"), statusBar(), "xt");
YMess = new QLabel( tr("Y-Pos:"), statusBar(), "yt");
XDat = new QLabel( " ", statusBar(), "dt");
YDat = new QLabel( " ", statusBar(), "ydt");
statusBar()->addWidget(FMess, 3, true);
statusBar()->addWidget(FProg, 0, true);
statusBar()->addWidget(XMess, 0, true);
statusBar()->addWidget(XDat, 1, true);
statusBar()->addWidget(YMess, 0, true);
statusBar()->addWidget(YDat, 1, true);
}
void ScribusApp::ReportMP(double xp, double yp)
{
QString suffix=unitGetSuffixFromIndex(doc->docUnitIndex);
int multiplier=unitGetDecimalsFromIndex(doc->docUnitIndex);
double divisor = static_cast<double>(multiplier);
int precision=precision = unitGetPrecisionFromIndex(doc->docUnitIndex);
QString tmp;
XDat->setText(tmp.setNum(qRound(xp*UmReFaktor * multiplier) / divisor, 'f', precision) + suffix);
YDat->setText(tmp.setNum(qRound(yp*UmReFaktor * multiplier) / divisor, 'f', precision) + suffix);
}
void ScribusApp::SetKeyEntry(int Nr, QString text, int Men, int KeyC, QString actName)
{
Keys ke;
ke.Name = text;
ke.MenuID = Men;
ke.KeyID = KeyC;
if (actName!="")
{
if (scrActions[actName])
ke.actionName=actName;
else
qDebug(QString("Action Name: %1 does not exist").arg(actName));
}
Prefs.KeyActions.insert(Nr, ke);
}
void ScribusApp::DeleteSel(PageItem *b)
{
int FirstSel = 0;
bool first = false;
for (ScText *it = b->itemText.first(); it != 0; it = b->itemText.next())
{
if (it->cselect)
{
first = true;
b->itemText.remove();
it = b->itemText.prev();
if (it == 0)
it = b->itemText.first();
}
if (!first)
FirstSel++;
}
if (b->itemText.count() != 0)
{
if (b->itemText.first()->cselect)
{
b->itemText.remove();
b->CPos = 0;
}
else
b->CPos = FirstSel;
}
else
b->CPos = 0;
b->HasSel = false;
DisableTxEdit();
}
void ScribusApp::setTBvals(PageItem *b)
{
if (b->itemText.count() != 0)
{
int ChPos = QMIN(b->CPos, static_cast<int>(b->itemText.count()-1));
doc->CurrentStyle = b->itemText.at(ChPos)->cstyle & 127;
doc->currentParaStyle = b->itemText.at(ChPos)->cab;
setAbsValue(doc->currentParaStyle);
Mpal->setAli(doc->currentParaStyle);
doc->CurrFont = b->itemText.at(ChPos)->cfont;
doc->CurrFontSize = b->itemText.at(ChPos)->csize;
doc->CurrTextFill = b->itemText.at(ChPos)->ccolor;
doc->CurrTextFillSh = b->itemText.at(ChPos)->cshade;
doc->CurrTextStroke = b->itemText.at(ChPos)->cstroke;
doc->CurrTextStrokeSh = b->itemText.at(ChPos)->cshade2;
doc->CurrTextScale = b->itemText.at(ChPos)->cscale;
emit TextFarben(doc->CurrTextStroke, doc->CurrTextFill, doc->CurrTextStrokeSh, doc->CurrTextFillSh);
emit TextIFont(doc->CurrFont);
emit TextISize(doc->CurrFontSize);
emit TextUSval(b->itemText.at(ChPos)->cextra);
emit TextStil(doc->CurrentStyle);
emit TextScale(doc->CurrTextScale);
}
}
void ScribusApp::wheelEvent(QWheelEvent *w)
{
if (HaveDoc)
{
if ((w->orientation() != Qt::Vertical) || ( w->state() & ShiftButton ))
{
if (w->delta() < 0)
view->scrollBy(Prefs.Wheelval, 0);
else
view->scrollBy(-Prefs.Wheelval, 0);
}
else
{
if (w->delta() < 0)
view->scrollBy(0, Prefs.Wheelval);
else
view->scrollBy(0, -Prefs.Wheelval);
}
w->accept();
}
}
void ScribusApp::keyPressEvent(QKeyEvent *k)
{
QWidgetList windows;
QWidget* w = NULL;
struct ScText *hg;
int kk = k->key();
int as = k->ascii();
double altx, alty;
QString uc = k->text();
QString cr, Tcha, Twort;
uint Tcoun;
int len, pos, c;
if (keyrep)
return;
keyrep = true;
switch (k->state())
{
case ShiftButton:
KeyMod = 0x00200000;
break;
case AltButton:
KeyMod = 0x00800000;
break;
case ControlButton:
KeyMod = 0x00400000;
break;
default:
KeyMod = 0;
break;
}
if (kk == Key_F10)
{
keyrep = false;
ToggleAllPalettes();
return;
}
if ((kk == Key_F11) && (HaveDoc))
{
keyrep = false;
ToggleAllGuides();
return;
}
if ((kk == Key_Escape) && (HaveDoc))
{
keyrep = false;
PageItem *b;
if ((view->SelItem.count() != 0))
{
b = view->SelItem.at(0);
switch (doc->appMode)
{
case NormalMode:
b->Sizing = false;
if (doc->SubMode != -1)
{
view->Deselect(false);
// if (!doc->TemplateMode)
// Tpal->slotRemoveElement(doc->currentPage->PageNr, b->ItemNr);
doc->Items.remove(b->ItemNr);
}
break;
case LinkFrames:
case UnlinkFrames:
case EditMode:
break;
case DrawBezierLine:
b->PoLine.resize(b->PoLine.size()-2);
if (b->PoLine.size() < 4)
{
view->Deselect(false);
// if (!doc->TemplateMode)
// Tpal->slotRemoveElement(doc->currentPage->PageNr, b->ItemNr);
doc->Items.remove(b->ItemNr);
}
else
{
view->SizeItem(b->PoLine.WidthHeight().x(), b->PoLine.WidthHeight().y(), b->ItemNr, false, false);
view->SetPolyClip(b, qRound(QMAX(b->Pwidth / 2, 1)));
view->AdjustItemSize(b);
b->ContourLine = b->PoLine.copy();
b->ClipEdited = true;
b->FrameType = 3;
slotDocCh();
}
view->FirstPoly = true;
break;
default:
view->Deselect(false);
// if (!doc->TemplateMode)
// Tpal->slotRemoveElement(doc->currentPage->PageNr, b->ItemNr);
doc->Items.remove(b->ItemNr);
break;
}
}
view->Mpressed = false;
doc->DragP = false;
doc->leaveDrag = false;
view->Imoved = false;
view->mCG = false;
view->MidButt = false;
doc->SubMode = -1;
NoFrameEdit();
slotSelect();
return;
}
ButtonState buttonState = k->state();
if ((HaveDoc) && (!view->LE->hasFocus()) && (!view->PGS->PageCombo->hasFocus()))
{
if ((doc->appMode != EditMode) && (view->SelItem.count() == 0))
{
switch (kk)
{
case Key_Space:
keyrep = false;
if (doc->appMode == PanningMode)
setAppMode(NormalMode);
else
{
setAppMode(PanningMode);
qApp->setOverrideCursor(QCursor(loadIcon("HandC.xpm")), true);
}
return;
break;
case Key_Prior:
view->scrollBy(0, -Prefs.Wheelval);
keyrep = false;
return;
break;
case Key_Next:
view->scrollBy(0, Prefs.Wheelval);
keyrep = false;
return;
break;
case Key_Tab:
keyrep = false;
windows = wsp->windowList();
if (windows.count() > 1)
{
for (int i = 0; i < static_cast<int>(windows.count()); ++i)
{
if (wsp->activeWindow() == windows.at(i))
{
if (i == static_cast<int>(windows.count()-1))
w = windows.at(0);
else
w = windows.at(i+1);
break;
}
}
doc->OpenNodes = Tpal->buildReopenVals();
docChecker->clearErrorList();
if ( w )
w->showNormal();
newActWin(w);
}
return;
break;
}
}
if (view->SelItem.count() != 0)
{
PageItem *b = view->SelItem.at(0);
if (kk == Key_F9)
{
keyrep = false;
if (doc->appMode == EditMode)
setAppMode(NormalMode);
else
setAppMode(EditMode);
return;
}
switch (doc->appMode)
{
case NormalMode:
switch (kk)
{
case Key_Backspace:
case Key_Delete:
if (!doc->EditClip)
view->DeleteItem();
break;
case Key_Prior:
if (!b->Locked)
view->RaiseItem();
break;
case Key_Next:
if (!b->Locked)
view->LowerItem();
break;
case Key_Left:
if (!b->Locked)
{
if ( buttonState & ShiftButton )
view->moveGroup(-10, 0);
else if ( buttonState & ControlButton )
view->moveGroup(-0.1, 0);
else
view->moveGroup(-1, 0);
}
break;
case Key_Right:
if (!b->Locked)
{
if ( buttonState & ShiftButton )
view->moveGroup(10, 0);
else if ( buttonState & ControlButton )
view->moveGroup(0.1, 0);
else
view->moveGroup(1, 0);
}
break;
case Key_Up:
if (!b->Locked)
{
if ( buttonState & ShiftButton )
view->moveGroup(0, -10);
else if ( buttonState & ControlButton )
view->moveGroup(0, -0.1);
else
view->moveGroup(0, -1);
}
break;
case Key_Down:
if (!b->Locked)
{
if ( buttonState & ShiftButton )
view->moveGroup(0, 10);
else if ( buttonState & ControlButton )
view->moveGroup(0, 0.1);
else
view->moveGroup(0, 1);
}
break;
default:
if (b->PType == 4)
{
if ((kk + KeyMod) == Prefs.KeyActions[59].KeyID)
{
setNewAbStyle(1);
b->Tinput = true;
view->RefreshItem(b);
}
if ((kk + KeyMod) == Prefs.KeyActions[58].KeyID)
{
setNewAbStyle(2);
b->Tinput = true;
view->RefreshItem(b);
}
if ((kk + KeyMod) == Prefs.KeyActions[57].KeyID)
{
setNewAbStyle(0);
b->Tinput = true;
view->RefreshItem(b);
}
}
break;
}
slotDocCh();
break;
case EditMode:
int oldPos = b->CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key
view->oldCp = b->CPos;
if (b->PType == 2)
{
switch (kk)
{
case Key_Left:
if (!b->Locked)
{
if ( buttonState & ShiftButton )
view->MoveItemI(-10, 0, b->ItemNr, true);
else if ( buttonState & ControlButton )
view->MoveItemI(-0.1, 0, b->ItemNr, true);
else
view->MoveItemI(-1, 0, b->ItemNr, true);
}
break;
case Key_Right:
if (!b->Locked)
{
if ( buttonState & ShiftButton )
view->MoveItemI(10, 0, b->ItemNr, true);
else if ( buttonState & ControlButton )
view->MoveItemI(0.1, 0, b->ItemNr, true);
else
view->MoveItemI(1, 0, b->ItemNr, true);
}
break;
case Key_Up:
if (!b->Locked)
{
if ( buttonState & ShiftButton )
view->MoveItemI(0, -10, b->ItemNr, true);
else if ( buttonState & ControlButton )
view->MoveItemI(0, -0.1, b->ItemNr, true);
else
view->MoveItemI(0, -1, b->ItemNr, true);
}
break;
case Key_Down:
if (!b->Locked)
{
if ( buttonState & ShiftButton )
view->MoveItemI(0, 10, b->ItemNr, true);
else if ( buttonState & ControlButton )
view->MoveItemI(0, 0.1, b->ItemNr, true);
else
view->MoveItemI(0, 1, b->ItemNr, true);
}
break;
}
}
if (b->PType == 4)
{
view->slotDoCurs(false);
switch (kk)
{
case Key_Prior:
case Key_Next:
case Key_End:
case Key_Home:
case Key_Right:
case Key_Left:
case Key_Up:
case Key_Down:
if ( (buttonState & ShiftButton) == 0 )
view->deselectAll(b);
}
if (UniCinp)
{
int conv = 0;
bool ok = false;
UniCinS += uc;
conv = UniCinS.toInt(&ok, 16);
if (!ok)
{
UniCinp = false;
UniCinC = 0;
UniCinS = "";
keyrep = false;
return;
}
UniCinC++;
if (UniCinC == 4)
{
UniCinp = false;
UniCinC = 0;
UniCinS = "";
if (ok)
{
if (b->HasSel)
DeleteSel(b);
if (conv < 31)
conv = 32;
hg = new ScText;
hg->ch = QString(QChar(conv));
hg->cfont = doc->CurrFont;
hg->csize = doc->CurrFontSize;
hg->ccolor = doc->CurrTextFill;
hg->cshade = doc->CurrTextFillSh;
hg->cstroke = doc->CurrTextStroke;
hg->cshade2 = doc->CurrTextStrokeSh;
hg->cscale = doc->CurrTextScale;
hg->cselect = false;
hg->cstyle = doc->CurrentStyle;
hg->cab = doc->currentParaStyle;
if (doc->docParagraphStyles[doc->currentParaStyle].Font != "")
{
hg->cfont = doc->docParagraphStyles[doc->currentParaStyle].Font;
hg->csize = doc->docParagraphStyles[doc->currentParaStyle].FontSize;
}
hg->cextra = 0;
hg->xp = 0;
hg->yp = 0;
hg->PRot = 0;
hg->PtransX = 0;
hg->PtransY = 0;
b->itemText.insert(b->CPos, hg);
b->CPos += 1;
b->Tinput = true;
setTBvals(b);
view->RefreshItem(b);
keyrep = false;
return;
}
}
else
{
keyrep = false;
return;
}
}
switch (kk)
{
case Key_F12:
UniCinp = true;
UniCinC = 0;
UniCinS = "";
keyrep = false;
return;
break;
case Key_Home:
// go to begin of line
if ( (pos = b->CPos) == 0 )
break; // at begin of frame
len = static_cast<int>(b->itemText.count());
if ( pos == len )
pos--;
if ( (buttonState & ControlButton) == 0 )
{
alty = b->itemText.at(pos)->yp;
c = b->itemText.at(pos)->ch.at(0).latin1();
if ( c == 13 ) // new line, position is wrong
if ( --pos > 0 )
alty = b->itemText.at(pos)->yp;
// check for yp at actual position
if ( pos < len )
{
altx = b->itemText.at(pos)->yp;
if ( altx > alty )
{
// we was at begin of line
break;
}
}
while ( pos > 0 && b->itemText.at(pos-1)->yp == alty )
pos--;
if ( b->itemText.at(pos)->ch.at(0).latin1() == 13 )
pos++;
}
else
{
// paragraph begin
if ( pos < len &&
b->itemText.at(pos)->ch.at(0).latin1() == 13 )
pos--;
while(pos > 0 )
if ( b->itemText.at(pos)->ch.at(0).latin1() == 13 )
{
pos++;
break;
}
else
pos--;
}
b->CPos = pos;
if ( buttonState & ShiftButton )
view->ExpandSel(b, -1, oldPos);
break;
case Key_End:
// go to end of line
len = static_cast<int>(b->itemText.count());
if ( b->CPos >= len )
break; // at end of frame
if ( (buttonState & ControlButton) == 0 )
{
if ((b->CPos < len) && ((b->itemText.at(b->CPos)->ch.at(0).latin1() == 13) || (b->itemText.at(b->CPos)->ch.at(0).latin1() == 28)))
{
// at end of paragraph and therefore line
break;
}
alty = b->itemText.at(b->CPos)->yp;
while ( b->CPos < len-1 && b->itemText.at(b->CPos+1)->yp == alty )
b->CPos++;
if ( b->CPos < len -1 )
c = b->itemText.at(b->CPos+1)->ch.at(0).latin1();
else if ( b->CPos == len - 1 )
c = 13;
else
c = 0;
if (( c == 13 ) || (c = 28))
b->CPos++;
}
else
{
// go to end of paragraph
if ( b->itemText.at(b->CPos)->ch.at(0).latin1() == 13 )
{
break;
}
pos = b->CPos;
while ( pos < len )
{
if ( b->itemText.at(pos)->ch.at(0).latin1() == 13 )
break;
else
pos++;
}
b->CPos = pos;
}
if ( buttonState & ShiftButton )
view->ExpandSel(b, 1, oldPos);
break;
case Key_Down:
if (b->CPos != static_cast<int>(b->itemText.count()))
{
alty = b->itemText.at(b->CPos)->yp;
altx = b->itemText.at(b->CPos)->xp;
do
{
b->CPos += 1;
if (b->CPos == static_cast<int>(b->itemText.count()))
break;
if (b->itemText.at(b->CPos)->yp > alty)
{
if (b->itemText.at(b->CPos)->xp >= altx)
break;
}
}
while (b->CPos < static_cast<int>(b->itemText.count()));
if ( buttonState & ShiftButton )
{
if ( buttonState & AltButton )
b->CPos = b->itemText.count();
view->ExpandSel(b, 1, oldPos);
}
else
if (b->CPos == static_cast<int>(b->itemText.count()))
if (b->NextBox != 0)
{
if (b->NextBox->itemText.count() != 0)
{
view->Deselect(true);
b->NextBox->CPos = 0;
view->SelectItemNr(b->NextBox->ItemNr);
b = b->NextBox;
}
}
}
else
{
if (b->NextBox != 0)
{
if (b->NextBox->itemText.count() != 0)
{
view->Deselect(true);
b->NextBox->CPos = 0;
view->SelectItemNr(b->NextBox->ItemNr);
b = b->NextBox;
}
}
}
if ( b->HasSel )
view->RefreshItem(b);
setTBvals(b);
break;
case Key_Up:
if (b->CPos > 0)
{
if (b->CPos == static_cast<int>(b->itemText.count()))
b->CPos -= 1;
alty = b->itemText.at(b->CPos)->yp;
altx = b->itemText.at(b->CPos)->xp;
if (b->CPos > 0)
{
do
{
b->CPos -= 1;
if (b->CPos == 0)
break;
if (b->itemText.at(b->CPos)->yp < alty)
{
if (b->itemText.at(b->CPos)->xp <= altx)
break;
}
}
while (b->CPos > 0);
}
if ( buttonState & ShiftButton )
{
if ( buttonState & AltButton )
b->CPos = 0;
view->ExpandSel(b, -1, oldPos);
}
else
if (b->CPos == 0)
{
if (b->BackBox != 0)
{
view->Deselect(true);
b->BackBox->CPos = b->BackBox->itemText.count();
view->SelectItemNr(b->BackBox->ItemNr);
b = b->BackBox;
}
}
}
else
{
b->CPos = 0;
if (b->BackBox != 0)
{
view->Deselect(true);
b->BackBox->CPos = b->BackBox->itemText.count();
view->SelectItemNr(b->BackBox->ItemNr);
b = b->BackBox;
}
}
if ( b->HasSel )
view->RefreshItem(b);
setTBvals(b);
break;
case Key_Prior:
b->CPos = 0;
if ( buttonState & ShiftButton )
view->ExpandSel(b, -1, oldPos);
setTBvals(b);
break;
case Key_Next:
b->CPos = static_cast<int>(b->itemText.count());
if ( buttonState & ShiftButton )
view->ExpandSel(b, 1, oldPos);
setTBvals(b);
break;
case Key_Left:
if ( buttonState & ControlButton )
{
view->setNewPos(b, oldPos, b->itemText.count(),-1);
if ( buttonState & ShiftButton )
view->ExpandSel(b, -1, oldPos);
}
else if ( buttonState & ShiftButton )
{
b->CPos--;
if ( b->CPos < 0 )
b->CPos = 0;
else
view->ExpandSel(b, -1, oldPos);
}
else
{
b->CPos -= 1;
if (b->CPos < 0)
{
b->CPos = 0;
if (b->BackBox != 0)
{
view->Deselect(true);
b->BackBox->CPos = b->BackBox->itemText.count();
view->SelectItemNr(b->BackBox->ItemNr);
b = b->BackBox;
}
}
}
if ((b->CPos > 0) && (b->CPos == static_cast<int>(b->itemText.count())))
{
if (b->itemText.at(b->CPos-1)->cstyle & 256)
{
b->CPos -= 1;
while ((b->CPos > 0) && (b->itemText.at(b->CPos)->cstyle & 256))
{
b->CPos--;
if (b->CPos == 0)
break;
}
}
}
else
{
while ((b->CPos > 0) && (b->itemText.at(b->CPos)->cstyle & 256))
{
b->CPos--;
if (b->CPos == 0)
break;
}
}
if ( b->HasSel )
view->RefreshItem(b);
setTBvals(b);
break;
case Key_Right:
if ( buttonState & ControlButton )
{
view->setNewPos(b, oldPos, b->itemText.count(),1);
if ( buttonState & ShiftButton )
view->ExpandSel(b, 1, oldPos);
}
else if ( buttonState & ShiftButton )
{
b->CPos++;
if ( b->CPos > static_cast<int>(b->itemText.count()) )
b->CPos--;
else
view->ExpandSel(b, 1, oldPos);
}
else
{
b->CPos += 1; // new position within text ?
if (b->CPos > static_cast<int>(b->itemText.count()))
{
b->CPos -= 1;
if (b->NextBox != 0)
{
if (b->NextBox->itemText.count() != 0)
{
view->Deselect(true);
b->NextBox->CPos = 0;
view->SelectItemNr(b->NextBox->ItemNr);
b = b->NextBox;
}
}
}
}
if ( b->HasSel )
view->RefreshItem(b);
setTBvals(b);
break;
case Key_Delete:
if (b->CPos == static_cast<int>(b->itemText.count()))
{
if (b->HasSel)
{
DeleteSel(b);
setTBvals(b);
view->RefreshItem(b);
}
keyrep = false;
return;
}
if (b->itemText.count() == 0)
{
keyrep = false;
return;
}
cr = b->itemText.at(b->CPos)->ch;
if (b->HasSel)
DeleteSel(b);
else
b->itemText.remove(b->CPos);
b->Tinput = false;
if ((cr == QChar(13)) && (b->itemText.count() != 0))
{
view->chAbStyle(b, b->itemText.at(QMAX(b->CPos-1,0))->cab);
b->Tinput = false;
}
setTBvals(b);
view->RefreshItem(b);
break;
case Key_Backspace:
if (b->CPos == 0)
{
if (b->HasSel)
{
DeleteSel(b);
setTBvals(b);
view->RefreshItem(b);
}
keyrep = false;
return;
}
if (b->itemText.count() == 0)
{
keyrep = false;
return;
}
cr = b->itemText.at(QMAX(b->CPos-1,0))->ch;
if (b->HasSel)
DeleteSel(b);
else
{
b->CPos -= 1;
b->itemText.remove(b->CPos);
}
b->Tinput = false;
if ((cr == QChar(13)) && (b->itemText.count() != 0))
{
view->chAbStyle(b, b->itemText.at(QMAX(b->CPos-1,0))->cab);
b->Tinput = false;
}
setTBvals(b);
view->RefreshItem(b);
break;
default:
if ((b->HasSel) && (kk < 0x1000))
DeleteSel(b);
if ((kk == Key_Tab)
|| ((kk == Key_Return) && (buttonState & ShiftButton))
|| ((kk + KeyMod) == Prefs.KeyActions[60].KeyID)
|| ((kk + KeyMod) == Prefs.KeyActions[67].KeyID))
{
hg = new ScText;
if ((kk + KeyMod) == Prefs.KeyActions[60].KeyID)
hg->ch = QString(QChar(30));
else if (kk == Key_Return)
hg->ch = QString(QChar(28));
else if (kk == Key_Tab)
hg->ch = QString(QChar(9));
else
hg->ch = QString(QChar(29));
hg->cfont = doc->CurrFont;
hg->csize = doc->CurrFontSize;
hg->ccolor = doc->CurrTextFill;
hg->cshade = doc->CurrTextFillSh;
hg->cstroke = doc->CurrTextStroke;
hg->cshade2 = doc->CurrTextStrokeSh;
hg->cscale = doc->CurrTextScale;
hg->cselect = false;
hg->cstyle = doc->CurrentStyle;
hg->cab = doc->currentParaStyle;
if (doc->docParagraphStyles[doc->currentParaStyle].Font != "")
{
hg->cfont = doc->docParagraphStyles[doc->currentParaStyle].Font;
hg->csize = doc->docParagraphStyles[doc->currentParaStyle].FontSize;
}
hg->cextra = 0;
hg->xp = 0;
hg->yp = 0;
hg->PRot = 0;
hg->PtransX = 0;
hg->PtransY = 0;
b->itemText.insert(b->CPos, hg);
b->CPos += 1;
b->Tinput = true;
view->RefreshItem(b);
break;
}
if ((kk + KeyMod) == Prefs.KeyActions[56].KeyID)
{
b->itemText.at(QMAX(b->CPos-1,0))->cstyle ^= 128;
b->Tinput = true;
view->RefreshItem(b);
break;
}
if ((kk + KeyMod) == Prefs.KeyActions[59].KeyID)
{
setNewAbStyle(1);
b->Tinput = true;
view->RefreshItem(b);
break;
}
if ((kk + KeyMod) == Prefs.KeyActions[57].KeyID)
{
setNewAbStyle(0);
b->Tinput = true;
view->RefreshItem(b);
break;
}
if ((kk + KeyMod) == Prefs.KeyActions[58].KeyID)
{
setNewAbStyle(2);
b->Tinput = true;
view->RefreshItem(b);
break;
}
if (((uc[0] > QChar(31)) || (as == 13) || (as == 30)) && ((*doc->AllFonts)[doc->CurrFont]->CharWidth.contains(uc[0].unicode())))
{
hg = new ScText;
hg->ch = uc;
hg->cfont = doc->CurrFont;
hg->ccolor = doc->CurrTextFill;
hg->cshade = doc->CurrTextFillSh;
hg->cstroke = doc->CurrTextStroke;
hg->cshade2 = doc->CurrTextStrokeSh;
hg->cscale = doc->CurrTextScale;
hg->csize = doc->CurrFontSize;
hg->cextra = 0;
hg->cselect = false;
hg->cstyle = doc->CurrentStyle;
hg->cab = doc->currentParaStyle;
if (doc->docParagraphStyles[doc->currentParaStyle].Font != "")
{
hg->cfont = doc->docParagraphStyles[doc->currentParaStyle].Font;
hg->csize = doc->docParagraphStyles[doc->currentParaStyle].FontSize;
}
hg->xp = 0;
hg->yp = 0;
hg->PRot = 0;
hg->PtransX = 0;
hg->PtransY = 0;
b->itemText.insert(b->CPos, hg);
b->CPos += 1;
if ((doc->docHyphenator->AutoCheck) && (b->CPos > 1))
{
Twort = "";
Tcoun = 0;
for (int hych = b->CPos-1; hych > -1; hych--)
{
Tcha = b->itemText.at(hych)->ch;
if (Tcha == " ")
{
Tcoun = hych+1;
break;
}
Twort.prepend(Tcha);
}
if (Twort != "")
{
if (doc->docHyphenator->Language != b->Language)
doc->docHyphenator->slotNewDict(b->Language);
doc->docHyphenator->slotHyphenateWord(b, Twort, Tcoun);
}
}
b->Tinput = true;
view->RefreshItem(b);
}
break;
}
if (b->itemText.count() != 0)
if (b->itemText.at(QMAX(b->CPos-1, 0))->yp != 0)
view->slotDoCurs(true);
if ((kk == Key_Left) || (kk == Key_Right) || (kk == Key_Up) || (kk == Key_Down))
{
keyrep = false;
return;
}
}
slotDocCh(false);
break;
}
}
}
switch(kk)
{
case Key_Left:
case Key_Right:
case Key_Up:
case Key_Down:
_arrowKeyDown = true;
}
keyrep = false;
}
void ScribusApp::keyReleaseEvent(QKeyEvent *k)
{
if (k->isAutoRepeat() || !_arrowKeyDown)
return;
switch(k->key())
{
case Key_Left:
case Key_Right:
case Key_Up:
case Key_Down:
_arrowKeyDown = false;
for (uint i = 0; i < view->SelItem.count(); ++i)
view->SelItem.at(i)->checkChanges(true);
if (view->SelItem.count() > 1 && view->groupTransactionStarted())
undoManager->commit();
}
}
void ScribusApp::closeEvent(QCloseEvent *ce)
{
QWidgetList windows = wsp->windowList();
ScribusWin* tw;
if (!windows.isEmpty())
{
singleClose = true;
for ( int i = 0; i < static_cast<int>(windows.count()); ++i )
{
newActWin(windows.at(i));
tw = ActWin;
ActWin->close();
if (tw == ActWin)
{
ce->ignore();
singleClose = false;
return;
}
}
SavePrefs();
delete prefsFile;
UndoManager::deleteInstance();
if ((Prefs.SaveAtQ) && (ScBook->Changed == true))
{
if (ScBook->ScFilename.isEmpty())
ScBook->ScFilename = PrefsPfad+"/scrap13.scs";
ScBook->Save();
}
if (ScBook->BibWin->Objekte.count() == 0)
unlink(PrefsPfad+"/scrap13.scs");
Prefs.AvailFonts.~SCFonts();
FinalizePlugs();
exit(0);
}
else
{
SavePrefs();
delete prefsFile;
UndoManager::deleteInstance();
if ((Prefs.SaveAtQ) && (ScBook->Changed == true))
{
if (ScBook->ScFilename.isEmpty())
ScBook->ScFilename = PrefsPfad+"/scrap13.scs";
ScBook->Save();
}
if (ScBook->BibWin->Objekte.count() == 0)
unlink(PrefsPfad+"/scrap13.scs");
qApp->setOverrideCursor(QCursor(ArrowCursor), true);
Prefs.AvailFonts.~SCFonts();
FinalizePlugs();
exit(0);
}
}
/////////////////////////////////////////////////////////////////////
// SLOT IMPLEMENTATION
/////////////////////////////////////////////////////////////////////
void ScribusApp::parsePagesString(QString pages, std::vector<int>* pageNs, int sourcePageCount)
{
QString tmp = pages;
QString token;
int from, to, pageNr;
do
{
if (tmp.find(",") == -1)
{
token = tmp;
tmp = "";
}
else
{
token = tmp.left(tmp.find(","));
tmp = tmp.right(tmp.length() - tmp.find(",") - 1);
}
token = token.stripWhiteSpace();
if (token == "*") // Import all source doc pages
{
for (int i = 1; i <= sourcePageCount; ++i)
pageNs->push_back(i);
}
else if (token.find("-") != -1) // import a range of source doc pages
{
from = QString(token.left(token.find("-"))).toInt();
to = QString(token.right(token.length() - token.find("-") - 1)).toInt();
if ((from != 0) && (to != 0))
{
if (from > sourcePageCount)
from = sourcePageCount;
if (to > sourcePageCount)
to = sourcePageCount;
if (from == to)
pageNs->push_back(to);
else if (from < to)
{
for (int i = from; i <= to; ++i)
pageNs->push_back(i);
}
else
{
for (int i = from; i >= to; --i)
pageNs->push_back(i);
}
}
}
else // import single source doc page
{
pageNr = token.toInt();
if ((pageNr > 0) && (pageNr <= sourcePageCount))
pageNs->push_back(pageNr);
}
} while (tmp != "");
}
bool ScribusApp::arrowKeyDown()
{
return _arrowKeyDown;
}
bool ScribusApp::slotFileNew()
{
bool retVal;
NewDoc* dia = new NewDoc(this, &Prefs);
if (dia->exec())
{
bool facingPages, autoframes;
double pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, numberCols, columnDistance;
topMargin = dia->Top;
leftMargin = dia->Left;
rightMargin = dia->Right;
bottomMargin = dia->Bottom;
columnDistance = dia->Dist;
pageWidth = dia->Pagebr;
pageHeight = dia->Pageho;
numberCols = dia->SpinBox10->value();
autoframes = dia->AutoFrame->isChecked();
facingPages = dia->Doppelseiten->isChecked();
int orientation = dia->Orient;
QString pagesize = dia->ComboBox1->currentText();
retVal = doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->ComboBox3->currentItem(),
dia->ErsteSeite->isChecked(), orientation, dia->PgNr->value(), pagesize);
FMess->setText( tr("Ready"));
}
else
retVal = false;
delete dia;
windowsMenuAboutToShow();
return retVal;
}
bool ScribusApp::doFileNew(double b, double h, double tpr, double lr, double rr, double br, double ab, double sp,
bool atf, bool fp, int einh, bool firstleft, int Ori, int SNr, QString PageSize)
{
QString cc;
if (HaveDoc)
doc->OpenNodes = Tpal->buildReopenVals();
doc = new ScribusDoc(&Prefs);
docChecker->clearErrorList();
doc->docUnitIndex = einh;
if (fp)
doc->FirstPageLeft = firstleft;
doc->PageOri = Ori;
doc->PageSize = PageSize;
doc->FirstPnum = SNr;
doc->setName(doc->DocName+cc.setNum(DocNr));
doc->HasCMS = true;
doc->CMSSettings.DefaultInputProfile = Prefs.DCMSset.DefaultInputProfile;
doc->CMSSettings.DefaultInputProfile2 = Prefs.DCMSset.DefaultInputProfile2;
doc->CMSSettings.DefaultMonitorProfile = Prefs.DCMSset.DefaultMonitorProfile;
doc->CMSSettings.DefaultPrinterProfile = Prefs.DCMSset.DefaultPrinterProfile;
doc->CMSSettings.DefaultIntentPrinter = Prefs.DCMSset.DefaultIntentPrinter;
doc->CMSSettings.DefaultIntentMonitor = Prefs.DCMSset.DefaultIntentMonitor;
doc->CMSSettings.DefaultIntentMonitor2 = Prefs.DCMSset.DefaultIntentMonitor2;
doc->CMSSettings.SoftProofOn = Prefs.DCMSset.SoftProofOn;
doc->CMSSettings.GamutCheck = Prefs.DCMSset.GamutCheck;
doc->CMSSettings.BlackPoint = Prefs.DCMSset.BlackPoint;
doc->CMSSettings.CMSinUse = Prefs.DCMSset.CMSinUse;
doc->PDF_Optionen.SolidProf = doc->CMSSettings.DefaultInputProfile2;
doc->PDF_Optionen.ImageProf = doc->CMSSettings.DefaultInputProfile;
doc->PDF_Optionen.PrintProf = doc->CMSSettings.DefaultPrinterProfile;
doc->PDF_Optionen.Intent = doc->CMSSettings.DefaultIntentMonitor;
doc->PDF_Optionen.Intent2 = doc->CMSSettings.DefaultIntentMonitor2;
struct LPIData lpo;
lpo.Frequency = 75;
lpo.SpotFunc = 2;
lpo.Angle = 105;
doc->PDF_Optionen.LPISettings.insert("Cyan", lpo);
lpo.Angle = 75;
doc->PDF_Optionen.LPISettings.insert("Magenta", lpo);
lpo.Angle = 90;
doc->PDF_Optionen.LPISettings.insert("Yellow", lpo);
lpo.Angle = 45;
doc->PDF_Optionen.LPISettings.insert("Black", lpo);
doc->ActiveLayer = 0;
HaveDoc++;
DocNr++;
doc->appMode = NormalMode;
doc->PageColors = Prefs.DColors;
doc->loading = true;
ScribusWin* w = new ScribusWin(wsp, doc);
view = new ScribusView(w, doc, &Prefs);
view->Scale = 1.0*Prefs.DisScale;
w->setView(view);
ActWin = w;
doc->WinHan = w;
w->setCentralWidget(view);
connect(undoManager, SIGNAL(undoRedoDone()), view, SLOT(DrawNew()))