Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

scribus.cpp

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008                           scribus.cpp  -  description
00009                              -------------------
00010     begin                : Fre Apr  6 21:09:31 CEST 2001
00011     copyright            : (C) 2001 by Franz Schmid
00012     email                : Franz.Schmid@altmuehlnet.de
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #include <QApplication>
00025 #include <QByteArray>
00026 #include <QCloseEvent>
00027 #include <QColor>
00028 #include <QColorDialog>
00029 #include <QCursor>
00030 #include <QDesktopWidget>
00031 #include <QDragEnterEvent>
00032 #include <QDropEvent>
00033 #include <QEvent>
00034 #include <QEventLoop>
00035 #include <QFrame>
00036 #include <QIcon>
00037 #include <QInputDialog>
00038 #include <QKeyEvent>
00039 #include <QKeySequence>
00040 #include <QLabel>
00041 #include <QList>
00042 #include <QLocale>
00043 #include <QMouseEvent>
00044 #include <QPixmap>
00045 #include <QRegExp>
00046 #include <QStyleFactory>
00047 #include <QTableWidget>
00048 #include <QTextCodec>
00049 #include <QTranslator>
00050 #include <QWheelEvent>
00051 
00052 
00053 #include <cstdio>
00054 #include <cstdlib>
00055 #include <cmath>
00056 #include <cassert>
00057 
00058 #include "scconfig.h"
00059 
00060 #ifdef HAVE_DLFCN_H
00061 #include <dlfcn.h>
00062 #endif
00063 
00064 #ifdef HAVE_UNISTD_H
00065 #include <unistd.h>
00066 #endif
00067 
00068 #include <iostream>
00069 #include <sstream>
00070 #include <signal.h>
00071 #include <string>
00072 
00073 
00074 
00075 
00076 #include "about.h"
00077 #include "aboutplugins.h"
00078 #include "actionmanager.h"
00079 #include "aligndistribute.h"
00080 #include "annot.h"
00081 #include "annota.h"
00082 #include "applytemplatedialog.h"
00083 #include "arrowchooser.h"
00084 #include "autoform.h"
00085 #include "bookmarkpalette.h"
00086 #include "canvasmode.h"
00087 #include "charselect.h"
00088 #include "checkDocument.h"
00089 #include "cmsprefs.h"
00090 #include "collect4output.h"
00091 #include "colorcombo.h"
00092 #include "colorm.h"
00093 #include "commonstrings.h"
00094 #include "contextmenu.h"
00095 #include "cpalette.h"
00096 #include "customfdialog.h"
00097 #include "delpages.h"
00098 #include "desaxe/digester.h"
00099 #include "desaxe/saxXML.h"
00100 #include "desaxe/simple_actions.h"
00101 #include "docinfo.h"
00102 #include "docitemattrprefs.h"
00103 #include "documentchecker.h"
00104 #include "documentinformation.h"
00105 #include "effectsdialog.h"
00106 #include "fileloader.h"
00107 #include "filewatcher.h"
00108 #include "fontcombo.h"
00109 #include "fontprefs.h"
00110 #include "fpoint.h"
00111 #include "fpointarray.h"
00112 #include "gtgettext.h"
00113 #include "guidemanager.h"
00114 #include "helpbrowser.h"
00115 #include "hruler.h"
00116 #include "hyphenator.h"
00117 #include "hysettings.h"
00118 #include "imageinfodialog.h"
00119 #include "insertaframe.h"
00120 #include "inspage.h"
00121 #include "javadocs.h"
00122 #include "langmgr.h"
00123 #include "layers.h"
00124 #include "loremipsum.h"
00125 #include "marginwidget.h"
00126 #include "margindialog.h"
00127 #include "masterpagepalette.h"
00128 //#include "measurements.h"
00129 #include "menumanager.h"
00130 #include "mergedoc.h"
00131 #include "movepage.h"
00132 #include "multipleduplicate.h"
00133 #include "newfile.h"
00134 #include "newtemp.h"
00135 #include "nodeeditpalette.h"
00136 #include "outlinepalette.h"
00137 #include "page.h"
00138 #include "pageitem_imageframe.h"
00139 #include "pageitem_latexframe.h"
00140 #include "pageitem_textframe.h"
00141 #include "pageitemattributes.h"
00142 #include "pagelayout.h"
00143 #include "pagepalette.h"
00144 #include "pageselector.h"
00145 #include "pagesize.h"
00146 #include "patterndialog.h"
00147 #include "pdflib.h"
00148 #include "pdfoptions.h"
00149 #include "pdfopts.h"
00150 #include "picstatus.h"
00151 #include "pluginmanager.h"
00152 #include "plugins/formatidlist.h"
00153 #include "polygonwidget.h"
00154 #include "prefs.h"
00155 #include "prefscontext.h"
00156 #include "prefsfile.h"
00157 #include "prefsmanager.h"
00158 #include "prefstable.h"
00159 #include "preview.h"
00160 #include "printdialog.h"
00161 #include "propertiespalette.h"
00162 #include "pslib.h"
00163 #include "query.h"
00164 #include "reformdoc.h"
00165 #include "resourcecollection.h"
00166 #include "sccolorengine.h"
00167 #include "sccombobox.h"
00168 #include "scgtplugin.h"
00169 #include "scmessagebox.h"
00170 #include "scpaths.h"
00171 #include "scprintengine_ps.h"
00172 #include "scraction.h"
00173 #include "scrapbookpalette.h"
00174 #include "scribus.h"
00175 #include "scribusXml.h"
00176 #include "scribusapp.h"
00177 #include "scribuscore.h"
00178 #include "scribuswin.h"
00179 #include "search.h"
00180 #include "selection.h"
00181 #include "serializer.h"
00182 #include "smlinestyle.h"
00183 #include "smtextstyles.h"
00184 #include "splash.h"
00185 #include "stencilreader.h"
00186 #include "story.h"
00187 #include "stylemanager.h"
00188 #include "tabcheckdoc.h"
00189 #include "tabguides.h"
00190 #include "tabmanager.h"
00191 #include "tabpdfoptions.h"
00192 #include "tabtools.h"
00193 #include "tabtypography.h"
00194 #include "text/nlsconfig.h"
00195 #include "tocgenerator.h"
00196 #include "tocindexprefs.h"
00197 #include "ui/copypagetomasterpagedialog.h"
00198 #include "ui/edittoolbar.h"
00199 #include "ui/filetoolbar.h"
00200 #include "ui/modetoolbar.h"
00201 #include "ui/pdftoolbar.h"
00202 #include "undogui.h"
00203 #include "undomanager.h"
00204 #include "undostate.h"
00205 #include "units.h"
00206 #include "urllauncher.h"
00207 #include "util.h"
00208 #include "util_formats.h"
00209 #include "util_ghostscript.h"
00210 #include "util_icon.h"
00211 #include "vruler.h"
00212 
00213 
00214 #if defined(_WIN32)
00215 #include "scdocoutput_ps2.h"
00216 #include "scprintengine_gdi.h"
00217 #endif
00218 
00219 using namespace std;
00220 
00221 bool previewDinUse;
00222 bool printDinUse;
00223 
00224 QString DocDir;
00225 
00226 
00227 extern ScribusQApp* ScQApp;
00228 extern bool emergencyActivated;
00229 
00230 
00231 ScribusMainWindow::ScribusMainWindow()
00232 {
00233     actionManager=0;
00234     scrMenuMgr=0;
00235     prefsManager=0;
00236     formatsManager=0;
00237     UrlLauncher::instance();
00238     mainWindowStatusLabel=0;
00239     ExternalApp=0;
00240 #ifdef Q_WS_MAC
00241     noIcon = loadIcon("noicon.xpm");
00242 #endif
00243 }
00244 
00245 /*
00246 static QCoreApplication::EventFilter origEventFilter = 0;
00247 
00248 bool reportFocusChanges(void *message, long *result)
00249 {
00250     unsigned* data = static_cast<unsigned*>(message);
00251     if (QApplication::focusWidget())
00252         qDebug() << QApplication::applicationFilePath() << reinterpret_cast<void*>(QApplication::focusWidget()) << typeid(*QApplication::focusWidget()).name() << QApplication::focusWidget()->objectName() << message << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7];
00253     else
00254         qDebug() << QApplication::applicationFilePath() << "no focus" << message << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7];
00255     return origEventFilter && origEventFilter(message, result);
00256 }
00257 */
00258 
00259 /*
00260  * retval 0 - ok, 1 - no fonts, ...
00261  */
00262 int ScribusMainWindow::initScMW(bool primaryMainWindow)
00263 {
00264     int retVal=0;
00265 
00266     QByteArray stylesheet;
00267     if (loadRawText(ScPaths::getApplicationDataDir() + "/stylesheet.css", stylesheet))
00268     {
00269         qApp->setStyleSheet(QString(stylesheet));
00270     }
00271 
00272 //  origEventFilter = qApp->setEventFilter(reportFocusChanges);
00273     
00274     previewDinUse = false;
00275     printDinUse = false;
00276     internalCopy = false;
00277     CurrStED = NULL;
00278     setWindowTitle( tr("Scribus " VERSION));
00279     setAttribute(Qt::WA_KeyCompression, false);
00280     setWindowIcon(loadIcon("AppIcon.png"));
00281     scrActionGroups.clear();
00282     scrActions.clear();
00283     scrRecentFileActions.clear();
00284     scrRecentPasteActions.clear();
00285     scrWindowsActions.clear();
00286     scrLayersActions.clear();
00287     scrMenuMgr = new MenuManager(menuBar());
00288     prefsManager = PrefsManager::instance();
00289     formatsManager = FormatsManager::instance();
00290     objectSpecificUndo = false;
00291 
00292     undoManager = UndoManager::instance();
00293     PrefsContext *undoPrefs = prefsManager->prefsFile->getContext("undo");
00294     undoManager->setUndoEnabled(undoPrefs->getBool("enabled", true));
00295     tocGenerator = new TOCGenerator();
00296 
00297 
00298     initDefaultValues();
00299 
00300     initStatusBar();
00301 
00302     qApp->processEvents();
00303 
00304     BuFromApp = false;
00305 
00306     actionManager = new ActionManager(this);
00307     actionManager->init(this);
00308 //  if (primaryMainWindow)
00309 //      ScCore->setSplashStatus( tr("Applying User Shortcuts") );
00310 //  prefsManager->applyLoadedShortCuts();
00311 //  initKeyboardShortcuts();
00312     initMenuBar();
00313     initToolBars();
00314     ScCore->pluginManager->setupPluginActions(this);
00315     ScCore->pluginManager->languageChange();
00316     if (primaryMainWindow)
00317         ScCore->setSplashStatus( tr("Applying User Shortcuts") );
00318     prefsManager->applyLoadedShortCuts();
00319     initKeyboardShortcuts();
00320     
00321     resize(610, 600);
00322     wsp = new QWorkspace( this );
00323     setCentralWidget( wsp );
00324     connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *)));
00325     //Connect windows cascade and tile actions to the workspace after its created. Only depends on wsp created.
00326     connect( scrActions["windowsCascade"], SIGNAL(triggered()) , wsp, SLOT(cascade()) );
00327     connect( scrActions["windowsTile"], SIGNAL(triggered()) , wsp, SLOT(tile()) );
00328     initPalettes();
00329 
00330     prefsManager->setupMainWindow(this);
00331 
00332     if (primaryMainWindow)
00333         ScCore->setSplashStatus( tr("Initializing Story Editor") );
00334     storyEditor = new StoryEditor(this);
00335 
00336     DocDir = prefsManager->documentDir();
00337 
00338     if (primaryMainWindow)
00339         ScCore->setSplashStatus( tr("Initializing Hyphenator") );
00340     QString preLang = prefsManager->appPrefs.Language;
00341     initHyphenator();
00342     if (Sprachen.contains(preLang))
00343         prefsManager->appPrefs.Language = preLang;
00344     if (primaryMainWindow)
00345         ScCore->setSplashStatus( tr("Reading Scrapbook") );
00346     initScrapbook();
00347 
00348     scrActions["helpTooltips"]->setChecked(prefsManager->appPrefs.showToolTips);
00349     scrActions["stickyTools"]->setChecked(prefsManager->appPrefs.stickyTools);
00350     ToggleTips();
00351     propertiesPalette->setFontSize();
00352     if (scrActions["SaveAsDocumentTemplate"])
00353         scrActions["SaveAsDocumentTemplate"]->setEnabled(false);
00354 
00355     connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecent(QString)));
00356     connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&)));
00357     connect(this, SIGNAL(TextIFont(QString)), propertiesPalette, SLOT(setFontFace(QString)));
00358     connect(this, SIGNAL(TextISize(double)), propertiesPalette, SLOT(setSize(double)));
00359     connect(this, SIGNAL(TextUSval(double)), propertiesPalette, SLOT(setExtra(double)));
00360     connect(this, SIGNAL(TextStil(int)), propertiesPalette, SLOT(setStil(int)));
00361     connect(this, SIGNAL(TextScale(double)), propertiesPalette, SLOT(setTScale(double)));
00362     connect(this, SIGNAL(TextScaleV(double)), propertiesPalette, SLOT(setTScaleV(double)));
00363     connect(this, SIGNAL(TextBase(double)), propertiesPalette, SLOT(setTBase(double)));
00364     connect(this, SIGNAL(TextShadow(double, double )), propertiesPalette, SLOT(setShadowOffs(double, double )));
00365     connect(this, SIGNAL(TextOutline(double)), propertiesPalette, SLOT(setOutlineW(double)));
00366     connect(this, SIGNAL(TextUnderline(double, double)), propertiesPalette, SLOT(setUnderline(double, double)));
00367     connect(this, SIGNAL(TextStrike(double, double)), propertiesPalette, SLOT(setStrike(double, double)));
00368     connect(this, SIGNAL(TextFarben(QString, QString, double, double)), propertiesPalette, SLOT(setActFarben(QString, QString, double, double)));
00369     connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange()));
00370 //  connect(ClipB, SIGNAL(selectionChanged()), this, SLOT(ClipChange()));
00371     setAcceptDrops(true);
00372     QCoreApplication::instance()->installEventFilter(this);
00373     
00374     return retVal;
00375 }
00376 
00377 
00378 ScribusMainWindow::~ScribusMainWindow()
00379 {
00380 }
00381 
00382 void ScribusMainWindow::addScToolBar(ScToolBar *tb, QString name)
00383 {
00384     if (!scrToolBars.contains(name))
00385         scrToolBars.insert(name, tb);
00386     addToolBar(tb);
00387 }
00388 
00389 void ScribusMainWindow::initToolBars()
00390 {
00391     fileToolBar = new FileToolBar(this);
00392     editToolBar = new EditToolBar(this);
00393     UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget");
00394     undoManager->registerGui(uWidget);
00395     modeToolBar = new ModeToolBar(this);
00396     pdfToolBar = new PDFToolBar(this);
00397 
00398     addScToolBar(fileToolBar, "ToolBar-File");
00399     addScToolBar(editToolBar, "ToolBar-Edit");
00400     addScToolBar(modeToolBar, "ToolBar-Tools");
00401     addScToolBar(pdfToolBar, "ToolBar-PDF_Tools");
00402 
00403     connect(modeToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarTools"], SLOT(setChecked(bool)));
00404     connect(scrActions["toolsToolbarPDF"], SIGNAL(toggled(bool)), pdfToolBar, SLOT(setVisible(bool)));
00405     connect(pdfToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarPDF"], SLOT(setChecked(bool)));
00406     connect(scrActions["toolsToolbarTools"], SIGNAL(toggled(bool)), modeToolBar, SLOT(setVisible(bool)) );
00407 }
00408 
00409 
00410 void ScribusMainWindow::initDefaultValues()
00411 {
00412     HaveDoc = false;
00413     ScriptRunning = false;
00414     view = NULL;
00415     doc = NULL;
00416     Buffer2 = "";
00417     DocNr = 1;
00418     PrinterUsed = false;
00419     PDef.Pname = "";
00420     PDef.Dname = "";
00421     PDef.Command = "";
00422     keyrep = false;
00423     _arrowKeyDown = false;
00424     ClipB = QApplication::clipboard();
00425     palettesStatus[0] = false;
00426     guidesStatus[0] = false;
00427 }
00428 
00429 
00430 void ScribusMainWindow::initKeyboardShortcuts()
00431 {
00432     for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrActions.begin(); it!=scrActions.end(); ++it )
00433     {
00434         if ((ScrAction*)(it.value())!=NULL)
00435         {
00436             QString accelerator=it.value()->shortcut();
00437             prefsManager->setKeyEntry(it.key(), it.value()->cleanMenuText(), accelerator,0);
00438         }
00439         //else
00440         //  qDebug(it.key());
00441         //qDebug(QString("|-\n|%1||%2||%3").arg(it.key()).arg(it.value()->cleanMenuText()).arg(QString(it.data()->accel())));
00442     }
00443 }
00444 
00445 
00446 void ScribusMainWindow::initPalettes()
00447 {
00448     //CB TODO hide the publicly available members of some palettes
00449     // these must be filtered too as they take control of the palettes events
00450     outlinePalette = new OutlinePalette(this);
00451     outlinePalette->setMainWindow(this);
00452     connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool)) );
00453     connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setChecked(bool)));
00454     propertiesPalette = new PropertiesPalette(this);
00455     propertiesPalette->setMainWindow(this);
00456     connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool)) );
00457     connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setChecked(bool)));
00458 
00459     //CB dont need this until we have a doc...
00460     //propertiesPalette->Cpal->SetColors(prefsManager->colorSet());
00461     propertiesPalette->Fonts->RebuildList(0);
00462     propertiesPalette->installEventFilter(this);
00463     nodePalette = new NodePalette(this);
00464     nodePalette->installEventFilter(this);
00465     layerPalette = new LayerPalette(this);
00466     guidePalette = new GuideManager(this);
00467     charPalette = new CharSelect(this);
00468     connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) );
00469     connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setChecked(bool)));
00470     layerPalette->installEventFilter(this);
00471     layerPalette->Table->installEventFilter(this);
00472     scrapbookPalette = new Biblio(this);
00473     connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) );
00474     connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setChecked(bool)));
00475     connect( scrapbookPalette, SIGNAL(pasteToActualPage(QString)), this, SLOT(pasteFromScrapbook(QString)));
00476     scrapbookPalette->installEventFilter(this);
00477     pagePalette = new PagePalette(this);
00478     connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) );
00479     connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , this, SLOT(setPagePalette(bool)) );
00480     connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setChecked(bool)));
00481     pagePalette->installEventFilter(this);
00482     bookmarkPalette = new BookPalette(this);
00483     connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) );
00484     connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setChecked(bool)));
00485     bookmarkPalette->installEventFilter(this);
00486 //  measurementPalette = new Measurements(this);
00487 //  connect( scrActions["toolsMeasurements"], SIGNAL(toggled(bool)) , measurementPalette, SLOT(setPaletteShown(bool)) );
00488     connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool, int)) , this, SLOT(setAppModeByToggle(bool, int)) );
00489 //  connect( measurementPalette, SIGNAL(paletteShown(bool)), scrActions["toolsMeasurements"], SLOT(setChecked(bool)));
00490 //  measurementPalette->installEventFilter(this);
00491 //  measurementPalette->hide();
00492     docCheckerPalette = new CheckDocument(this, false);
00493     connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) );
00494     connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , this, SLOT(docCheckToggle(bool)) );
00495     connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setChecked(bool)));
00496     connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool)));
00497     docCheckerPalette->installEventFilter(this);
00498     docCheckerPalette->hide();
00499 
00500     alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette", false);
00501     connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) );
00502     connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setChecked(bool)));
00503     connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh()));
00504     alignDistributePalette->installEventFilter(this);
00505 
00506     undoPalette = new UndoPalette(this, "undoPalette");
00507     undoPalette->installEventFilter(this);
00508     undoManager->registerGui(undoPalette);
00509     connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool)));
00510     connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool)));
00511 
00512     // initializing style manager here too even it's not strictly a palette
00513     styleManager = new StyleManager(this, "styleManager");
00514     styleManager->addStyle(new SMLineStyle());
00515     SMCharacterStyle *tmpCS = new SMCharacterStyle();
00516     styleManager->addStyle(new SMParagraphStyle(tmpCS->tmpStyles()));
00517     styleManager->addStyle(tmpCS);
00518     connect( scrActions["editStyles"], SIGNAL(toggled(bool)), styleManager, SLOT(setPaletteShown(bool)) );
00519     connect( styleManager, SIGNAL(paletteShown(bool)), scrActions["editStyles"], SLOT(setChecked(bool)));
00520     styleManager->installEventFilter(this);
00521 
00522     connect(docCheckerPalette, SIGNAL(selectElement(int, int)), this, SLOT(selectItemsFromOutlines(int, int)));
00523     connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int)));
00524     connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString)));
00525     connect(outlinePalette, SIGNAL(selectElement(int, int, bool)), this, SLOT(selectItemsFromOutlines(int, int, bool)));
00526     connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int)));
00527     connect(outlinePalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString)));
00528     connect(propertiesPalette->paraStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setNewParStyle(const QString&)));
00529     connect(propertiesPalette->charStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setNewCharStyle(const QString&)));
00530 //  connect(propertiesPalette, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles()));
00531     connect(nodePalette, SIGNAL(Schliessen()), this, SLOT(slotSelect()));
00532     connect(nodePalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh()));
00533     connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer()));
00534 
00535     connect(bookmarkPalette->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks()));
00536     connect(bookmarkPalette->BView, SIGNAL(changed()), this, SLOT(slotDocCh()));
00537     connect(bookmarkPalette->BView, SIGNAL(SelectElement(PageItem *)), this, SLOT(selectItemsFromOutlines(PageItem *)));
00538     // guides
00539     connect(scrActions["pageManageGuides"], SIGNAL(toggled(bool)), guidePalette, SLOT(setPaletteShown(bool)));
00540     connect(guidePalette, SIGNAL(paletteShown(bool)), scrActions["pageManageGuides"], SLOT(setChecked(bool)));
00541     // char palette
00542     connect(scrActions["insertGlyph"], SIGNAL(toggled(bool)), charPalette, SLOT(setPaletteShown(bool)));
00543     connect(charPalette, SIGNAL(paletteShown(bool)), scrActions["insertGlyph"], SLOT(setChecked(bool)));
00544 }
00545 
00546 
00547 void ScribusMainWindow::initScrapbook()
00548 {
00549     QString scrapbookFileO = QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrap13.scs");
00550     QFileInfo scrapbookFileInfoO = QFileInfo(scrapbookFileO);
00551     if (scrapbookFileInfoO.exists())
00552     {
00553         scrapbookPalette->readOldContents(scrapbookFileO, QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrapbook/main"));
00554         QDir d = QDir();
00555         d.rename(scrapbookFileO, QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrap13.backup"));
00556     }
00557     QString scrapbookTemp = QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrapbook/tmp");
00558     QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp);
00559     if (scrapbookTempInfo.exists())
00560         scrapbookPalette->readTempContents(scrapbookTemp);
00561     QString scrapbookFile = QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrapbook/main");
00562     QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile);
00563     if (scrapbookFileInfo.exists())
00564         scrapbookPalette->readContents(scrapbookFile);
00565     scrapbookPalette->setScrapbookFileName(scrapbookFile);
00566     scrapbookPalette->setOpenScrapbooks(prefsManager->appPrefs.RecentScrapbooks);
00567     rebuildRecentPasteMenu();
00568     connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu()));
00569 }
00570 
00571 
00572 bool ScribusMainWindow::warningVersion(QWidget *parent)
00573 {
00574     bool retval = false;
00575     int t = ScMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" +
00576                                  QObject::tr("You are running a development version of Scribus 1.3.x. The document you are working with was created in Scribus 1.2.x.  Saving the current file under 1.3.x renders it unable to be edited in Scribus 1.2.x versions. To preserve the ability to edit in 1.2.x, save this file under a different name and further edit the newly named file and the original will be untouched. Are you sure you wish to proceed with this operation?") + "</qt>",
00577                                  QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel);
00578     if (t == QMessageBox::Ok)
00579         retval = true;
00580     return retval;
00581 }
00582 
00583 
00584 void ScribusMainWindow::initMenuBar()
00585 {
00586     RecentDocs.clear();
00587 
00588     scrMenuMgr->createMenu("File", tr("&File"));
00589     scrMenuMgr->addMenuItem(scrActions["fileNew"], "File");
00590     scrMenuMgr->addMenuItem(scrActions["fileOpen"], "File");
00591     recentFileMenuName="FileOpenRecent";
00592     scrMenuMgr->createMenu(recentFileMenuName, tr("Open &Recent"), "File");
00593     scrMenuMgr->addMenuSeparator("File");
00594     scrMenuMgr->addMenuItem(scrActions["fileClose"], "File");
00595     scrMenuMgr->addMenuItem(scrActions["fileSave"], "File");
00596     scrMenuMgr->addMenuItem(scrActions["fileSaveAs"], "File");
00597     scrMenuMgr->addMenuItem(scrActions["fileRevert"], "File");
00598     scrMenuMgr->addMenuItem(scrActions["fileCollect"], "File");
00599     scrMenuMgr->addMenuSeparator("File");
00600     scrMenuMgr->createMenu("FileImport", tr("&Import"), "File");
00601     scrMenuMgr->addMenuItem(scrActions["fileImportText"], "FileImport");
00602 //  scrMenuMgr->addMenuItem(scrActions["fileImportText2"], "FileImport");
00603     scrMenuMgr->addMenuItem(scrActions["fileImportAppendText"], "FileImport");
00604     scrMenuMgr->addMenuItem(scrActions["fileImportImage"], "FileImport");
00605     scrMenuMgr->createMenu("FileExport", tr("&Export"), "File");
00606     scrMenuMgr->addMenuItem(scrActions["fileExportText"], "FileExport");
00607     scrMenuMgr->addMenuItem(scrActions["fileExportAsEPS"], "FileExport");
00608     scrMenuMgr->addMenuItem(scrActions["fileExportAsPDF"], "FileExport");
00609     scrMenuMgr->addMenuSeparator("File");
00610     scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File");
00611     scrMenuMgr->addMenuItem(scrActions["filePreferences"], "File");
00612     scrMenuMgr->addMenuSeparator("File");
00613     scrMenuMgr->addMenuItem(scrActions["filePrint"], "File");
00614     scrMenuMgr->addMenuItem(scrActions["PrintPreview"], "File");
00615     scrMenuMgr->addMenuSeparator("File");
00616     scrMenuMgr->addMenuItem(scrActions["fileQuit"], "File");
00617 
00618     scrActions["fileClose"]->setEnabled(false);
00619     scrActions["fileSave"]->setEnabled(false);
00620     scrActions["fileSaveAs"]->setEnabled(false);
00621     scrActions["fileRevert"]->setEnabled(false);
00622     scrActions["fileCollect"]->setEnabled(false);
00623     scrActions["fileImportText"]->setEnabled(false);
00624     scrActions["fileImportText2"]->setEnabled(false);
00625     scrActions["fileImportImage"]->setEnabled(false);
00626     scrActions["fileImportAppendText"]->setEnabled(false);
00627     scrActions["pageImport"]->setEnabled(false);
00628     scrActions["fileExportText"]->setEnabled(false);
00629     scrActions["fileExportAsEPS"]->setEnabled(false);
00630     scrActions["fileExportAsPDF"]->setEnabled(false);
00631     scrMenuMgr->setMenuEnabled("FileImport", false);
00632     scrMenuMgr->setMenuEnabled("FileExport", false);
00633     scrActions["fileDocSetup"]->setEnabled(false);
00634     scrActions["filePrint"]->setEnabled(false);
00635     scrActions["PrintPreview"]->setEnabled(false);
00636 
00637     scrMenuMgr->createMenu("Edit", tr("&Edit"));
00638     scrMenuMgr->addMenuItem(scrActions["editUndoAction"], "Edit");
00639     scrMenuMgr->addMenuItem(scrActions["editRedoAction"], "Edit");
00640     scrMenuMgr->addMenuItem(scrActions["editActionMode"], "Edit");
00641     scrMenuMgr->addMenuSeparator("Edit");
00642     scrMenuMgr->addMenuItem(scrActions["editCut"], "Edit");
00643     scrMenuMgr->addMenuItem(scrActions["editCopy"], "Edit");
00644     scrMenuMgr->addMenuItem(scrActions["editPaste"], "Edit");
00645     recentPasteMenuName="EditPasteRecent";
00646     scrMenuMgr->createMenu(recentPasteMenuName, tr("Paste Recent"), "Edit");
00647     scrMenuMgr->createMenu("EditContents", tr("Contents"), "Edit");
00648     scrMenuMgr->addMenuItem(scrActions["editCopyContents"], "EditContents");
00649     scrMenuMgr->addMenuItem(scrActions["editPasteContents"], "EditContents");
00650     scrMenuMgr->addMenuItem(scrActions["editPasteContentsAbs"], "EditContents");
00651     scrMenuMgr->addMenuItem(scrActions["editClearContents"], "EditContents");
00652     scrMenuMgr->addMenuSeparator("Edit");
00653     scrMenuMgr->addMenuItem(scrActions["editSelectAll"], "Edit");
00654     scrMenuMgr->addMenuItem(scrActions["editDeselectAll"], "Edit");
00655     scrMenuMgr->addMenuSeparator("Edit");
00656     scrMenuMgr->addMenuItem(scrActions["editSearchReplace"], "Edit");
00657     scrMenuMgr->addMenuItem(scrActions["toolsEditWithStoryEditor"], "Edit");
00658     scrMenuMgr->addMenuItem(scrActions["editEditWithImageEditor"], "Edit");
00659     scrMenuMgr->addMenuItem(scrActions["editEditWithLatexEditor"], "Edit");
00660     scrMenuMgr->addMenuSeparator("Edit");
00661     scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit");
00662     scrMenuMgr->addMenuItem(