Subversion Repositories Scribus

Rev

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