Subversion Repositories Scribus

Rev

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

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