Subversion Repositories Scribus

Rev

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