Subversion Repositories Scribus

Rev

Rev 1247 | Rev 1252 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 paul 1
/***************************************************************************
2
                          scribus.cpp  -  description
3
                             -------------------
4
    begin                : Fre Apr  6 21:09:31 CEST 2001
5
    copyright            : (C) 2001 by Franz Schmid
6
    email                : Franz.Schmid@altmuehlnet.de
7
 ***************************************************************************/
8
 
9
/***************************************************************************
10
 *                                                                         *
11
 *   This program is free software; you can redistribute it and/or modify  *
12
 *   it under the terms of the GNU General Public License as published by  *
13
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 *   (at your option) any later version.                                   *
15
 *                                                                         *
16
 ***************************************************************************/
17
 
18
#include <qaccel.h>
19
#include <qapplication.h>
204 Franz 20
#include <qeventloop.h>
3 paul 21
#include <qcolordialog.h>
22
#include <qcolor.h>
23
#include <qiconset.h>
24
#include <qtextstream.h>
25
#include <qstylefactory.h>
26
#include <qregexp.h>
27
#include <qtextcodec.h>
28
#include <qcursor.h>
29
#include <qvbox.h>
1208 cbradney 30
#include <qpixmap.h>
31
#include <qkeysequence.h>
32
 
3 paul 33
#include <cstdio>
34
#include <cstdlib>
391 Franz 35
#include <cmath>
3 paul 36
#include <dlfcn.h>
135 Franz 37
#include <unistd.h>
3 paul 38
#include <iostream>
119 Franz 39
#include <signal.h>
80 Franz 40
#include <string>
1208 cbradney 41
 
42
 
3 paul 43
#include "scribus.h"
44
#include "scribus.moc"
45
#include "newfile.h"
46
#include "page.h"
47
#include "query.h"
48
#include "mdup.h"
49
#include "docinfo.h"
50
#include "reformdoc.h"
51
#include "serializer.h"
52
#include "align.h"
53
#include "fmitem.h"
54
#include "fontprefs.h"
55
#include "libprefs/prefs.h"
1158 cbradney 56
#include "prefstable.h"
3 paul 57
#include "pdfopts.h"
58
#include "inspage.h"
59
#include "delpages.h"
60
#include "movepage.h"
61
#include "helpbrowser.h"
62
#include "scribusXml.h"
63
#include "libabout/about.h"
910 fschmid 64
#include "libpostscript/pslib.h"
3 paul 65
#include "druck.h"
66
#include "editformats.h"
67
#include "muster.h"
68
#include "applytemplate.h"
69
#include "picstatus.h"
70
#include "customfdialog.h"
71
#include "cmsprefs.h"
72
#include "annot.h"
73
#include "annota.h"
74
#include "javadocs.h"
151 Franz 75
#include "colorm.h"
265 Franz 76
#include "mpalette.h"
284 Franz 77
#include "measurements.h"
364 Franz 78
#include "gtgettext.h"
506 fschmid 79
#include "fileloader.h"
740 fschmid 80
#include "arrowchooser.h"
788 fschmid 81
#include "tabtypography.h"
879 fschmid 82
#include "tabguides.h"
1194 fschmid 83
#include "tabtools.h"
1114 tsoots 84
#include "undogui.h"
1151 fschmid 85
#include "filewatcher.h"
1202 fschmid 86
#include "charselect.h"
1232 fschmid 87
#include "checkDocument.h"
1235 fschmid 88
#include "tabcheckdoc.h"
617 cbradney 89
#ifdef _MSC_VER
90
 #if (_MSC_VER >= 1200)
91
  #include "win-config.h"
92
 #endif
128 Franz 93
#else
94
 #include "config.h"
95
#endif
96
 
3 paul 97
#include "fpoint.h"
98
#include "fpointarray.h"
99
#include "hysettings.h"
100
#include "guidemanager.h"
284 Franz 101
#include "keymanager.h"
3 paul 102
#include "mergedoc.h"
27 Franz 103
#include "lineformats.h"
102 Franz 104
#include "story.h"
123 Franz 105
#include "autoform.h"
140 Franz 106
#include "tabmanager.h"
164 Franz 107
#include "search.h"
169 Franz 108
#include "fontcombo.h"
415 Franz 109
#include "prefsfile.h"
1114 tsoots 110
#include "undomanager.h"
731 fschmid 111
#include "polygonwidget.h"
766 cbradney 112
#include "werktoolb.h"
806 cbradney 113
#include "units.h"
838 cbradney 114
#include "hruler.h"
115
#include "vruler.h"
1208 cbradney 116
#include "scraction.h"
117
#include "menumanager.h"
134 Franz 118
 
3 paul 119
extern QPixmap loadIcon(QString nam);
90 Franz 120
extern bool overwrite(QWidget *parent, QString filename);
1065 cbradney 121
extern void CopyPageItem(struct CopyPasteBuffer *Buffer, PageItem *b);
203 Franz 122
extern void ReOrderText(ScribusDoc *doc, ScribusView *view);
204 Franz 123
extern int copyFile(QString source, QString target);
124
extern int moveFile(QString source, QString target);
3 paul 125
 
126
using namespace std;
127
 
128
#ifdef HAVE_CMS
129
cmsHPROFILE CMSoutputProf;
130
cmsHPROFILE CMSprinterProf;
131
cmsHTRANSFORM stdTrans;
132
cmsHTRANSFORM stdProof;
133
cmsHTRANSFORM stdTransImg;
272 Franz 134
cmsHTRANSFORM stdProofImg;
3 paul 135
bool SoftProofing;
136
bool Gamut;
137
bool CMSuse;
138
int IntentMonitor;
139
int IntentPrinter;
140
#endif
141
bool CMSavail;
142
ProfilesL InputProfiles;
80 Franz 143
double UmReFaktor;
3 paul 144
QString DocDir;
119 Franz 145
ScribusApp* ScApp;
415 Franz 146
PrefsFile* prefsFile;
3 paul 147
 
188 Franz 148
ScribusApp::ScribusApp()
272 Franz 149
{} // ScribusApp::ScribusApp()
188 Franz 150
 
767 cbradney 151
/*
152
 * retval 0 - ok, 1 - no fonts, ...
153
 */
154
int ScribusApp::initScribus(bool showSplash, const QString newGuiLanguage)
188 Franz 155
{
767 cbradney 156
        int retVal=0;
1155 fschmid 157
        ExternalApp = 0;
770 cbradney 158
        guiLanguage = newGuiLanguage;
767 cbradney 159
        initSplash(showSplash);
1208 cbradney 160
        setUsesBigPixmaps(true);
173 Franz 161
        ScApp = this;
355 Franz 162
        CurrStED = NULL;
272 Franz 163
        setCaption( tr("Scribus " VERSION));
118 Franz 164
        setKeyCompression(false);
272 Franz 165
        setIcon(loadIcon("AppIcon.png"));
1208 cbradney 166
        scrActions.clear();
167
        scrActions.setAutoDelete(true);
168
        scrDLLActions.clear();
169
        scrRecentFileActions.clear();
170
        scrRecentFileActions.setAutoDelete(true);
171
        scrMenuMgr = new MenuManager(this->menuBar());
766 cbradney 172
 
1197 tsoots 173
        PrefsPfad = getPreferencesLocation();
174
        prefsFile = new PrefsFile(QDir::convertSeparators(PrefsPfad + "/prefs13.xml"));
175
        convertToXMLPreferences(PrefsPfad);
176
 
1247 tsoots 177
        undoManager = UndoManager::instance();
178
 
272 Franz 179
        initMenuBar();
180
        initStatusBar();
766 cbradney 181
        initToolBars();
490 cbradney 182
        qApp->processEvents();
675 cbradney 183
 
3 paul 184
        BuFromApp = false;
1158 cbradney 185
 
767 cbradney 186
        initFonts();
187
 
272 Franz 188
        if (NoFonts)
767 cbradney 189
                retVal=1;
272 Franz 190
        else
191
        {
831 cbradney 192
                initDefaultValues();
777 fschmid 193
                buildFontMenu();
194
                initDefaultPrefs();
801 cbradney 195
                initArrowStyles();
1230 cbradney 196
                initKeyboardShortcuts();               
3 paul 197
                resize(610, 600);
272 Franz 198
                QVBox* vb = new QVBox( this );
199
                vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
200
                wsp = new QWorkspace( vb );
201
                setCentralWidget( vb );
3 paul 202
                connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *)));
770 cbradney 203
 
801 cbradney 204
                initPalettes();
770 cbradney 205
 
1155 fschmid 206
                fileWatcher = new FileWatcher(this);
669 cbradney 207
                if (splashScreen != NULL)
208
                        splashScreen->setStatus( tr("Reading Preferences"));
490 cbradney 209
                qApp->processEvents();
68 Franz 210
                ReadPrefs();
801 cbradney 211
 
831 cbradney 212
                HaveGS = system(Prefs.gs_exe+" -h > /dev/null 2>&1");
213
                HavePngAlpha = system(Prefs.gs_exe+" -sDEVICE=pngalpha -c quit > /dev/null 2>&1");
214
                DocDir = Prefs.DocDir;
801 cbradney 215
 
669 cbradney 216
                if (splashScreen != NULL)
217
                        splashScreen->setStatus( tr("Getting ICC Profiles"));
831 cbradney 218
                CMSavail = false;
3 paul 219
                GetCMSProfiles();
803 cbradney 220
                initCMS();
831 cbradney 221
 
669 cbradney 222
                if (splashScreen != NULL)
223
                        splashScreen->setStatus( tr("Init Hyphenator"));
490 cbradney 224
                qApp->processEvents();
766 cbradney 225
                initHyphenator();
801 cbradney 226
 
669 cbradney 227
                if (splashScreen != NULL)
228
                        splashScreen->setStatus( tr("Reading Scrapbook"));
801 cbradney 229
                initScrapbook();
230
 
669 cbradney 231
                if (splashScreen != NULL)
232
                        splashScreen->setStatus( tr("Initializing Plugins"));
490 cbradney 233
                qApp->processEvents();
766 cbradney 234
                initPlugs();
1230 cbradney 235
 
236
                if (splashScreen != NULL)
237
                        splashScreen->setStatus( tr("Setting up Shortcuts"));
238
                qApp->processEvents();
239
                SetShortCut();
240
 
1208 cbradney 241
                connect(fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecent(QString)));
3 paul 242
                connect(this, SIGNAL(TextIFont(QString)), this, SLOT(AdjustFontMenu(QString)));
243
                connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int)));
244
                connect(this, SIGNAL(TextISize(int)), Mpal, SLOT(setSize(int)));
80 Franz 245
                connect(this, SIGNAL(TextUSval(double)), Mpal, SLOT(setExtra(double)));
3 paul 246
                connect(this, SIGNAL(TextStil(int)), Mpal, SLOT(setStil(int)));
68 Franz 247
                connect(this, SIGNAL(TextScale(int)), Mpal, SLOT(setTScale(int)));
248
                connect(this, SIGNAL(TextFarben(QString, QString, int, int)), Mpal, SLOT(setActFarben(QString, QString, int, int)));
766 cbradney 249
 
801 cbradney 250
                initCrashHandler();
3 paul 251
        }
767 cbradney 252
        closeSplash();
253
        return retVal;
3 paul 254
}
255
 
767 cbradney 256
void ScribusApp::initSplash(bool showSplash)
257
{
258
        if (showSplash)
259
        {
260
                splashScreen = new SplashScreen();
261
                splashScreen->setStatus(QObject::tr("Initializing..."));
262
        }
263
        else
264
                splashScreen = NULL;
265
}
266
 
267
void ScribusApp::closeSplash()
268
{
269
        if (splashScreen!=NULL)
270
        {
271
                splashScreen->close();
272
                delete splashScreen;
273
                splashScreen = NULL;
274
        }
275
}
276
 
766 cbradney 277
void ScribusApp::initToolBars()
278
{
279
        WerkTools2 = new QToolBar( tr("File"), this);
1208 cbradney 280
        scrActions["fileNew"]->addTo(WerkTools2);
281
        scrActions["fileOpen"]->addTo(WerkTools2);
1210 cbradney 282
        scrMenuMgr->addMenuToWidgetOfAction("FileOpenRecent", scrActions["fileOpen"]);
1208 cbradney 283
        scrActions["fileSave"]->addTo(WerkTools2);
284
        scrActions["fileClose"]->addTo(WerkTools2);
285
        scrActions["filePrint"]->addTo(WerkTools2);
286
        scrActions["fileExportAsPDF"]->addTo(WerkTools2);
287
 
288
        scrActions["fileClose"]->setEnabled(false);
289
        scrActions["filePrint"]->setEnabled(false);
290
        scrActions["fileSave"]->setEnabled(false);
291
        scrActions["fileExportAsPDF"]->setEnabled(false);
1114 tsoots 292
 
293
        editToolBar = new QToolBar(tr("Edit"), this);
294
        UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget");
1247 tsoots 295
        undoManager->registerGui(uWidget);
1114 tsoots 296
 
766 cbradney 297
        WerkTools = new WerkToolB(this);
298
        setDockEnabled(WerkTools, DockLeft, false);
299
        setDockEnabled(WerkTools, DockRight, false);
300
        WerkTools->Sichtbar = true;
301
        WerkTools->setEnabled(false);
302
        WerkToolsP = new WerkToolBP(this);
303
        setDockEnabled(WerkToolsP, DockLeft, false);
304
        setDockEnabled(WerkToolsP, DockRight, false);
305
        WerkToolsP->setEnabled(false);
306
        WerkToolsP->Sichtbar = true;
801 cbradney 307
 
308
        connect(WerkTools, SIGNAL(NewMode(int)), this, SLOT(ModeFromTB(int)));
309
        connect(WerkTools, SIGNAL(Schliessen()), this, SLOT(ToggleTools()));
310
        connect(WerkToolsP, SIGNAL(NewMode(int)), this, SLOT(ModeFromTB(int)));
311
        connect(WerkToolsP, SIGNAL(Schliessen()), this, SLOT(TogglePDFTools()));
766 cbradney 312
}
313
 
767 cbradney 314
void ScribusApp::initFonts()
315
{
316
        if (splashScreen!=NULL) {
317
                splashScreen->setStatus( tr("Searching for Fonts"));
318
                qApp->processEvents();
319
        }
320
        NoFonts=GetAllFonts();
321
        if (NoFonts)
322
        {
323
                if (splashScreen!=NULL)
324
                        splashScreen->close(); // 10/10/2004 pv fix #1200
325
                QString mess = tr("There are no Postscript fonts on your system");
326
                mess += "\n" + tr("Exiting now");
327
                QMessageBox::critical(this, tr("Fatal Error"), mess, 1, 0, 0);
328
        }
829 cbradney 329
        else
330
        if (splashScreen!=NULL)
331
        {
332
                splashScreen->setStatus( tr("Font System Initialized"));
333
                qApp->processEvents();
334
        }
767 cbradney 335
}
766 cbradney 336
 
