Subversion Repositories Scribus

Rev

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

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