Subversion Repositories Scribus

Rev

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

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