770 cbradney 337
void ScribusApp::initDefaultPrefs()
338
{
339
        /** Default font and size **/
340
        SCFontsIterator it(Prefs.AvailFonts);
1194 fschmid 341
        Prefs.toolSettings.defFont = it.currentKey();
342
        Prefs.toolSettings.defSize = 120;
770 cbradney 343
        Prefs.AppFontSize = qApp->font().pointSize();
344
 
345
        /** Default colours **/
346
        Prefs.DColors.clear();
872 cbradney 347
        QString pfadC = LIBDIR;
348
        QString pfadC2 = pfadC + "rgbscribus.txt";
770 cbradney 349
        QFile fiC(pfadC2);
350
        if (!fiC.exists())
351
        {
352
                Prefs.DColors.insert("White", CMYKColor(0, 0, 0, 0));
353
                Prefs.DColors.insert("Black", CMYKColor(0, 0, 0, 255));
354
                Prefs.DColors.insert("Blue", CMYKColor(255, 255, 0, 0));
355
                Prefs.DColors.insert("Cyan", CMYKColor(255, 0, 0, 0));
356
                Prefs.DColors.insert("Green", CMYKColor(255, 0, 255, 0));
357
                Prefs.DColors.insert("Red", CMYKColor(0, 255, 255, 0));
358
                Prefs.DColors.insert("Yellow", CMYKColor(0, 0, 255, 0));
359
                Prefs.DColors.insert("Magenta", CMYKColor(0, 255, 0, 0));
360
                Prefs.DColorSet = "Scribus-Small";
361
        }
362
        else
363
        {
364
                if (fiC.open(IO_ReadOnly))
365
                {
366
                        QString ColorEn, Cname;
367
                        int Rval, Gval, Bval;
368
                        QTextStream tsC(&fiC);
369
                        ColorEn = tsC.readLine();
370
                        while (!tsC.atEnd())
371
                        {
372
                                ColorEn = tsC.readLine();
373
                                QTextStream CoE(&ColorEn, IO_ReadOnly);
374
                                CoE >> Rval;
375
                                CoE >> Gval;
376
                                CoE >> Bval;
377
                                CoE >> Cname;
378
                                CMYKColor tmp;
379
                                tmp.setColorRGB(Rval, Gval, Bval);
380
                                Prefs.DColors.insert(Cname, tmp);
381
                        }
382
                        fiC.close();
383
                }
384
                Prefs.DColorSet = "X11 RGB-Set";
385
        }
386
 
387
        Prefs.Wheelval = 40;
879 fschmid 388
        Prefs.guidesSettings.marginsShown = true;
389
        Prefs.guidesSettings.framesShown = true;
390
        Prefs.guidesSettings.gridShown = false;
391
        Prefs.guidesSettings.guidesShown = false;
392
        Prefs.guidesSettings.baseShown = false;
393
        Prefs.guidesSettings.showPic = true;
394
        Prefs.guidesSettings.linkShown = false;
395
        Prefs.guidesSettings.grabRad = 4;
396
        Prefs.guidesSettings.guideRad = 10;
397
        Prefs.guidesSettings.minorGrid = 20;
398
        Prefs.guidesSettings.majorGrid = 100;
399
        Prefs.guidesSettings.minorColor = QColor(green);
400
        Prefs.guidesSettings.majorColor = QColor(green);
401
        Prefs.guidesSettings.margColor = QColor(blue);
402
        Prefs.guidesSettings.guideColor = QColor(darkBlue);
403
        Prefs.guidesSettings.baseColor = QColor(lightGray);
823 fschmid 404
        Prefs.typographicSetttings.valueSuperScript = 33;
405
        Prefs.typographicSetttings.scalingSuperScript = 100;
406
        Prefs.typographicSetttings.valueSubScript = 33;
407
        Prefs.typographicSetttings.scalingSubScript = 100;
408
        Prefs.typographicSetttings.valueSmallCaps = 75;
409
        Prefs.typographicSetttings.autoLineSpacing = 20;
410
        Prefs.typographicSetttings.valueBaseGrid = 14.4;
411
        Prefs.typographicSetttings.offsetBaseGrid = 0.0;
770 cbradney 412
        Prefs.GUI = "Default";
1194 fschmid 413
        Prefs.toolSettings.dPen = "Black";
414
        Prefs.toolSettings.dBrush = "Black";
415
        Prefs.toolSettings.dShade = 100;
416
        Prefs.toolSettings.dShade2 = 100;
417
        Prefs.toolSettings.dLineArt = SolidLine;
418
        Prefs.toolSettings.dWidth = 1;
419
        Prefs.toolSettings.dPenLine = "Black";
420
        Prefs.toolSettings.dPenText = "Black";
421
        Prefs.toolSettings.dStrokeText = "Black";
1120 fschmid 422
        Prefs.DpapColor = QColor(white);
1194 fschmid 423
        Prefs.toolSettings.dCols = 1;
424
        Prefs.toolSettings.dGap = 0.0;
425
        Prefs.toolSettings.dShadeLine = 100;
426
        Prefs.toolSettings.dLstyleLine = SolidLine;
427
        Prefs.toolSettings.dWidthLine = 1;
428
        Prefs.toolSettings.dStartArrow = 0;
429
        Prefs.toolSettings.dEndArrow = 0;
430
        Prefs.toolSettings.magMin = 10;
431
        Prefs.toolSettings.magMax = 3200;
432
        Prefs.toolSettings.magStep = 25;
433
        Prefs.toolSettings.dBrushPict = "White";
434
        Prefs.toolSettings.shadePict = 100;
435
        Prefs.toolSettings.scaleX = 1;
436
        Prefs.toolSettings.scaleY = 1;
1187 fschmid 437
        Prefs.guidesSettings.before = true;
1065 cbradney 438
        Prefs.docUnitIndex = 0;
1194 fschmid 439
        Prefs.toolSettings.polyC = 4;
440
        Prefs.toolSettings.polyF = 0.5;
441
        Prefs.toolSettings.polyS = false;
442
        Prefs.toolSettings.polyFd = 0;
443
        Prefs.toolSettings.polyR = 0;
1232 fschmid 444
        Prefs.checkPalSettings.visible = false;
844 fschmid 445
        Prefs.mainToolBarSettings.visible = true;
446
        Prefs.pdfToolBarSettings.visible = true;
447
        Prefs.mPaletteSettings.visible = false;
448
        Prefs.measurePalSettings.visible = false;
449
        Prefs.treePalSettings.visible = false;
450
        Prefs.scrapPalSettings.visible = false;
451
        Prefs.layerPalSettings.visible = false;
452
        Prefs.bookmPalSettings.visible = false;
453
        Prefs.pagePalSettings.visible = false;
454
        Prefs.measurePalSettings.xPosition = 0;
455
        Prefs.measurePalSettings.yPosition = 0;
456
        Prefs.treePalSettings.xPosition = 0;
457
        Prefs.treePalSettings.yPosition = 0;
458
        Prefs.scrapPalSettings.xPosition = 0;
459
        Prefs.scrapPalSettings.yPosition = 0;
460
        Prefs.scrapPalSettings.width = 100;
461
        Prefs.scrapPalSettings.height = 200;
462
        Prefs.pagePalSettings.xPosition = 0;
463
        Prefs.pagePalSettings.yPosition = 0;
464
        Prefs.bookmPalSettings.xPosition = 0;
465
        Prefs.bookmPalSettings.yPosition = 0;
466
        Prefs.layerPalSettings.xPosition = 0;
467
        Prefs.layerPalSettings.yPosition = 0;
770 cbradney 468
        Prefs.PSize = 40;
469
        Prefs.SaveAtQ = true;
470
        Prefs.ClipMargin = true;
471
        Prefs.GCRMode = true;
472
        Prefs.RecentDocs.clear();
473
        Prefs.RecentDCount = 5;
1065 cbradney 474
        Prefs.marginColored = false;
770 cbradney 475
        Prefs.PageFormat = 4;
476
        Prefs.Ausrichtung = 0;
477
        Prefs.PageBreite = 595;
478
        Prefs.PageHoehe = 842;
479
        Prefs.RandOben = 9;
480
        Prefs.RandUnten = 40;
481
        Prefs.RandLinks = 9;
482
        Prefs.RandRechts = 9;
483
        Prefs.DoppelSeiten = false;
484
        Prefs.ErsteLinks = false;
1194 fschmid 485
        Prefs.toolSettings.scaleType = true;
486
        Prefs.toolSettings.aspectRatio = true;
770 cbradney 487
        Prefs.MinWordLen = 3;
488
        Prefs.HyCount = 2;
489
        Prefs.Language = "";
490
        Prefs.Automatic = true;
491
        Prefs.AutoCheck = false;
492
        Prefs.AutoSave = false;
493
        Prefs.AutoSaveTime = 600000;
494
        Prefs.DisScale = 1.0;
495
        Prefs.DocDir = QDir::homeDirPath();
496
        Prefs.ProfileDir = "";
497
        Prefs.ScriptDir = "";
498
        Prefs.TemplateDir = "";
499
        Prefs.CustomColorSets.clear();
500
        Prefs.PrPr_Mode = false;
501
        Prefs.Gcr_Mode = true;
502
        Prefs.PrPr_AlphaText = false;
503
        Prefs.PrPr_AlphaGraphics = false;
504
        Prefs.PrPr_Transparency = false;
505
        Prefs.PrPr_C = true;
506
        Prefs.PrPr_M = true;
507
        Prefs.PrPr_Y = true;
508
        Prefs.PrPr_K = true;
509
        Prefs.gimp_exe = "gimp";
510
        Prefs.gs_antiGraph = true;
511
        Prefs.gs_antiText = true;
512
        Prefs.gs_exe = "gs";
513
        Prefs.STEcolor = QColor(white);
514
        Prefs.STEfont = font().toString();
515
        Prefs.DCMSset.DefaultMonitorProfile = "";
516
        Prefs.DCMSset.DefaultPrinterProfile = "";
517
        Prefs.DCMSset.DefaultInputProfile = "";
518
        Prefs.DCMSset.DefaultInputProfile2 = "";
519
        Prefs.DCMSset.CMSinUse = false;
520
        Prefs.DCMSset.SoftProofOn = false;
521
        Prefs.DCMSset.GamutCheck = false;
522
        Prefs.DCMSset.BlackPoint = true;
523
        Prefs.DCMSset.DefaultIntentMonitor = 1;
524
        Prefs.DCMSset.DefaultIntentMonitor2 = 1;
525
        Prefs.DCMSset.DefaultIntentPrinter = 0;
526
        Prefs.GFontSub.clear();
801 cbradney 527
        Prefs.ScratchLeft = 100;
528
        Prefs.ScratchRight = 100;
529
        Prefs.ScratchTop = 20;
530
        Prefs.ScratchBottom = 20;
1235 fschmid 531
        Prefs.checkerSettings.ignoreErrors = false;
532
        Prefs.checkerSettings.autoCheck = true;
533
        Prefs.checkerSettings.checkGlyphs = true;
534
        Prefs.checkerSettings.checkOrphans = true;
535
        Prefs.checkerSettings.checkOverflow = true;
536
        Prefs.checkerSettings.checkPictures = true;
537
        Prefs.checkerSettings.checkResolution = true;
538
        Prefs.checkerSettings.checkTransparency = true;
539
        Prefs.checkerSettings.minResolution = 72.0;
801 cbradney 540
}
770 cbradney 541
 
801 cbradney 542
 
543
void ScribusApp::initDefaultValues()
544
{
831 cbradney 545
        dirs = prefsFile->getContext("dirs");
801 cbradney 546
        HaveDoc = 0;
547
        singleClose = false;
548
        ScriptRunning = false;
549
        DLLReturn = "";
550
        DLLinput = "";
551
        view = NULL;
552
        doc = NULL;
553
        Buffer2 = "";
554
        UniCinp = false;
555
        UniCinC = 0;
556
        UniCinS = "";
557
        DispX = 10;
558
        DispY = 10;
559
        DocNr = 1;
560
        UmReFaktor = 1.0;
561
        PrinterUsed = false;
562
        PDef.Pname = "";
563
        PDef.Dname = "";
564
        PDef.Command = "";
565
        keyrep = false;
1204 tsoots 566
        _arrowKeyDown = false;
801 cbradney 567
        ClipB = QApplication::clipboard();
568
        PalettesStat[0] = false;
569
        GuidesStat[0] = false;
570
 
571
        connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange()));
770 cbradney 572
}
573
 
