Subversion Repositories Scribus

Rev

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