Subversion Repositories Scribus

Rev

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