801 cbradney 574
void ScribusApp::initKeyboardShortcuts()
575
{
1230 cbradney 576
        //Set up key entries
577
        //CB TODO Need to rewrite this key management stuff.. these would be much simpler done in the action themselves.
578
 
579
        //FILE MENU
580
        SetKeyEntry(0, scrActions["fileNew"]->cleanMenuText(), 0, scrActions["fileNew"]->accel(), "fileNew");
581
        SetKeyEntry(1, scrActions["fileOpen"]->cleanMenuText(), 0, scrActions["fileOpen"]->accel(), "fileOpen");
582
        SetKeyEntry(2, scrActions["fileClose"]->cleanMenuText(), 0, scrActions["fileClose"]->accel(), "fileClose");
583
        SetKeyEntry(3, scrActions["fileSave"]->cleanMenuText(), 0, scrActions["fileSave"]->accel(), "fileSave");
584
        SetKeyEntry(4, scrActions["fileSaveAs"]->cleanMenuText(), 0, scrActions["fileSaveAs"]->accel(), "fileSaveAs");
585
        //SetKeyEntry(, scrActions["fileRevert"]->cleanMenuText(), 0, scrActions["fileRevert"]->accel(), "fileRevert");
586
        //SetKeyEntry(, scrActions["fileCollect"]->cleanMenuText(), 0, scrActions["fileCollect"]->accel(), "fileCollect");
587
        SetKeyEntry(6, scrActions["fileDocSetup"]->cleanMenuText(), 0, scrActions["fileDocSetup"]->accel(), "fileDocSetup");
588
        SetKeyEntry(8, scrActions["fileQuit"]->cleanMenuText(), 0, scrActions["fileQuit"]->accel(), "fileQuit");
589
        //Included import & export options
590
        //SetKeyEntry(, scrActions["fileImportText"]->cleanMenuText(), 0, scrActions["fileImportText"]->accel(), "fileImportText");
591
        //SetKeyEntry(, scrActions["fileImportAppendText"]->cleanMenuText(), 0, scrActions["fileImportAppendText"]->accel(), "fileImportAppendText");
592
        //SetKeyEntry(, scrActions["fileImportImage"]->cleanMenuText(), 0, scrActions["fileImportImage"]->accel(), "fileImportImage");  
593
        //SetKeyEntry(, scrActions["fileImportPage"]->cleanMenuText(), 0, scrActions["fileImportPage"]->accel(), "fileImportPage");
594
        //SetKeyEntry(, scrActions["fileExportText"]->cleanMenuText(), 0, scrActions["fileExportText"]->accel(), "fileExportText");
595
        //SetKeyEntry(, scrActions["fileExportAsEPS"]->cleanMenuText(), 0, scrActions["fileExportAsEPS"]->accel(), "fileExportAsEPS");
596
        //SetKeyEntry(, scrActions["fileExportAsPDF"]->cleanMenuText(), 0, scrActions["fileExportAsPDF"]->accel(), "fileExportAsPDF");
597
 
598
        //EDIT MENU
599
        SetKeyEntry(9, scrActions["editCut"]->cleanMenuText(), 0, scrActions["editCut"]->accel(), "editCut");
600
        SetKeyEntry(10, scrActions["editCopy"]->cleanMenuText(), 0, scrActions["editCopy"]->accel(), "editCopy");
601
        SetKeyEntry(11, scrActions["editPaste"]->cleanMenuText(), 0, scrActions["editPaste"]->accel(), "editPaste");
602
        SetKeyEntry(12, scrActions["editClear"]->cleanMenuText(), 0, scrActions["editClear"]->accel(), "editClear");
603
        SetKeyEntry(13, scrActions["editSelectAll"]->cleanMenuText(), 0, scrActions["editSelectAll"]->accel(), "editSelectAll");
604
        SetKeyEntry(14, scrActions["editColors"]->cleanMenuText(), 0, scrActions["editColors"]->accel(), "editColors");
605
        SetKeyEntry(15, scrActions["editParaStyles"]->cleanMenuText(), 0, scrActions["editParaStyles"]->accel(), "editParaStyles");
606
        SetKeyEntry(16, scrActions["editTemplates"]->cleanMenuText(), 0, scrActions["editTemplates"]->accel(), "editTemplates");
607
        SetKeyEntry(17, scrActions["editFonts"]->cleanMenuText(), 0, scrActions["editFonts"]->accel(), "editFonts");
608
        //SetKeyEntry(, scrActions["editSearchReplace"]->cleanMenuText(), 0, scrActions["editSearchReplace"]->accel(), "editSearchReplace");
609
        //SetKeyEntry(, scrActions["editLineStyles"]->cleanMenuText(), 0, scrActions["editLineStyles"]->accel(), "editLineStyles");
1236 cbradney 610
 
1230 cbradney 611
        //SetKeyEntry(, scrActions["editFonts"]->cleanMenuText(), 0, scrActions["editFonts"]->accel(), "editFonts");
1236 cbradney 612
        SetKeyEntry(19, tr("Select New Font"), 0, 0);
1246 cbradney 613
 
614
        //ITEM MENU
615
        SetKeyEntry(20, scrActions["itemDuplicate"]->cleanMenuText(), 0, scrActions["itemDuplicate"]->accel(), "itemDuplicate");
616
        SetKeyEntry(21, scrActions["itemMulDuplicate"]->cleanMenuText(), 0, scrActions["itemMulDuplicate"]->accel(), "itemMulDuplicate");
617
        SetKeyEntry(22, scrActions["itemDelete"]->cleanMenuText(), 0, scrActions["itemDelete"]->accel(), "itemDelete");
618
        SetKeyEntry(23, scrActions["itemGroup"]->cleanMenuText(), 0, scrActions["itemGroup"]->accel(), "itemGroup");
619
        SetKeyEntry(24, scrActions["itemUngroup"]->cleanMenuText(), 0, scrActions["itemUngroup"]->accel(), "itemUngroup");
620
        SetKeyEntry(25, scrActions["itemSendToBack"]->cleanMenuText(), 0, scrActions["itemSendToBack"]->accel(), "itemSendToBack");
621
        SetKeyEntry(26, scrActions["itemBringToFront"]->cleanMenuText(), 0, scrActions["itemBringToFront"]->accel(), "itemBringToFront");
622
        SetKeyEntry(27, scrActions["itemLower"]->cleanMenuText(), 0, scrActions["itemLower"]->accel(), "itemLower");
623
        SetKeyEntry(28, scrActions["itemRaise"]->cleanMenuText(), 0, scrActions["itemRaise"]->accel(), "itemRaise");
624
        SetKeyEntry(29, scrActions["itemAlignDist"]->cleanMenuText(), 0, scrActions["itemAlignDist"]->accel(), "itemAlignDist");
625
        SetKeyEntry(67, scrActions["itemLock"]->cleanMenuText(), 0, scrActions["itemLock"]->accel(), "itemLock");
626
 
627
        //SetKeyEntry(, scrActions["itemShapeEdit"]->cleanMenuText(), 0, scrActions["itemShapeEdit"]->accel(), "itemShapeEdit");
628
                //CBSetKeyEntry(61, tr("Attach Text to Path"), M_ItemAttachTextToPath, 0);
629
        //SetKeyEntry(, scrActions["itemAttachTextToPath"]->cleanMenuText(), 0, scrActions["itemAttachTextToPath"]->accel(), "itemAttachTextToPath");
630
        //SetKeyEntry(, scrActions["itemDetachTextFromPath"]->cleanMenuText(), 0, scrActions["itemDetachTextFromPath"]->accel(), "itemDetachTextFromPath");
631
        //SetKeyEntry(, scrActions["itemCombinePolygons"]->cleanMenuText(), 0, scrActions["itemCombinePolygons"]->accel(), "itemCombinePolygons");
632
        //SetKeyEntry(, scrActions["itemSplitPolygons"]->cleanMenuText(), 0, scrActions["itemSplitPolygons"]->accel(), "itemSplitPolygons");
633
        //SetKeyEntry(, scrActions["itemConvertToOutlines"]->cleanMenuText(), 0, scrActions["itemConvertToOutlines"]->accel(), "itemConvertToOutlines");
634
 
635
        //PAGE MENU
636
        SetKeyEntry(30, scrActions["pageInsert"]->cleanMenuText(), 0, scrActions["pageInsert"]->accel(), "pageInsert");
637
        SetKeyEntry(31, scrActions["pageDelete"]->cleanMenuText(), 0, scrActions["pageDelete"]->accel(), "pageDelete");
638
        SetKeyEntry(32, scrActions["pageMove"]->cleanMenuText(), 0, scrActions["pageMove"]->accel(), "pageMove");
639
        SetKeyEntry(33, scrActions["pageApplyTemplate"]->cleanMenuText(), 0, scrActions["pageApplyTemplate"]->accel(), "pageApplyTemplate");
640
        SetKeyEntry(49, scrActions["pageManageGuides"]->cleanMenuText(), 0, scrActions["pageManageGuides"]->accel(), "pageManageGuides");
641
        SetKeyEntry(61, scrActions["pageCopy"]->cleanMenuText(), 0, scrActions["pageCopy"]->accel(), "pageCopy");
642
 
643
        //VIEW MENU
644
        SetKeyEntry(34, scrActions["viewFitInWindow"]->cleanMenuText(), 0, scrActions["viewFitInWindow"]->accel(), "viewFitInWindow");
645
        SetKeyEntry(35, scrActions["viewFit50"]->cleanMenuText(), 0, scrActions["viewFit50"]->accel(), "viewFit50");
646
        SetKeyEntry(36, scrActions["viewFit75"]->cleanMenuText(), 0, scrActions["viewFit75"]->accel(), "viewFit75");
647
        SetKeyEntry(37, scrActions["viewFit100"]->cleanMenuText(), 0, scrActions["viewFit100"]->accel(), "viewFit100");
648
        SetKeyEntry(38, scrActions["viewFit200"]->cleanMenuText(), 0, scrActions["viewFit200"]->accel(), "viewFit200");
649
        SetKeyEntry(39, scrActions["viewFit20"]->cleanMenuText(), 0, scrActions["viewFit20"]->accel(), "viewFit20");
650
        SetKeyEntry(40, scrActions["viewShowMargins"]->cleanMenuText(), 0, scrActions["viewShowMargins"]->accel(), "viewShowMargins");
651
        SetKeyEntry(41, scrActions["viewShowFrames"]->cleanMenuText(), 0, scrActions["viewShowFrames"]->accel(), "viewShowFrames");
652
        SetKeyEntry(42, scrActions["viewShowImages"]->cleanMenuText(), 0, scrActions["viewShowImages"]->accel(), "viewShowImages");
653
        SetKeyEntry(43, scrActions["viewShowGrid"]->cleanMenuText(), 0, scrActions["viewShowGrid"]->accel(), "viewShowGrid");
654
        SetKeyEntry(44, scrActions["viewSnapToGrid"]->cleanMenuText(), 0, scrActions["viewSnapToGrid"]->accel(), "viewSnapToGrid");
655
 
656
 
1230 cbradney 657
        //EXTRAS
801 cbradney 658
        SetKeyEntry(56, tr("Smart Hyphen"), 0, CTRL+Key_Minus);
659
        SetKeyEntry(57, tr("Align Left"), 0, CTRL+Key_L);
660
        SetKeyEntry(58, tr("Align Right"), 0, CTRL+Key_R);
661
        SetKeyEntry(59, tr("Align Center"), 0, CTRL+Key_E);
662
        SetKeyEntry(60, tr("Insert Page Number"), 0, CTRL+Key_NumberSign);
1236 cbradney 663
 
1246 cbradney 664
 
1236 cbradney 665
        SetKeyEntry(62, tr("Show Layers"), viewLpal, 0);
666
 
667
        SetKeyEntry(63, scrActions["editJavascripts"]->cleanMenuText(), 0, scrActions["editJavascripts"]->accel(), "editJavascripts");
668
        SetKeyEntry(64, scrActions["editUndoAction"]->cleanMenuText(), 0, scrActions["editUndoAction"]->accel(), "editUndoAction");
669
        SetKeyEntry(65, scrActions["editRedoAction"]->cleanMenuText(), 0, scrActions["editRedoAction"]->accel(), "editRedoAction");
670
 
671
        SetKeyEntry(66, tr("Show Page Palette"), viewSepal, 0);
672
 
1114 tsoots 673
        SetKeyEntry(68, tr("Non Breaking Space"), 0, CTRL+Key_Space);
1236 cbradney 674
 
801 cbradney 675
}
676
 
677
void ScribusApp::initArrowStyles()
678
{
1065 cbradney 679
        struct ArrowDesc arrow;
801 cbradney 680
        FPointArray points;
681
        QWMatrix arrowScaling;
682
        arrowScaling.scale(0.5, 0.5);
683
        arrow.name = "Arrow1L";
684
        arrow.userArrow = false;
685
        points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0);
686
        points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5);
687
        points.addQuadPoint(12, 0, 12, 0, 12, 0, 12, 0);
688
        points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5);
689
        points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0);
690
        arrow.points = points.copy();
691
        Prefs.arrowStyles.append(arrow);
692
        arrow.name = "Arrow1M";
693
        points.map(arrowScaling);
694
        arrow.points = points.copy();
695
        Prefs.arrowStyles.append(arrow);
696
        arrow.name = "Arrow1S";
697
        points.map(arrowScaling);
698
        arrow.points = points.copy();
699
        Prefs.arrowStyles.append(arrow);
700
        arrow.name = "SquareL";
701
        points.resize(0);
702
        points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5);
703
        points.addQuadPoint(5, -5, 5, -5, 5, -5, 5, -5);
704
        points.addQuadPoint(5, 5, 5, 5, 5, 5, 5, 5);
705
        points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5);
706
        points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5);
707
        arrow.points = points.copy();
708
        Prefs.arrowStyles.append(arrow);
709
        arrow.name = "SquareM";
710
        points.map(arrowScaling);
711
        arrow.points = points.copy();
712
        Prefs.arrowStyles.append(arrow);
713
        arrow.name = "SquareS";
714
        points.map(arrowScaling);
715
        arrow.points = points.copy();
716
        Prefs.arrowStyles.append(arrow);
717
        arrow.name = "TriangleInL";
718
        points.resize(0);
719
        points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0);
720
        points.addQuadPoint(-2.88, 5, -2.88, 5, -2.88, 5, -2.88, 5);
721
        points.addQuadPoint(-2.88, -5, -2.88, -5, -2.88, -5, -2.88, -5);
722
        points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0);
723
        arrow.points = points.copy();
724
        Prefs.arrowStyles.append(arrow);
725
        arrow.name = "TriangleInM";
726
        points.map(arrowScaling);
727
        arrow.points = points.copy();
728
        Prefs.arrowStyles.append(arrow);
729
        arrow.name = "TriangleInS";
730
        points.map(arrowScaling);
731
        arrow.points = points.copy();
732
        Prefs.arrowStyles.append(arrow);
733
        arrow.name = "TriangleOutL";
734
        points.resize(0);
735
        points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0);
736
        points.addQuadPoint(2.88, 5, 2.88, 5, 2.88, 5, 2.88, 5);
737
        points.addQuadPoint(2.88, -5, 2.88, -5, 2.88, -5, 2.88, -5);
738
        points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0);
739
        arrow.points = points.copy();
740
        Prefs.arrowStyles.append(arrow);
741
        arrow.name = "TriangleOutM";
742
        points.map(arrowScaling);
743
        arrow.points = points.copy();
744
        Prefs.arrowStyles.append(arrow);
745
        arrow.name = "TriangleOutS";
746
        points.map(arrowScaling);
747
        arrow.points = points.copy();
748
        Prefs.arrowStyles.append(arrow);
749
}
750
 
751
void ScribusApp::initPalettes()
752
{
753
        Tpal = new Tree(this, 0);
754
        Mpal = new Mpalette(this, &Prefs);
755
        Mpal->Cpal->SetColors(Prefs.DColors);
756
        Mpal->Cpal->UseTrans(true);
757
        Mpal->Fonts->RebuildList(&Prefs, 0);
758
        Npal = new NodePalette(this);
759
        Lpal = new LayerPalette(this);
760
        ScBook = new Biblio(this, &Prefs);
761
        Sepal = new SeitenPal(this);
762
        BookPal = new BookPalette(this);
763
        MaPal = new Measurements(this);
764
        MaPal->hide();
1232 fschmid 765
        docChecker = new CheckDocument(this, false);
766
        docChecker->hide();
801 cbradney 767
 
1114 tsoots 768
        undoPalette = new UndoPalette(this, "undoPalette");
1247 tsoots 769
        undoManager->registerGui(undoPalette);
1114 tsoots 770
 
801 cbradney 771
        connect(MaPal, SIGNAL(Schliessen(bool)), this, SLOT(setMapal(bool)));
772
        connect(Mpal, SIGNAL(DocChanged()), this, SLOT(slotDocCh()));
773
        connect(Mpal, SIGNAL(NewAbStyle(int)), this, SLOT(setNewAbStyle(int)));
774
        connect(Mpal, SIGNAL(BackHome()), this, SLOT(Aktiv()));
775
        connect(Mpal, SIGNAL(Stellung(int)), this, SLOT(setItemHoch(int)));
776
        connect(Mpal, SIGNAL(Schliessen()), this, SLOT(ToggleMpal()));
777
        connect(Mpal, SIGNAL(EditCL()), this, SLOT(ToggleFrameEdit()));
778
        connect(Mpal, SIGNAL(NewTF(QString)), this, SLOT(SetNewFont(QString)));
779
        connect(Mpal, SIGNAL(UpdtGui(int)), this, SLOT(HaveNewSel(int)));
780
        connect(Mpal->Cpal, SIGNAL(NewPen(QString)), this, SLOT(setPenFarbe(QString)));
781
        connect(Mpal->Cpal, SIGNAL(NewBrush(QString)), this, SLOT(setBrushFarbe(QString)));
782
        connect(Mpal->Cpal, SIGNAL(NewPenShade(int)), this, SLOT(setPenShade(int)));
783
        connect(Mpal->Cpal, SIGNAL(NewBrushShade(int)), this, SLOT(setBrushShade(int)));
784
        connect(Mpal->Cpal, SIGNAL(NewTrans(double)), this, SLOT(SetTranspar(double)));
785
        connect(Mpal->Cpal, SIGNAL(NewTransS(double)), this, SLOT(SetTransparS(double)));
786
        connect(Mpal->Cpal, SIGNAL(NewGradient(int)), this, SLOT(setGradFill(int)));
787
        connect(Mpal->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), this, SLOT(updtGradFill()));
788
        connect(Mpal->Cpal, SIGNAL(gradientChanged()), this, SLOT(updtGradFill()));
789
        connect(Mpal->Cpal, SIGNAL(QueryItem()), this, SLOT(GetBrushPen()));
1232 fschmid 790
        connect(docChecker, SIGNAL(closePal()), this, SLOT(ToggleCheckPal()));
791
        connect(docChecker, SIGNAL(rescan()), this, SLOT(slotCheckDoc()));
1235 fschmid 792
        connect(docChecker, SIGNAL(selectElement(int, int)), this, SLOT(SelectFromOutl(int, int)));
1244 fschmid 793
        connect(docChecker, SIGNAL(selectPage(int)), this, SLOT(SelectFromOutlS(int)));
801 cbradney 794
        connect(Tpal, SIGNAL(Schliessen()), this, SLOT(ToggleTpal()));
795
        connect(Tpal, SIGNAL(CloseMpal()), this, SLOT(ToggleMpal()));
796
        connect(Tpal, SIGNAL(CloseSpal()), this, SLOT(ToggleBpal()));
797
        connect(Tpal, SIGNAL(SelectElement(int, int)), this, SLOT(SelectFromOutl(int, int)));
798
        connect(Tpal, SIGNAL(SelectSeite(int)), this, SLOT(SelectFromOutlS(int)));
799
        connect(Tpal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
800
        connect(Mpal->Spal, SIGNAL(newStyle(int)), this, SLOT(setNewAbStyle(int)));
801
        connect(Mpal, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles()));
802
        connect(Mpal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
803
        connect(Mpal, SIGNAL(CloseTpal()), this, SLOT(ToggleTpal()));
804
        connect(Mpal, SIGNAL(CloseBpal()), this, SLOT(ToggleBpal()));
805
        connect(Npal, SIGNAL(Schliessen()), this, SLOT(NoFrameEdit()));
806
        connect(Lpal, SIGNAL(LayerActivated(int)), this, SLOT(changeLayer(int)));
807
        connect(Lpal, SIGNAL(LayerRemoved(int, bool)), this, SLOT(LayerRemove(int, bool)));
808
        connect(Lpal, SIGNAL(LayerChanged()), this, SLOT(showLayer()));
809
        connect(Lpal, SIGNAL(Schliessen()), this, SLOT(ToggleLpal()));
810
        connect(Lpal->Table, SIGNAL(Schliessen()), this, SLOT(ToggleLpal()));
811
        connect(Lpal->Table, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
812
        connect(Sepal, SIGNAL(Schliessen()), this, SLOT(ToggleSepal()));
813
        connect(Sepal, SIGNAL(EditTemp(QString)), this, SLOT(ManageTemp(QString)));
814
        connect(Sepal->PageView, SIGNAL(UseTemp(QString, int)), this, SLOT(Apply_Temp(QString, int)));
815
        connect(Sepal->PageView, SIGNAL(NewPage(int, QString)), this, SLOT(slotNewPageP(int, QString)));
816
        connect(Sepal->Trash, SIGNAL(DelPage(int)), this, SLOT(DeletePage2(int)));
817
        connect(Sepal, SIGNAL(GotoSeite(int)), this, SLOT(SelectFromOutlS(int)));
818
        connect(Sepal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
819
        connect(BookPal->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks()));
820
        connect(BookPal->BView, SIGNAL(ChangeBMNr(int, int, int)), this, SLOT(ChBookmarks(int, int, int)));
821
        connect(BookPal->BView, SIGNAL(SelectElement(int, int)), this, SLOT(SelectFromOutl(int, int)));
822
        connect(BookPal, SIGNAL(Schliessen()), this, SLOT(ToggleBookpal()));
823
        connect(BookPal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
824
}
825
 
826
void ScribusApp::initScrapbook()
827
{
1144 cbradney 828
        QString scrapbookFile = PrefsPfad+"/scrap13.scs";
801 cbradney 829
        QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile);
830
        if (scrapbookFileInfo.exists())
831
                ScBook->BibWin->ReadContents(scrapbookFile);
832
        ScBook->ScFilename = scrapbookFile;
833
        ScBook->AdjustMenu();
834
        connect(ScBook, SIGNAL(Schliessen()), this, SLOT(ToggleBpal()));
835
        connect(ScBook->BibWin, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes()));
836
        connect(ScBook->BibWin, SIGNAL(Schliessen()), this, SLOT(ToggleBpal()));
837
        connect(ScBook->BibWin, SIGNAL(CloseTpal()), this, SLOT(ToggleTpal()));
838
        connect(ScBook->BibWin, SIGNAL(CloseMpal()), this, SLOT(ToggleMpal()));
839
}
840
 
841
void ScribusApp::initCrashHandler()
842
{
843
        typedef void (*HandlerType)(int);
844
        HandlerType handler     = 0;
845
        handler = ScribusApp::defaultCrashHandler;
846
        if (!handler)
847
                handler = SIG_DFL;
848
        sigset_t mask;
849
        sigemptyset(&mask);
850
#ifdef SIGSEGV
851
        signal (SIGSEGV, handler);
852
        sigaddset(&mask, SIGSEGV);
853
#endif
854
#ifdef SIGFPE
855
        signal (SIGFPE, handler);
856
        sigaddset(&mask, SIGFPE);
857
#endif
858
#ifdef SIGILL
859
        signal (SIGILL, handler);
860
        sigaddset(&mask, SIGILL);
861
#endif
862
#ifdef SIGABRT
863
        signal (SIGABRT, handler);
864
        sigaddset(&mask, SIGABRT);
865
#endif
866
        sigprocmask(SIG_UNBLOCK, &mask, 0);
867
}
868
 
770 cbradney 869
const QString ScribusApp::getGuiLanguage()
870
{
871
        return guiLanguage;
872
}
873
 
675 cbradney 874
/*!
875
 \fn QString ScribusApp::getPreferencesLocation()
876
 \author Craig Bradney
877
 \date Thu 18 Nov 2004
878
 \brief Get the user's preference file location. Rename any existing old preferences files
879
 \param None
880
 \retval QString Location of the user's preferences
881
 */
882
 
883
QString ScribusApp::getPreferencesLocation()
884
{
885
        QString Pff = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus");
886
        QFileInfo Pffi = QFileInfo(Pff);
887
        QString PrefsPfad;
1144 cbradney 888
        //If we are using ~/.scribus
675 cbradney 889
        if (Pffi.exists())
890
        {
891
                if (Pffi.isDir())
892
                        PrefsPfad = Pff;
893
                else
894
                        PrefsPfad = QDir::homeDirPath();
895
        }
1144 cbradney 896
        else // Move to using ~/.scribus/scribus.* from ~/.scribus.*
675 cbradney 897
        {
1144 cbradney 898
                QDir prefsDirectory = QDir();
899
                prefsDirectory.mkdir(Pff);
675 cbradney 900
                PrefsPfad = Pff;
1144 cbradney 901
                QString oldPR = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus.rc");
902
                QFileInfo oldPi = QFileInfo(oldPR);
903
                if (oldPi.exists())
904
                        moveFile(oldPR, Pff+"/scribus.rc");
905
                QString oldPR2 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusfont.rc");
906
                QFileInfo oldPi2 = QFileInfo(oldPR2);
907
                if (oldPi2.exists())
908
                        moveFile(oldPR2, Pff+"/scribusfont.rc");
909
                QString oldPR3 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusscrap.scs");
910
                QFileInfo oldPi3 = QFileInfo(oldPR3);
911
                if (oldPi3.exists())
912
                        moveFile(oldPR3, Pff+"/scrap.scs");
675 cbradney 913
        }
1144 cbradney 914
 
915
        //Now make copies for 1.3 use and leave the old ones alone for <1.3.0 usage
916
        QString oldPR =QDir::convertSeparators(PrefsPfad+"/scribus.rc");
917
        QString oldPR2=QDir::convertSeparators(PrefsPfad+"/scribusfont.rc");
918
        QString oldPR3=QDir::convertSeparators(PrefsPfad+"/scrap.scs");
919
        QString oldPR4=QDir::convertSeparators(PrefsPfad+"/prefs.xml");
920
        QString newPR =QDir::convertSeparators(PrefsPfad+"/scribus13.rc");
921
        QString newPR2=QDir::convertSeparators(PrefsPfad+"/scribusfont13.rc");
922
        QString newPR3=QDir::convertSeparators(PrefsPfad+"/scrap13.scs");
923
        QString newPR4=QDir::convertSeparators(PrefsPfad+"/prefs13.xml");
924
 
925
        bool existsOldPR =QFile::exists(oldPR);
926
        bool existsOldPR2=QFile::exists(oldPR2);
927
        bool existsOldPR3=QFile::exists(oldPR3);
928
        bool existsOldPR4=QFile::exists(oldPR4);
929
        bool existsNewPR =QFile::exists(newPR);
930
        bool existsNewPR2=QFile::exists(newPR2);
931
        bool existsNewPR3=QFile::exists(newPR3);
932
        bool existsNewPR4=QFile::exists(newPR4);       
933
 
934
        //Only check for these two as they will be autocreated if they dont exist.
935
        if( (existsOldPR && !existsNewPR) || (existsOldPR4 && !existsNewPR4) )
936
        {
937
                if (splashScreen)
938
                        splashScreen->hide();
939
                if ( (QMessageBox::question( this, tr("Migrate Old Scribus Settings?"),
940
                                tr("Scribus has detected existing Scribus 1.2 preferences files.\n"
941
                                        "Do you want to migrate them to the new Scribus version?"),
1208 cbradney 942
                                QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::NoButton))==QMessageBox::Yes )
1144 cbradney 943
                {
944
                        if (existsOldPR && !existsNewPR)
945
                                copyFile(oldPR, newPR);
946
                        if (existsOldPR2 && !existsNewPR2)
947
                                copyFile(oldPR2, newPR2);
948
                        if (existsOldPR3 && !existsNewPR3)
949
                                copyFile(oldPR3, newPR3);
950
                        if (existsOldPR4 && !existsNewPR4)
951
                                copyFile(oldPR4, newPR4);
952
                }
953
                if (splashScreen)
954
                        splashScreen->show();
955
        }
675 cbradney 956
        return PrefsPfad;
957
}
958
 
1144 cbradney 959
/*!
960
 \fn QString ScribusApp::convertToXMLPreferences(QString prefsLocation)
961
 \author Craig Bradney
962
 \date Sun 09 Jan 2005
963
 \brief Convert 1.2 prefs to 1.3 prefs
964
 \param prefsLocation Location of user preferences
965
 \retval None
966
 */
1208 cbradney 967
void ScribusApp::convertToXMLPreferences(const QString prefsLocation)
1144 cbradney 968
{
969
 
970
}
971
 
1227 cbradney 972
void ScribusApp::initFileMenuActions()
1208 cbradney 973
{
974
        //File Menu
1230 cbradney 975
        scrActions.insert("fileNew", new ScrAction(QIconSet(loadIcon("DateiNeu16.png"), loadIcon("DateiNeu.xpm")), tr("&New"), CTRL+Key_N, this, "fileNew"));  
1208 cbradney 976
        scrActions.insert("fileOpen", new ScrAction(QIconSet(loadIcon("DateiOpen16.png"), loadIcon("DateiOpen.xpm")), tr("&Open..."), CTRL+Key_O, this, "fileOpen"));
977
        scrActions.insert("fileClose", new ScrAction(QIconSet(loadIcon("DateiClos16.png"), loadIcon("DateiClose.png")), tr("&Close"), CTRL+Key_W, this, "fileClose"));
978
        scrActions.insert("fileSave", new ScrAction(QIconSet(loadIcon("DateiSave16.png"), loadIcon("DateiSave2.png")), tr("&Save"), CTRL+Key_S, this, "fileSave"));
979
        scrActions.insert("fileSaveAs", new ScrAction(QPixmap(loadIcon("filesaveas.png")), tr("Save &As..."), QKeySequence(), this, "fileSaveAs"));
980
        scrActions.insert("fileRevert", new ScrAction(QPixmap(loadIcon("revert.png")), tr("Re&vert to Saved"), QKeySequence(), this, "fileRevert"));
981
        scrActions.insert("fileCollect", new ScrAction(tr("Collect for O&utput..."), QKeySequence(), this, "fileCollect"));
982
        //File Import Menu
983
        scrActions.insert("fileImportText", new ScrAction(tr("Get Text..."), QKeySequence(), this, "fileImportText"));
984
        scrActions.insert("fileImportAppendText", new ScrAction(tr("Append &Text..."), QKeySequence(), this, "fileImportAppendText"));
985
        scrActions.insert("fileImportImage", new ScrAction(tr("Get Image..."), QKeySequence(), this, "fileImportImage"));
986
 
987
        scrActions.insert("fileImportEPS", new ScrAction(tr("Import EPS..."), QKeySequence(), this, "fileImportEPS"));
988
        scrActions.insert("fileImportPage", new ScrAction(tr("Import Page(s)..."), QKeySequence(), this, "fileImportPage"));
989
        scrActions.insert("fileImportOOorgDraw", new ScrAction(tr("Import OpenOffice.org Draw..."), QKeySequence(), this, "fileImportOOorgDraw"));
990
        scrActions.insert("fileImportSVG", new ScrAction(tr("Import SVG..."), QKeySequence(), this, "fileImportSVG"));
991
 
992
        //File Export Menu
993
        scrActions.insert("fileExportText", new ScrAction(tr("Save &Text..."), QKeySequence(), this, "fileExportText"));
994
        scrActions.insert("fileExportAsEPS", new ScrAction(tr("Save Page as &EPS..."), QKeySequence(), this, "fileExportAsEPS"));
995
        scrActions.insert("fileExportAsPDF", new ScrAction(loadIcon("acrobat.png"), tr("Save as P&DF..."), QKeySequence(), this, "fileExportAsPDF"));
996
        scrActions.insert("fileExportAsImage", new ScrAction(tr("Save as &Image..."), QKeySequence(), this, "fileExportAsImage"));
997
        scrActions.insert("fileExportAsSVG", new ScrAction(tr("Save Page as &SVG..."), QKeySequence(), this, "fileExportAsSVG"));
998
        //Rest of File Menu
999
        scrActions.insert("fileDocInfo", new ScrAction(loadIcon("documentinfo.png"), tr("Document &Information..."), CTRL+Key_I, this, "fileDocSetup"));
1000
        scrActions.insert("fileDocSetup", new ScrAction(tr("Document &Setup..."), QKeySequence(), this, "fileDocSetup"));
1001
        scrActions.insert("filePrint", new ScrAction(QIconSet(loadIcon("DateiPrint16.png"), loadIcon("DateiPrint.xpm")), tr("&Print..."), CTRL+Key_P, this, "filePrint"));
1002
        scrActions.insert("fileQuit", new ScrAction(QPixmap(loadIcon("exit.png")), tr("&Quit"), CTRL+Key_Q, this, "fileQuit"));
1003
 
1227 cbradney 1004
        //Set some tooltips, unsure yet whether to use these, probably not as they arent flexible like normal actions ones can be
1005
        /*
1006
        scrActions["fileNew"]->setToolTip(tr("Create a new document"));
1007
        scrActions["fileOpen"]->setToolTip(tr("Open a document"));
1008
        scrActions["fileSave"]->setToolTip(tr("Save the current document"));
1009
        scrActions["fileClose"]->setToolTip(tr("Close the current document"));
1010
        scrActions["filePrint"]->setToolTip(tr("Print the current document"));
1011
        scrActions["fileExportAsPDF"]->setToolTip(tr("Save the current document as PDF"));
1012
        */
1208 cbradney 1013
        //Connect our signals and slots
1014
        //File Menu
1015
        connect( scrActions["fileNew"], SIGNAL(activated()) , this, SLOT(slotFileNew()) );
1016
        connect( scrActions["fileOpen"], SIGNAL(activated()) , this, SLOT(slotDocOpen()) );
1017
        connect( scrActions["fileClose"], SIGNAL(activated()) , this, SLOT(slotFileClose()) );
1018
        connect( scrActions["filePrint"], SIGNAL(activated()) , this, SLOT(slotFilePrint()) );
1019
        connect( scrActions["fileSave"], SIGNAL(activated()) , this, SLOT(slotFileSave()) );
1020
        connect( scrActions["fileSave"], SIGNAL(activated()) , this, SLOT(slotFileSave()) );
1021
        connect( scrActions["fileSaveAs"], SIGNAL(activated()) , this, SLOT(slotFileSaveAs()) );
1022
        connect( scrActions["fileDocInfo"], SIGNAL(activated()) , this, SLOT(InfoDoc()) );
1023
        connect( scrActions["fileDocSetup"], SIGNAL(activated()) , this, SLOT(SetupDoc()) );
1024
        connect( scrActions["fileRevert"], SIGNAL(activated()) , this, SLOT(slotFileRevert()) );
1025
        connect( scrActions["fileCollect"], SIGNAL(activated()) , this, SLOT(Collect()) );
1026
        connect( scrActions["fileQuit"], SIGNAL(activated()) , this, SLOT(slotFileQuit()) );
1027
        //File Import Menu
1028
        connect( scrActions["fileImportText"], SIGNAL(activated()) , this, SLOT(slotFileOpen()) );
1029
        connect( scrActions["fileImportAppendText"], SIGNAL(activated()) , this, SLOT(slotFileAppend()) );
1030
        connect( scrActions["fileImportImage"], SIGNAL(activated()) , this, SLOT(slotFileOpen()) );    
1031
        connect( scrActions["fileImportPage"], SIGNAL(activated()) , this, SLOT(slotDocMerge()) );
1032
        //File Export Menu
1033
        connect( scrActions["fileExportText"], SIGNAL(activated()) , this, SLOT(SaveText()) );
1034
        connect( scrActions["fileExportAsEPS"], SIGNAL(activated()) , this, SLOT(SaveAsEps()) );
1035
        connect( scrActions["fileExportAsPDF"], SIGNAL(activated()) , this, SLOT(SaveAsPDF()) );
1036
        //The rest are plugins
1037
}
1038
 
1227 cbradney 1039
void ScribusApp::initEditMenuActions()
1040
{
1041
        //Edit Menu
1042
        scrActions.insert("editUndoAction", new ScrAction(QIconSet(loadIcon("u_undo16.png"), loadIcon("u_undo.png")), tr("&Undo"), CTRL+Key_Z, this, "editUndo"));
1043
        scrActions.insert("editRedoAction", new ScrAction(QIconSet(loadIcon("u_redo16.png"), loadIcon("u_redo.png")), tr("&Redo"), CTRL+SHIFT+Key_Z, this, "editRedo"));
1044
        scrActions.insert("editActionMode", new ScrAction(tr("&Item Action Mode"), QKeySequence(), this, "editActionMode"));
1045
        scrActions.insert("editCut", new ScrAction(QIconSet(loadIcon("editcut.png"), loadIcon("editcut.png")), tr("Cu&t"), CTRL+Key_X, this, "editCut"));
1046
        scrActions.insert("editCopy", new ScrAction(QIconSet(loadIcon("editcopy.png"), loadIcon("editcopy.png")), tr("&Copy"), CTRL+Key_C, this, "editCopy"));
1047
        scrActions.insert("editPaste", new ScrAction(QIconSet(loadIcon("editpaste.png"), loadIcon("editpaste.png")), tr("&Paste"), CTRL+Key_V, this, "editPaste"));
1048
        scrActions.insert("editClear", new ScrAction(QIconSet(loadIcon("editClear.png"), loadIcon("editClear.png")), tr("C&lear"), QKeySequence(), this, "editClear"));
1049
        scrActions.insert("editSelectAll", new ScrAction(tr("Select &All"), CTRL+Key_A, this, "editSelectall"));
1050
        scrActions.insert("editSearchReplace", new ScrAction(QIconSet(loadIcon("find16.png"), loadIcon("find16.png")),  tr("&Search/Replace..."), QKeySequence(), this, "editSearchReplace"));
1051
 
1052
        scrActions.insert("editColors", new ScrAction(tr("C&olors..."), QKeySequence(), this, "editColors"));
1053
        scrActions.insert("editParaStyles", new ScrAction(tr("&Paragraph Styles..."), QKeySequence(), this, "editParaStyles"));
1054
        scrActions.insert("editLineStyles", new ScrAction(tr("&Line Styles..."), QKeySequence(), this, "editLineStyles"));
1055
        scrActions.insert("editTemplates", new ScrAction(tr("&Templates..."), QKeySequence(), this, "editTemplates"));
1056
        scrActions.insert("editJavascripts", new ScrAction(tr("&Javascripts..."), QKeySequence(), this, "editJavascripts"));
1057
        scrActions.insert("editPreferences", new ScrAction(tr("P&references..."), QKeySequence(), this, "editPreferences"));
1058
        scrActions.insert("editFonts", new ScrAction(tr("&Fonts..."), QKeySequence(), this, "editFonts"));
1059
 
1060
        connect( scrActions["editUndoAction"], SIGNAL(activated()) , this, SLOT(UnDoAction()) );
1061
        connect( scrActions["editRedoAction"], SIGNAL(activated()) , this, SLOT(RedoAction()) );
1062
        //TODO connect( scrActions["editActionMode"], SIGNAL(activated()) , this, SLOT(RedoAction()) );
1063
        connect( scrActions["editCut"], SIGNAL(activated()) , this, SLOT(slotEditCut()) );
1064
        connect( scrActions["editCopy"], SIGNAL(activated()) , this, SLOT(slotEditCopy()) );
1065
        connect( scrActions["editPaste"], SIGNAL(activated()) , this, SLOT(slotEditPaste()) );
1066
        connect( scrActions["editClear"], SIGNAL(activated()) , this, SLOT(DeleteText()) );
1067
        connect( scrActions["editSelectAll"], SIGNAL(activated()) , this, SLOT(SelectAll()) );
1068
        connect( scrActions["editSearchReplace"], SIGNAL(activated()), this, SLOT(SearchText()) );
1069
        connect( scrActions["editColors"], SIGNAL(activated()) , this, SLOT(slotEditColors()) );
1070
        connect( scrActions["editParaStyles"], SIGNAL(activated()) , this, SLOT(slotEditStyles()) );
1071
        connect( scrActions["editLineStyles"], SIGNAL(activated()) , this, SLOT(slotEditLineStyles()) );
1072
        connect( scrActions["editTemplates"], SIGNAL(activated()) , this, SLOT(ManageTemp()) );
1073
        connect( scrActions["editJavascripts"], SIGNAL(activated()) , this, SLOT(ManageJava()) );
1074
        connect( scrActions["editPreferences"], SIGNAL(activated()) , this, SLOT(slotPrefsOrg()) );
1075
        connect( scrActions["editFonts"], SIGNAL(activated()) , this, SLOT(slotFontOrg()) );
1076
}
1077
 
1236 cbradney 1078
void ScribusApp::initStyleMenuActions()
1079
{
1080
}
1081
 
1082
void ScribusApp::initItemMenuActions()
1083
{
1084
        //Item Menu
1085
        scrActions.insert("itemDuplicate", new ScrAction(tr("D&uplicate"), CTRL+Key_D, this, "itemDuplicate"));
1086
        scrActions.insert("itemMulDuplicate", new ScrAction(tr("&Multiple Duplicate"), QKeySequence(), this, "itemMulDuplicate"));
1087
        scrActions.insert("itemDelete", new ScrAction(tr("&Delete"), CTRL+Key_K, this, "itemDelete"));
1088
        scrActions.insert("itemGroup", new ScrAction(tr("&Group"), CTRL+Key_G, this, "itemGroup"));
1089
        scrActions.insert("itemUngroup", new ScrAction(tr("&Ungroup"), CTRL+Key_U, this, "itemUngroup"));
1090
        scrActions.insert("itemLock", new ScrAction(tr("Is &Locked"), CTRL+Key_F, this, "itemLock"));
1091
        scrActions["itemLock"]->setToggleAction(true);
1092
        scrActions.insert("itemSendToBack", new ScrAction(tr("Send to &Back"), QKeySequence(), this, "itemSendToBack"));
1093
        scrActions.insert("itemBringToFront", new ScrAction(tr("Bring to &Front"), QKeySequence(), this, "itemBringToFront"));
1094
        scrActions.insert("itemLower", new ScrAction(tr("&Lower"), QKeySequence(), this, "itemLower"));
1095
        scrActions.insert("itemRaise", new ScrAction(tr("&Raise"), QKeySequence(), this, "itemRaise"));
1096
        scrActions.insert("itemAlignDist", new ScrAction(tr("Distribute/&Align..."), QKeySequence(), this, "itemAlignDist"));
1097
 
1098
        scrActions.insert("itemShapeEdit", new ScrAction(tr("&Edit Shape..."), QKeySequence(), this, "itemShapeEdit"));
1099
        scrActions["itemShapeEdit"]->setToggleAction(true);
1100
        scrActions.insert("itemAttachTextToPath", new ScrAction(tr("&Attach Text to Path"), QKeySequence(), this, "itemAttachTextToPath"));
1101
        scrActions.insert("itemDetachTextFromPath", new ScrAction(tr("&Detach Text from Path"), QKeySequence(), this, "itemDetachTextFromPath"));
1102
        scrActions.insert("itemCombinePolygons", new ScrAction(tr("&Combine Polygons"), QKeySequence(), this, "itemCombinePolygons"));
1103
        scrActions.insert("itemSplitPolygons", new ScrAction(tr("Split &Polygons"), QKeySequence(), this, "itemSplitPolygons"));
1104
        scrActions.insert("itemConvertToOutlines", new ScrAction(tr("C&onvert to Outlines"), QKeySequence(), this, "itemConvertToOutlines"));
1105
 
1106
        connect( scrActions["itemDuplicate"], SIGNAL(activated()) , this, SLOT(ObjektDup()) );
1107
        connect( scrActions["itemMulDuplicate"], SIGNAL(activated()) , this, SLOT(ObjektDupM()) );
1108
        connect( scrActions["itemDelete"], SIGNAL(activated()) , this, SLOT(DeleteObjekt()) );
1109
        connect( scrActions["itemGroup"], SIGNAL(activated()) , this, SLOT(GroupObj()) );
1110
        connect( scrActions["itemUngroup"], SIGNAL(activated()) , this, SLOT(UnGroupObj()) );
1111
        connect( scrActions["itemLock"], SIGNAL(activated()) , this, SLOT(ToggleObjLock()) );
1112
        connect( scrActions["itemSendToBack"], SIGNAL(activated()) , this, SLOT(Objekt2Back()) );
1113
        connect( scrActions["itemBringToFront"], SIGNAL(activated()) , this, SLOT(Objekt2Front()) );
1114
        connect( scrActions["itemLower"], SIGNAL(activated()) , this, SLOT(ObjektLower()) );
1115
        connect( scrActions["itemRaise"], SIGNAL(activated()) , this, SLOT(ObjektRaise()) );
1116
        connect( scrActions["itemAlignDist"], SIGNAL(activated()) , this, SLOT(ObjektAlign()) );
1117
        connect( scrActions["itemShapeEdit"], SIGNAL(activated()) , this, SLOT(ToggleFrameEdit()) );
1118
        connect( scrActions["itemAttachTextToPath"], SIGNAL(activated()) , this, SLOT(Pfadtext()) );
1119
        connect( scrActions["itemDetachTextFromPath"], SIGNAL(activated()) , this, SLOT(noPfadtext()) );
1120
        connect( scrActions["itemCombinePolygons"], SIGNAL(activated()) , this, SLOT(UniteOb()) );
1121
        connect( scrActions["itemSplitPolygons"], SIGNAL(activated()) , this, SLOT(SplitUniteOb()) );
1122
        connect( scrActions["itemConvertToOutlines"], SIGNAL(activated()) , this, SLOT(TraceText()) );
1123
}
1124
 
1125
void ScribusApp::initPageMenuActions()
1126
{
1127
        //Page menu
1128
        scrActions.insert("pageInsert", new ScrAction(tr("&Insert..."), QKeySequence(), this, "PageInsert"));
1129
        scrActions.insert("pageDelete", new ScrAction(tr("&Delete..."), QKeySequence(), this, "pageDelete"));
1130
        scrActions.insert("pageCopy", new ScrAction(tr("&Copy..."), QKeySequence(), this, "pageCopy"));
1131
        scrActions.insert("pageMove", new ScrAction(tr("&Move..."), QKeySequence(), this, "pageMove"));
1132
        scrActions.insert("pageApplyTemplate", new ScrAction(tr("&Apply Template..."), QKeySequence(), this, "pageApplyTemplate"));
1133
        scrActions.insert("pageManageGuides", new ScrAction(tr("Manage &Guides..."), QKeySequence(), this, "pageManageGuides"));
1134
 
1135
        connect( scrActions["pageInsert"], SIGNAL(activated()) , this, SLOT(slotNewPageM()) );
1136
        connect( scrActions["pageDelete"], SIGNAL(activated()) , this, SLOT(DeletePage()) );
1137
        connect( scrActions["pageCopy"], SIGNAL(activated()) , this, SLOT(CopyPage()) );
1138
        connect( scrActions["pageMove"], SIGNAL(activated()) , this, SLOT(MovePage()) );
1139
        connect( scrActions["pageApplyTemplate"], SIGNAL(activated()) , this, SLOT(ApplyTemp()) );
1140
        connect( scrActions["pageManageGuides"], SIGNAL(activated()) , this, SLOT(ManageGuides()) );
1141
}
1142
 
1143
void ScribusApp::initViewMenuActions()
1144
{
1246 cbradney 1145
        scrActions.insert("viewFitInWindow", new ScrAction(tr("&Fit in window"), CTRL+Key_0, this, "viewFitInWindow"));
1146
        scrActions.insert("viewFit50", new ScrAction(tr("&50%"), QKeySequence(), this, "viewFit50"));
1147
        scrActions.insert("viewFit75", new ScrAction(tr("&75%"), QKeySequence(), this, "viewFit75"));
1148
        scrActions.insert("viewFit100", new ScrAction(tr("&100%"), CTRL+Key_1, this, "viewFit100"));
1149
        scrActions.insert("viewFit200", new ScrAction(tr("&200%"), QKeySequence(), this, "viewFit200"));
1150
        scrActions.insert("viewFit20", new ScrAction(tr("&Thumbnails"), QKeySequence(), this, "viewFit20"));
1151
        scrActions.insert("viewShowMargins", new ScrAction(tr("Show &Margins"), QKeySequence(), this, "viewShowMargins"));
1152
        scrActions.insert("viewShowFrames", new ScrAction(tr("Show &Frames"), QKeySequence(), this, "viewShowFrames"));
1153
        scrActions.insert("viewShowImages", new ScrAction(tr("Show &Images"), QKeySequence(), this, "viewShowImages"));
1154
        scrActions.insert("viewShowGrid", new ScrAction(tr("Show &Grid"), QKeySequence(), this, "viewShowGrid"));
1155
        scrActions.insert("viewShowGuides", new ScrAction(tr("Show G&uides"), QKeySequence(), this, "viewShowGuides"));
1156
        scrActions.insert("viewShowBaseline", new ScrAction(tr("Show &Baseline Grid"), QKeySequence(), this, "viewShowBaseline"));
1157
        scrActions.insert("viewShowTextChain", new ScrAction(tr("Show &Text Chain"), QKeySequence(), this, "viewShowTextChain"));
1158
        scrActions.insert("viewSnapToGrid", new ScrAction(tr("Sn&ap to Grid"), QKeySequence(), this, "viewSnapToGrid"));
1159
        scrActions.insert("viewSnapToGuides", new ScrAction(tr("Sna&p to Guides"), QKeySequence(), this, "viewSnapToGuides"));
1160
 
1161
        scrActions["viewShowMargins"]->setToggleAction(true);
1162
        scrActions["viewShowFrames"]->setToggleAction(true);
1163
        scrActions["viewShowImages"]->setToggleAction(true);
1164
        scrActions["viewShowGrid"]->setToggleAction(true);
1165
        scrActions["viewShowGuides"]->setToggleAction(true);
1166
        scrActions["viewShowBaseline"]->setToggleAction(true);
1167
        scrActions["viewShowTextChain"]->setToggleAction(true);
1168
        scrActions["viewSnapToGrid"]->setToggleAction(true);
1169
        scrActions["viewSnapToGuides"]->setToggleAction(true);
1170
 
1171
        scrActions["viewShowMargins"]->setOn(true);
1172
        scrActions["viewShowFrames"]->setOn(true);
1173
        scrActions["viewShowImages"]->setOn(true);
1174
        scrActions["viewShowGuides"]->setOn(true);
1175
 
1176
        connect( scrActions["viewFitInWindow"], SIGNAL(activated()) , this, SLOT(slotZoomFit()) );
1177
        connect( scrActions["viewFit50"], SIGNAL(activated()) , this, SLOT(slotZoom50()) );
1178
        connect( scrActions["viewFit75"], SIGNAL(activated()) , this, SLOT(slotZoom75()) );
1179
        connect( scrActions["viewFit100"], SIGNAL(activated()) , this, SLOT(slotZoom100()) );
1180
        connect( scrActions["viewFit200"], SIGNAL(activated()) , this, SLOT(slotZoom200()) );
1181
        connect( scrActions["viewFit20"], SIGNAL(activated()) , this, SLOT(slotZoom20()) );
1182
        connect( scrActions["viewShowMargins"], SIGNAL(activated()) , this, SLOT(ToggleMarks()) );
1183
        connect( scrActions["viewShowFrames"], SIGNAL(activated()) , this, SLOT(ToggleFrames()) );
1184
        connect( scrActions["viewShowImages"], SIGNAL(activated()) , this, SLOT(TogglePics()) );
1185
        connect( scrActions["viewShowGrid"], SIGNAL(activated()) , this, SLOT(ToggleRaster()) );
1186
        connect( scrActions["viewShowGuides"], SIGNAL(activated()) , this, SLOT(ToggleGuides()) );
1187
        connect( scrActions["viewShowBaseline"], SIGNAL(activated()) , this, SLOT(ToggleBase()) );
1188
        connect( scrActions["viewShowTextChain"], SIGNAL(activated()) , this, SLOT(ToggleTextLinks()) );
1189
        connect( scrActions["viewSnapToGrid"], SIGNAL(activated()) , this, SLOT(ToggleURaster()) );    
1190
        connect( scrActions["viewSnapToGuides"], SIGNAL(activated()) , this, SLOT(ToggleUGuides()) );  
1191
 
1236 cbradney 1192
}
1193
 
1194
void ScribusApp::initToolsMenuActions()
1195
{
1196
}
1197
 
1198
void ScribusApp::initExtrasMenuActions()
1199
{
1200
}
1201
 
1202
void ScribusApp::initWindowsMenuActions()
1203
{
1204
}
1205
 
1206
void ScribusApp::initScriptMenuActions()
1207
{
1208
}
1209
 
1210
void ScribusApp::initHelpMenuActions()
1211
{
1212
}
1213
 
3 paul 1214
void ScribusApp::initMenuBar()
1215
{
1216
        int MenID;
1217
        QFont tmp;
1218
        RecentDocs.clear();
1208 cbradney 1219
 
1227 cbradney 1220
        initFileMenuActions();
1221
        initEditMenuActions();
1236 cbradney 1222
        initStyleMenuActions();
1223
        initItemMenuActions();
1224
        initPageMenuActions();
1225
        initViewMenuActions();
1226
        initToolsMenuActions();
1227
        initExtrasMenuActions();
1228
        initWindowsMenuActions();
1229
        initScriptMenuActions();
1230
        initHelpMenuActions();
1208 cbradney 1231
 
1232
        scrMenuMgr->createMenu("File", tr("&File"));
1233
        scrMenuMgr->addMenuItem(scrActions["fileNew"], "File");
1234
        scrMenuMgr->addMenuItem(scrActions["fileOpen"], "File");
1235
        recentFileMenuName="FileOpenRecent";
1236
        scrMenuMgr->createMenu(recentFileMenuName, tr("Open &Recent"), "File");
1237
        scrMenuMgr->addMenuSeparator("File");
1238
        scrMenuMgr->addMenuItem(scrActions["fileClose"], "File");
1239
        scrMenuMgr->addMenuItem(scrActions["fileSave"], "File");
1240
        scrMenuMgr->addMenuItem(scrActions["fileSaveAs"], "File");
1241
        scrMenuMgr->addMenuItem(scrActions["fileRevert"], "File");
1242
        scrMenuMgr->addMenuItem(scrActions["fileCollect"], "File");
1243
        scrMenuMgr->addMenuSeparator("File");
1244
        scrMenuMgr->createMenu("FileImport", tr("&Import"), "File");
1245
        scrMenuMgr->addMenuItem(scrActions["fileImportText"], "FileImport");
1246
        scrMenuMgr->addMenuItem(scrActions["fileImportAppendText"], "FileImport");
1247
        scrMenuMgr->addMenuItem(scrActions["fileImportImage"], "FileImport");
1248
        scrMenuMgr->addMenuItem(scrActions["fileImportPage"], "FileImport");
1249
        scrMenuMgr->createMenu("FileExport", tr("&Export"), "File");
1250
        scrMenuMgr->addMenuItem(scrActions["fileExportText"], "FileExport");
1251
        scrMenuMgr->addMenuItem(scrActions["fileExportAsEPS"], "FileExport");
1252
        scrMenuMgr->addMenuItem(scrActions["fileExportAsPDF"], "FileExport");
1253
        scrMenuMgr->addMenuSeparator("File");
1254
        scrMenuMgr->addMenuItem(scrActions["fileDocInfo"], "File");
1255
        scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File");
1256
        scrMenuMgr->addMenuItem(scrActions["filePrint"], "File");
1257
        scrMenuMgr->addMenuSeparator("File");
1258
        scrMenuMgr->addMenuItem(scrActions["fileQuit"], "File");
1259
 
1260
        scrActions["fileClose"]->setEnabled(false);    
1261
        scrActions["fileSave"]->setEnabled(false);
1262
        scrActions["fileSaveAs"]->setEnabled(false);
1263
        scrActions["fileRevert"]->setEnabled(false);
1264
        scrActions["fileCollect"]->setEnabled(false);
1265
        scrActions["fileImportText"]->setEnabled(false);
1266
        scrActions["fileImportImage"]->setEnabled(false);
1267
        scrActions["fileImportAppendText"]->setEnabled(false);
1268
        scrActions["fileImportPage"]->setEnabled(false);
1269
        scrActions["fileExportText"]->setEnabled(false);
1270
        scrActions["fileExportAsEPS"]->setEnabled(false);
1271
        scrActions["fileExportAsPDF"]->setEnabled(false);
1272
        scrMenuMgr->setMenuEnabled("FileExport", false);
1273
        scrActions["fileDocInfo"]->setEnabled(false);
1274
        scrActions["fileDocSetup"]->setEnabled(false);
1275
        scrActions["filePrint"]->setEnabled(false);
1276
 
1227 cbradney 1277
        scrMenuMgr->createMenu("Edit", tr("&Edit"));
1278
        scrMenuMgr->addMenuItem(scrActions["editUndoAction"], "Edit");
1279
        scrMenuMgr->addMenuItem(scrActions["editRedoAction"], "Edit");
1280
        scrMenuMgr->addMenuItem(scrActions["editActionMode"], "Edit");
1281
        scrMenuMgr->addMenuSeparator("Edit");
1282
        scrMenuMgr->addMenuItem(scrActions["editCut"], "Edit");
1283
        scrMenuMgr->addMenuItem(scrActions["editCopy"], "Edit");
1284
        scrMenuMgr->addMenuItem(scrActions["editPaste"], "Edit");
1285
        scrMenuMgr->addMenuItem(scrActions["editClear"], "Edit");
1286
        scrMenuMgr->addMenuItem(scrActions["editSelectAll"], "Edit");
1287
        scrMenuMgr->addMenuSeparator("Edit");
1288
        scrMenuMgr->addMenuItem(scrActions["editSearchReplace"], "Edit");
1289
        scrMenuMgr->addMenuSeparator("Edit");
1290
        scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit");
1291
        scrMenuMgr->addMenuItem(scrActions["editParaStyles"], "Edit");
1292
        scrMenuMgr->addMenuItem(scrActions["editLineStyles"], "Edit");
1293
        scrMenuMgr->addMenuItem(scrActions["editTemplates"], "Edit");
1294
        scrMenuMgr->addMenuItem(scrActions["editJavascripts"], "Edit");
1295
        scrMenuMgr->addMenuSeparator("Edit");
1296
        scrMenuMgr->addMenuItem(scrActions["editPreferences"], "Edit");
1297
        scrMenuMgr->addMenuItem(scrActions["editFonts"], "Edit");
1298
 
1299
        scrActions["editUndoAction"]->setEnabled(false);
1300
        scrActions["editRedoAction"]->setEnabled(false);
1301
        scrActions["editActionMode"]->setEnabled(false);
1302
        scrActions["editCut"]->setEnabled(false);
1303
        scrActions["editCopy"]->setEnabled(false);
1304
        scrActions["editPaste"]->setEnabled(false);
1305
        scrActions["editClear"]->setEnabled(false);
1306
        scrActions["editSelectAll"]->setEnabled(false);
1307
        scrActions["editSearchReplace"]->setEnabled(false);
1308
        scrActions["editParaStyles"]->setEnabled(false);
1309
        scrActions["editLineStyles"]->setEnabled(false);
1310
        scrActions["editTemplates"]->setEnabled(false);
1311
        scrActions["editJavascripts"]->setEnabled(false);
1312
 
1313
        //Style Menu
3 paul 1314
        StilMenu = new QPopupMenu();
1236 cbradney 1315
 
1316
        //Item Menu
1317
        scrMenuMgr->createMenu("Item", tr("&Item"));
1318
        scrMenuMgr->addMenuItem(scrActions["itemDuplicate"], "Item");
1319
        scrMenuMgr->addMenuItem(scrActions["itemMulDuplicate"], "Item");
1320
        scrMenuMgr->addMenuItem(scrActions["itemDelete"], "Item");
1321
        scrMenuMgr->addMenuSeparator("Item");
1322
        scrMenuMgr->addMenuItem(scrActions["itemGroup"], "Item");
1323
        scrMenuMgr->addMenuItem(scrActions["itemUngroup"], "Item");
1324
        scrMenuMgr->addMenuItem(scrActions["itemLock"], "Item");
1325
        scrMenuMgr->addMenuSeparator("Item");
1326
        scrMenuMgr->addMenuItem(scrActions["itemSendToBack"], "Item");
1327
        scrMenuMgr->addMenuItem(scrActions["itemBringToFront"], "Item");
1328
        scrMenuMgr->addMenuItem(scrActions["itemLower"], "Item");
1329
        scrMenuMgr->addMenuItem(scrActions["itemRaise"], "Item");
1330
        scrMenuMgr->addMenuItem(scrActions["itemAlignDist"], "Item");
1331
        scrMenuMgr->addMenuSeparator("Item");
1332
        scrMenuMgr->createMenu("ItemShapes", tr("&Shape"), "Item");
1333
        // CB TODO
1334
        //Shape menu
169 Franz 1335
        SCustom = new Autoforms(0);
1236 cbradney 1336
        scrMenuMgr->addMenuItem(SCustom, "ItemShapes");
272 Franz 1337
        connect(SCustom, SIGNAL(FormSel(int, int, double *)), this, SLOT(MakeFrame(int, int, double *)));
1236 cbradney 1338
        scrMenuMgr->addMenuItem(scrActions["itemShapeEdit"], "ItemShapes");
1339
        scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item");
1340
        scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item");
1341
        scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item");
1342
        scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item");
1343
        scrMenuMgr->addMenuItem(scrActions["itemSplitPolygons"], "Item");
1344
        scrMenuMgr->addMenuItem(scrActions["itemConvertToOutlines"], "Item");
1345
        scrMenuMgr->setMenuEnabled("ItemShapes", false);
1346
        scrActions["itemAlignDist"]->setEnabled(false);
1347
        scrActions["itemGroup"]->setEnabled(false);
1348
        scrActions["itemUngroup"]->setEnabled(false);
1349
        scrActions["itemAttachTextToPath"]->setEnabled(false);
1350
        scrActions["itemDetachTextFromPath"]->setEnabled(false);
1351
        scrActions["itemCombinePolygons"]->setEnabled(false);
1352
        scrActions["itemSplitPolygons"]->setEnabled(false);
1353
        scrActions["itemLock"]->setEnabled(false);
1354
        scrActions["itemConvertToOutlines"]->setEnabled(false);
1355
 
1356
        //Page menu
1357
        scrMenuMgr->createMenu("Page", tr("&Page"));
1358
        scrMenuMgr->addMenuItem(scrActions["pageInsert"], "Page");
1359
        scrMenuMgr->addMenuItem(scrActions["pageDelete"], "Page");
1360
        scrMenuMgr->addMenuItem(scrActions["pageCopy"], "Page");
1361
        scrMenuMgr->addMenuItem(scrActions["pageMove"], "Page");
1362
        scrMenuMgr->addMenuItem(scrActions["pageApplyTemplate"], "Page");
1363
        scrMenuMgr->addMenuItem(scrActions["pageManageGuides"], "Page");
1364
        scrActions["pageDelete"]->setEnabled(false);
1365
        scrActions["pageMove"]->setEnabled(false);
1366
 
1367
 
1368
        //View menu
1246 cbradney 1369
        scrMenuMgr->createMenu("View", tr("&View"));
1370
        scrMenuMgr->addMenuItem(scrActions["viewFitInWindow"], "View");
1371
        scrMenuMgr->addMenuItem(scrActions["viewFit50"], "View");
1372
        scrMenuMgr->addMenuItem(scrActions["viewFit75"], "View");
1373
        scrMenuMgr->addMenuItem(scrActions["viewFit100"], "View");
1374
        scrMenuMgr->addMenuItem(scrActions["viewFit200"], "View");
1375
        scrMenuMgr->addMenuItem(scrActions["viewFit20"], "View");
1376
        scrMenuMgr->addMenuSeparator("View");
1377
        scrMenuMgr->addMenuItem(scrActions["viewShowMargins"], "View");
1378
        scrMenuMgr->addMenuItem(scrActions["viewShowFrames"], "View");
1379
        scrMenuMgr->addMenuItem(scrActions["viewShowImages"], "View");
1380
        scrMenuMgr->addMenuItem(scrActions["viewShowGrid"], "View");
1381
        scrMenuMgr->addMenuItem(scrActions["viewShowGuides"], "View");
1382
        scrMenuMgr->addMenuItem(scrActions["viewShowBaselineGrid"], "View");
1383
        scrMenuMgr->addMenuItem(scrActions["viewShowTextChain"], "View");
1384
        scrMenuMgr->addMenuSeparator("View");
1385
        scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "View");
1386
        scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "View");
1236 cbradney 1387
 
1388
        //Tool menu
3 paul 1389
        toolMenu=new QPopupMenu();
308 Franz 1390
        viewMpal = toolMenu->insertItem( tr("&Properties"), this, SLOT(ToggleMpal()));
119 Franz 1391
        SetKeyEntry(46, tr("Properties"), viewMpal, 0);
308 Franz 1392
        viewTpal = toolMenu->insertItem( tr("&Outline"), this, SLOT(ToggleTpal()));
119 Franz 1393
        SetKeyEntry(47, tr("Outline"), viewTpal, 0);
308 Franz 1394
        viewBpal = toolMenu->insertItem( tr("&Scrapbook"), this, SLOT(ToggleBpal()));
119 Franz 1395
        SetKeyEntry(48, tr("Scrapbook"), viewBpal, 0);
308 Franz 1396
        viewLpal = toolMenu->insertItem( tr("&Layers"), this, SLOT(ToggleLpal()));
1397
        viewSepal = toolMenu->insertItem( tr("P&age Palette"), this, SLOT(ToggleSepal()));
1398
        viewBopal = toolMenu->insertItem( tr("&Bookmarks"), this, SLOT(ToggleBookpal()));
1213 tsoots 1399
        viewUndoPalette = toolMenu->insertItem(tr("Action &History"), this, SLOT(ToggleUndoPalette()));
1245 fschmid 1400
        M_ToolsCheckDoc = toolMenu->insertItem( tr("Preflight Verifier"), this, SLOT(slotCheckDoc()));
800 fschmid 1401
        toolbarMenuTools = toolMenu->insertItem( tr("&Tools"), this, SLOT(ToggleTools()));
1402
        toolbarMenuPDFTools = toolMenu->insertItem( tr("P&DF Tools"), this, SLOT(TogglePDFTools()));
1403
        SetKeyEntry(45, tr("Tools"), toolbarMenuTools, 0);
1404
        SetKeyEntry(55, tr("Tooltips"), tip, 0);
1236 cbradney 1405
 
1406
        //Extra menu
3 paul 1407
        extraMenu=new QPopupMenu();
308 Franz 1408
        MenID = extraMenu->insertItem( tr("&Manage Pictures"), this, SLOT(StatusPic()));
3 paul 1409
        SetKeyEntry(51, tr("Manage Pictures"), MenID, 0);
308 Franz 1410
        hyph = extraMenu->insertItem( tr("&Hyphenate Text"), this, SLOT(doHyphenate()));
3 paul 1411
        extraMenu->setItemEnabled(hyph, 0);
1412
        SetKeyEntry(50, tr("Hyphenate Text"), hyph, 0);
1208 cbradney 1413
        M_ExtraCharSelect = extraMenu->insertItem( tr("Insert Special"), this, SLOT(slotCharSelect()));
1414
        extraMenu->setItemEnabled(M_ExtraCharSelect, 0);
284 Franz 1415
 
1236 cbradney 1416
        //Window menu
3 paul 1417
        windowsMenu = new QPopupMenu();
1418
        windowsMenu->setCheckable( true );
1419
        connect(windowsMenu, SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow()));
1420
        helpMenu=new QPopupMenu();
308 Franz 1421
        MenID = helpMenu->insertItem( tr("&About Scribus"), this, SLOT(slotHelpAbout()));
3 paul 1422
        SetKeyEntry(52, tr("About Scribus"), MenID, 0);
308 Franz 1423
        MenID = helpMenu->insertItem( tr("About &Qt"), this, SLOT(slotHelpAboutQt()));
3 paul 1424
        SetKeyEntry(53, tr("About Qt"), MenID, 0);
1425
        helpMenu->insertSeparator();
800 fschmid 1426
        tip = helpMenu->insertItem( tr("Toolti&ps"), this, SLOT(ToggleTips()));
1427
        tipsOn = true;
1428
        helpMenu->setItemChecked(tip, tipsOn);
308 Franz 1429
        MenID = helpMenu->insertItem( tr("Scribus &Manual..."), this, SLOT(slotOnlineHelp()));
3 paul 1430
        SetKeyEntry(54, tr("Online-Help..."), MenID, 0);
456 fschmid 1431
 
1227 cbradney 1432
/*
1433
        editMenu->insertItem( tr("Test"), this, SLOT(slotTest()));
456 fschmid 1434
        editMenu->insertItem( tr("Test2"), this, SLOT(slotTest2()));
1435
*/
1208 cbradney 1436
 
1437
        scrMenuMgr->addMenuToMenuBar("File");
1227 cbradney 1438
        scrMenuMgr->addMenuToMenuBar("Edit");
308 Franz 1439
        Stm = menuBar()->insertItem( tr("St&yle"), StilMenu);
175 Franz 1440
        menuBar()->setItemEnabled(Stm, 0);
1236 cbradney 1441
        scrMenuMgr->addMenuToMenuBar("Item");
1442
        scrMenuMgr->addMenuToMenuBar("Page");
1443
        scrMenuMgr->setMenuEnabled("Item", false);
1444
        scrMenuMgr->setMenuEnabled("Page", false);
1246 cbradney 1445
        scrMenuMgr->addMenuToMenuBar("View");
1446
        scrMenuMgr->setMenuEnabled("View", false);
237 Franz 1447
        menuBar()->insertItem( tr("&Tools"), toolMenu);
238 Franz 1448
        exmn = menuBar()->insertItem( tr("E&xtras"), extraMenu);
3 paul 1449
        menuBar()->setItemEnabled(exmn, 0);
272 Franz 1450
        WinMen = menuBar()->insertItem( tr("&Windows"), windowsMenu );
1451
        menuBar()->setItemEnabled(WinMen, 0);
3 paul 1452
        menuBar()->insertSeparator();
237 Franz 1453
        menuBar()->insertItem( tr("&Help"), helpMenu);
1236 cbradney 1454
 
1455
        //Alignment menu
1208 cbradney 1456
        alignMenu = new QPopupMenu();
1457
        alignMenu->insertItem( tr("&Left"));
1458
        alignMenu->insertItem( tr("&Center"));
1459
        alignMenu->insertItem( tr("&Right"));
1460
        alignMenu->insertItem( tr("&Block"));
1461
        alignMenu->insertItem( tr("&Forced"));
1236 cbradney 1462
 
1463
        //Color menu
3 paul 1464
        ColorMenu = new QPopupMenu();
148 Franz 1465
        ColorMenC = new QComboBox(false);
1466
        ColorMenC->setEditable(false);
1467
        ColorMenu->insertItem(ColorMenC);
1236 cbradney 1468
 
1469
        //Text size menu
3 paul 1470
        SizeTMenu = new QPopupMenu();
308 Franz 1471
        SizeTMenu->insertItem( tr("&Other..."));
617 cbradney 1472
        QString ar_sizes[] = {" 7", " 9", "10", "11", "12", "14", "18", "24", "36", "48", "60", "72"};
274 Franz 1473
        size_t f_size = sizeof(ar_sizes) / sizeof(*ar_sizes);
1474
        for (uint s = 0; s < f_size; ++s)
1475
                SizeTMenu->insertItem(ar_sizes[s] + tr(" pt"));
1236 cbradney 1476
 
1477
        //Shade menu
3 paul 1478
        ShadeMenu = new QPopupMenu();
308 Franz 1479
        ShadeMenu->insertItem( tr("&Other..."));
3 paul 1480
        ShadeMenu->insertItem("0 %");
1481
        ShadeMenu->insertItem("10 %");
1482
        ShadeMenu->insertItem("20 %");
1483
        ShadeMenu->insertItem("30 %");
1484
        ShadeMenu->insertItem("40 %");
1485
        ShadeMenu->insertItem("50 %");
1486
        ShadeMenu->insertItem("60 %");
1487
        ShadeMenu->insertItem("70 %");
1488
        ShadeMenu->insertItem("80 %");
1489
        ShadeMenu->insertItem("90 %");
1490
        ShadeMenu->insertItem("100 %");
1236 cbradney 1491
 
1492
        //Font menu
3 paul 1493
        FontMenu = new QPopupMenu();
1236 cbradney 1494
 
1495
        //Type style menu
3 paul 1496
        TypeStyleMenu = new QPopupMenu();
112 Franz 1497
        TypeStyleMenu->insertItem( tr("Normal"));
3 paul 1498
        tmp = qApp->font();
1499
        tmp.setUnderline(true);
112 Franz 1500
        TypeStyleMenu->insertItem(new FmItem( tr("Underline"), tmp));
3 paul 1501
        tmp = qApp->font();
1502
        tmp.setStrikeOut(true);
112 Franz 1503
        TypeStyleMenu->insertItem(new FmItem( tr("Strikethru"), tmp));
1504
        TypeStyleMenu->insertItem( tr("Small Caps"));
1505
        TypeStyleMenu->insertItem( tr("Superscript"));
1506
        TypeStyleMenu->insertItem( tr("Subscript"));
1507
        TypeStyleMenu->insertItem( tr("Outlined"));
801 cbradney 1508
 
1247 tsoots 1509
        connect(undoManager, SIGNAL(newAction(UndoObject*, UndoState*)),
1114 tsoots 1510
                this, SLOT(refreshUndoRedoItems()));
1247 tsoots 1511
        connect(undoManager, SIGNAL(undoRedoDone()), this, SLOT(refreshUndoRedoItems()));
1114 tsoots 1512
        connect(toolMenu, SIGNAL(aboutToShow()), this, SLOT(refreshUndoRedoItems()));
1208 cbradney 1513
 
801 cbradney 1514
        connect(ColorMenC, SIGNAL(activated(int)), this, SLOT(setItemFarbe(int)));
1515
        connect(ShadeMenu, SIGNAL(activated(int)), this, SLOT(setItemShade(int)));
1516
        connect(FontMenu, SIGNAL(activated(int)), this, SLOT(setItemFont(int)));
1517
        connect(SizeTMenu, SIGNAL(activated(int)), this, SLOT(setItemFSize(int)));
1518
        connect(TypeStyleMenu, SIGNAL(activated(int)), this, SLOT(setItemTypeStyle(int)));
1208 cbradney 1519
        connect(alignMenu, SIGNAL(activated(int)), this, SLOT(setItemTextAli(int)));
3 paul 1520
}
1521
 
1522
void ScribusApp::initStatusBar()
1523
{
809 cbradney 1524
        FMess = new QLabel( "           ", statusBar(), "ft");
3 paul 1525
        FProg = new QProgressBar(statusBar(), "p");
272 Franz 1526
        FProg->setCenterIndicator(true);
3 paul 1527
        FProg->setFixedWidth( 100 );
809 cbradney 1528
        FProg->reset();
1529
        XMess = new QLabel( tr("X-Pos:"), statusBar(), "xt");
1530
        YMess = new QLabel( tr("Y-Pos:"), statusBar(), "yt");
1531
        XDat = new QLabel( "         ", statusBar(), "dt");
1532
        YDat = new QLabel( "         ", statusBar(), "ydt");
1533
 
1534
        statusBar()->addWidget(FMess, 3, true);
3 paul 1535
        statusBar()->addWidget(FProg, 0, true);
1536
        statusBar()->addWidget(XMess, 0, true);
1537
        statusBar()->addWidget(XDat, 1, true);
1538
        statusBar()->addWidget(YMess, 0, true);
1539
        statusBar()->addWidget(YDat, 1, true);
1540
}
1541
 
80 Franz 1542
void ScribusApp::ReportMP(double xp, double yp)
3 paul 1543
{
1065 cbradney 1544
        QString suffix=unitGetSuffixFromIndex(doc->docUnitIndex);
1545
        int multiplier=unitGetDecimalsFromIndex(doc->docUnitIndex);
806 cbradney 1546
        double divisor = static_cast<double>(multiplier);
1065 cbradney 1547
        int precision=precision = unitGetPrecisionFromIndex(doc->docUnitIndex);
809 cbradney 1548
        QString tmp;
806 cbradney 1549
        XDat->setText(tmp.setNum(qRound(xp*UmReFaktor * multiplier) / divisor, 'f', precision) + suffix);
1550
        YDat->setText(tmp.setNum(qRound(yp*UmReFaktor * multiplier) / divisor, 'f', precision) + suffix);
3 paul 1551
}
1552
 
1230 cbradney 1553
void ScribusApp::SetKeyEntry(int Nr, QString text, int Men, int KeyC, QString actName)
3 paul 1554
{
1555
        Keys ke;
1556
        ke.Name = text;
1557
        ke.MenuID = Men;
1558
        ke.KeyID = KeyC;
1230 cbradney 1559
        if (actName!="")
1560
        {
1561
                if (scrActions[actName])
1562
                        ke.actionName=actName;
1563
                else
1564
                        qDebug(QString("Action Name: %1 does not exist").arg(actName));
1565
        }
3 paul 1566
        Prefs.KeyActions.insert(Nr, ke);
1567
}
1568
 
1569
void ScribusApp::DeleteSel(PageItem *b)
1570
{
238 Franz 1571
        int FirstSel = 0;
1572
        bool first = false;
1065 cbradney 1573
        for (ScText *it = b->itemText.first(); it != 0; it = b->itemText.next())
272 Franz 1574
        {
1575
                if (it->cselect)
1576
                {
238 Franz 1577
                        first = true;
1065 cbradney 1578
                        b->itemText.remove();
1579
                        it = b->itemText.prev();
272 Franz 1580
                        if (it == 0)
1065 cbradney 1581
                                it = b->itemText.first();
272 Franz 1582
                }
238 Franz 1583
                if (!first)
1584
                        FirstSel++;
272 Franz 1585
        }
1065 cbradney 1586
        if (b->itemText.count() != 0)
238 Franz 1587
        {
1065 cbradney 1588
                if (b->itemText.first()->cselect)
3 paul 1589
                {
1065 cbradney 1590
                        b->itemText.remove();
3 paul 1591
                        b->CPos = 0;
238 Franz 1592
                }
3 paul 1593
                else
238 Franz 1594
                        b->CPos = FirstSel;
1595
        }
3 paul 1596
        else
1597
                b->CPos = 0;
272 Franz 1598
        b->HasSel = false;
1599
        DisableTxEdit();
3 paul 1600
}
1601
 
1602
void ScribusApp::setTBvals(PageItem *b)
1603
{
1065 cbradney 1604
        if (b->itemText.count() != 0)
272 Franz 1605
        {
1065 cbradney 1606
                int ChPos = QMIN(b->CPos, static_cast<int>(b->itemText.count()-1));
1607
                doc->CurrentStyle = b->itemText.at(ChPos)->cstyle & 127;
1608
                doc->currentParaStyle = b->itemText.at(ChPos)->cab;
1609
                setAbsValue(doc->currentParaStyle);
1610
                Mpal->setAli(doc->currentParaStyle);
1611
                doc->CurrFont = b->itemText.at(ChPos)->cfont;
1612
                doc->CurrFontSize = b->itemText.at(ChPos)->csize;
1613
                doc->CurrTextFill = b->itemText.at(ChPos)->ccolor;
1614
                doc->CurrTextFillSh = b->itemText.at(ChPos)->cshade;
1615
                doc->CurrTextStroke = b->itemText.at(ChPos)->cstroke;
1616
                doc->CurrTextStrokeSh = b->itemText.at(ChPos)->cshade2;
1617
                doc->CurrTextScale = b->itemText.at(ChPos)->cscale;
68 Franz 1618
                emit TextFarben(doc->CurrTextStroke, doc->CurrTextFill, doc->CurrTextStrokeSh, doc->CurrTextFillSh);
1619
                emit TextIFont(doc->CurrFont);
272 Franz 1620
                emit TextISize(doc->CurrFontSize);
1065 cbradney 1621
                emit TextUSval(b->itemText.at(ChPos)->cextra);
272 Franz 1622
                emit TextStil(doc->CurrentStyle);
68 Franz 1623
                emit TextScale(doc->CurrTextScale);
272 Franz 1624
        }
3 paul 1625
}
1626
 
1627
void ScribusApp::wheelEvent(QWheelEvent *w)
1628
{
1629
        if (HaveDoc)
239 Franz 1630
        {
276 Franz 1631
                if ((w->orientation() != Qt::Vertical) || ( w->state() & ShiftButton ))
3 paul 1632
                {
239 Franz 1633
                        if (w->delta() < 0)
240 Franz 1634
                                view->scrollBy(Prefs.Wheelval, 0);
239 Franz 1635
                        else
240 Franz 1636
                                view->scrollBy(-Prefs.Wheelval, 0);
239 Franz 1637
                }
3 paul 1638
                else
239 Franz 1639
                {
1640
                        if (w->delta() < 0)
240 Franz 1641
                                view->scrollBy(0, Prefs.Wheelval);
239 Franz 1642
                        else
240 Franz 1643
                                view->scrollBy(0, -Prefs.Wheelval);
239 Franz 1644
                }
3 paul 1645
                w->accept();
239 Franz 1646
        }
3 paul 1647
}
1648
 
1649
void ScribusApp::keyPressEvent(QKeyEvent *k)
1650
{
146 Franz 1651
        QWidgetList windows;
237 Franz 1652
        QWidget* w = NULL;
1065 cbradney 1653
        struct ScText *hg;
3 paul 1654
        int kk = k->key();
1655
        int as = k->ascii();
80 Franz 1656
        double altx, alty;
3 paul 1657
        QString uc = k->text();
1658
        QString cr, Tcha, Twort;
1659
        uint Tcoun;
237 Franz 1660
        int len, pos, c;
92 Franz 1661
        if (keyrep)
1662
                return;
1663
        keyrep = true;
3 paul 1664
        switch (k->state())
272 Franz 1665
        {
1666
        case ShiftButton:
1667
                KeyMod = 0x00200000;
1668
                break;
1669
        case AltButton:
1670
                KeyMod = 0x00800000;
1671
                break;
1672
        case ControlButton:
1673
                KeyMod = 0x00400000;
1674
                break;
1675
        default:
1676
                KeyMod = 0;
1677
                break;
1678
        }
276 Franz 1679
        if (kk == Key_F10)
1680
        {
1681
                keyrep = false;
1682
                ToggleAllPalettes();
1683
                return;
1684
        }
1685
        if ((kk == Key_F11) && (HaveDoc))
1686
        {
1687
                keyrep = false;
1688
                ToggleAllGuides();
1689
                return;
1690
        }
292 Franz 1691
        if ((kk == Key_Escape) && (HaveDoc))
1692
        {
1693
                keyrep = false;
855 fschmid 1694
                PageItem *b;
1695
                if ((view->SelItem.count() != 0))
1696
                {
1697
                        b = view->SelItem.at(0);
1065 cbradney 1698
                        switch (doc->appMode)
855 fschmid 1699
                        {
1065 cbradney 1700
                                case NormalMode:
855 fschmid 1701
                                        b->Sizing = false;
1702
                                        if (doc->SubMode != -1)
1703
                                        {
1704
                                                view->Deselect(false);
1705
//                                              if (!doc->TemplateMode)
1065 cbradney 1706
//                                                      Tpal->slotRemoveElement(doc->currentPage->PageNr, b->ItemNr);
855 fschmid 1707
                                                doc->Items.remove(b->ItemNr);
1708
                                        }
1709
                                        break;
1229 fschmid 1710
                                case LinkFrames:
1711
                                case UnlinkFrames:
1065 cbradney 1712
                                case EditMode:
855 fschmid 1713
                                        break;
1065 cbradney 1714
                                case DrawBezierLine:
855 fschmid 1715
                                        b->PoLine.resize(b->PoLine.size()-2);
1716
                                        if (b->PoLine.size() < 4)
1717
                                        {
1718
                                                view->Deselect(false);
1719
//                                              if (!doc->TemplateMode)
1065 cbradney 1720
//                                                      Tpal->slotRemoveElement(doc->currentPage->PageNr, b->ItemNr);
855 fschmid 1721
                                                doc->Items.remove(b->ItemNr);
1722
                                        }
1723
                                        else
1724
                                        {
1725
                                                view->SizeItem(b->PoLine.WidthHeight().x(), b->PoLine.WidthHeight().y(), b->ItemNr, false, false);
1726
                                                view->SetPolyClip(b, qRound(QMAX(b->Pwidth / 2, 1)));
1727
                                                view->AdjustItemSize(b);
1728
                                                b->ContourLine = b->PoLine.copy();
1729
                                                b->ClipEdited = true;
1730
                                                b->FrameType = 3;
1731
                                                slotDocCh();
1732
                                        }
1733
                                        view->FirstPoly = true;
1734
                                        break;
1735
                                default:
1736
                                        view->Deselect(false);
1737
//                                      if (!doc->TemplateMode)
1065 cbradney 1738
//                                              Tpal->slotRemoveElement(doc->currentPage->PageNr, b->ItemNr);
855 fschmid 1739
                                        doc->Items.remove(b->ItemNr);
1740
                                        break;
1741
                        }
1742
                }
1743
                view->Mpressed = false;
1744
                doc->DragP = false;
1745
                doc->leaveDrag = false;
1746
                view->Imoved = false;
1747
                view->mCG = false;
1748
                view->MidButt = false;
1749
                doc->SubMode = -1;
292 Franz 1750
                NoFrameEdit();
1751
                slotSelect();
1752
                return;
1753
        }
232 Franz 1754
        ButtonState buttonState = k->state();
272 Franz 1755
        if ((HaveDoc) && (!view->LE->hasFocus()) && (!view->PGS->PageCombo->hasFocus()))
1756
        {
1065 cbradney 1757
                if ((doc->appMode != EditMode) && (view->SelItem.count() == 0))
272 Franz 1758
                {
1759
                        switch (kk)
146 Franz 1760
                        {
272 Franz 1761
                        case Key_Space:
1762
                                keyrep = false;
1065 cbradney 1763
                                if (doc->appMode == PanningMode)
1764
                                        setAppMode(NormalMode);
272 Franz 1765
                                else
1766
                                {
1065 cbradney 1767
                                        setAppMode(PanningMode);
272 Franz 1768
                                        qApp->setOverrideCursor(QCursor(loadIcon("HandC.xpm")), true);
1769
                                }
1770
                                return;
1771
                                break;
1772
                        case Key_Prior:
1773
                                view->scrollBy(0, -Prefs.Wheelval);
1774
                                keyrep = false;
1775
                                return;
1776
                                break;
1777
                        case Key_Next:
1778
                                view->scrollBy(0, Prefs.Wheelval);
1779
                                keyrep = false;
1780
                                return;
1781
                                break;
1782
                        case Key_Tab:
1783
                                keyrep = false;
1784
                                windows = wsp->windowList();
1785
                                if (windows.count() > 1)
1786
                                {
1787
                                        for (int i = 0; i < static_cast<int>(windows.count()); ++i)
250 Franz 1788
                                        {
272 Franz 1789
                                                if (wsp->activeWindow() == windows.at(i))
1790
                                                {
1791
                                                        if (i == static_cast<int>(windows.count()-1))
1792
                                                                w = windows.at(0);
1793
                                                        else
1794
                                                                w = windows.at(i+1);
1795
                                                        break;
1796
                                                }
250 Franz 1797
                                        }
272 Franz 1798
                                        doc->OpenNodes = Tpal->buildReopenVals();
1232 fschmid 1799
                                        docChecker->clearErrorList();
272 Franz 1800
                                        if ( w )
1801
                                                w->showNormal();
1802
                                        newActWin(w);
1803
                                }
1804
                                return;
1805
                                break;
1806
                        }
1807
                }
456 fschmid 1808
                if (view->SelItem.count() != 0)
272 Franz 1809
                {
456 fschmid 1810
                        PageItem *b = view->SelItem.at(0);
358 Franz 1811
                        if (kk == Key_F9)
1812
                        {
1813
                                keyrep = false;
1065 cbradney 1814
                                if (doc->appMode == EditMode)
1815
                                        setAppMode(NormalMode);
358 Franz 1816
                                else
1065 cbradney 1817
                                        setAppMode(EditMode);
358 Franz 1818
                                return;
1819
                        }
1065 cbradney 1820
                        switch (doc->appMode)
272 Franz 1821
                        {
1065 cbradney 1822
                        case NormalMode:
272 Franz 1823
                                switch (kk)
1824
                                {
360 Franz 1825
                                case Key_Backspace:
272 Franz 1826
                                case Key_Delete:
1827
                                        if (!doc->EditClip)
997 fschmid 1828
                                                view->DeleteItem();
272 Franz 1829
                                        break;
360 Franz 1830
                                case Key_Prior:
1831
                                        if (!b->Locked)
456 fschmid 1832
                                                view->RaiseItem();
360 Franz 1833
                                        break;
1834
                                case Key_Next:
1835
                                        if (!b->Locked)
456 fschmid 1836
                                                view->LowerItem();
360 Franz 1837
                                        break;
272 Franz 1838
                                case Key_Left:
1839
                                        if (!b->Locked)
1840
                                        {
1841
                                                if ( buttonState & ShiftButton )
456 fschmid 1842
                                                        view->moveGroup(-10, 0);
272 Franz 1843
                                                else if ( buttonState & ControlButton )
456 fschmid 1844
                                                        view->moveGroup(-0.1, 0);
272 Franz 1845
                                                else
456 fschmid 1846
                                                        view->moveGroup(-1, 0);
272 Franz 1847
                                        }
1848
                                        break;
1849
                                case Key_Right:
1850
                                        if (!b->Locked)
1851
                                        {
1852
                                                if ( buttonState & ShiftButton )
456 fschmid 1853
                                                        view->moveGroup(10, 0);
272 Franz 1854
                                                else if ( buttonState & ControlButton )
456 fschmid 1855
                                                        view->moveGroup(0.1, 0);
272 Franz 1856
                                                else
456 fschmid 1857
                                                        view->moveGroup(1, 0);
272 Franz 1858
                                        }
1859
                                        break;
1860
                                case Key_Up:
1861
                                        if (!b->Locked)
1862
                                        {
1863
                                                if ( buttonState & ShiftButton )
456 fschmid 1864
                                                        view->moveGroup(0, -10);
272 Franz 1865
                                                else if ( buttonState & ControlButton )
456 fschmid 1866
                                                        view->moveGroup(0, -0.1);
272 Franz 1867
                                                else
456 fschmid 1868
                                                        view->moveGroup(0, -1);
272 Franz 1869
                                        }
1870
                                        break;
1871
                                case Key_Down:
1872
                                        if (!b->Locked)
1873
                                        {
1874
                                                if ( buttonState & ShiftButton )
456 fschmid 1875
                                                        view->moveGroup(0, 10);
272 Franz 1876
                                                else if ( buttonState & ControlButton )
456 fschmid 1877
                                                        view->moveGroup(0, 0.1);
272 Franz 1878
                                                else
456 fschmid 1879
                                                        view->moveGroup(0, 1);
272 Franz 1880
                                        }
1881
                                        break;
1882
                                default:
1883
                                        if (b->PType == 4)
1884
                                        {
1885
                                                if ((kk + KeyMod) == Prefs.KeyActions[59].KeyID)
146 Franz 1886
                                                {
272 Franz 1887
                                                        setNewAbStyle(1);
1888
                                                        b->Tinput = true;
456 fschmid 1889
                                                        view->RefreshItem(b);
272 Franz 1890
                                                }
1891
                                                if ((kk + KeyMod) == Prefs.KeyActions[58].KeyID)
1892
                                                {
1893
                                                        setNewAbStyle(2);
1894
                                                        b->Tinput = true;
456 fschmid 1895
                                                        view->RefreshItem(b);
272 Franz 1896
                                                }
1897
                                                if ((kk + KeyMod) == Prefs.KeyActions[57].KeyID)
1898
                                                {
1899
                                                        setNewAbStyle(0);
1900
                                                        b->Tinput = true;
456 fschmid 1901
                                                        view->RefreshItem(b);
272 Franz 1902
                                                }
1903
                                        }
1904
                                        break;
1905
                                }
1906
                                slotDocCh();
1907
                                break;
1065 cbradney 1908
                        case EditMode:
272 Franz 1909
                                int oldPos = b->CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key
456 fschmid 1910
                                view->oldCp = b->CPos;
272 Franz 1911
                                if (b->PType == 4)
1912
                                {
456 fschmid 1913
                                        view->slotDoCurs(false);
272 Franz 1914
                                        switch (kk)
1915
                                        {
1916
                                        case Key_Prior:
1917
                                        case Key_Next:
1918
                                        case Key_End:
1919
                                        case Key_Home:
1920
                                        case Key_Right:
1921
                                        case Key_Left:
1922
                                        case Key_Up: