Rev 9657 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
3 | paul | 7 | /*************************************************************************** |
8 | scribus.cpp - description |
||
9 | ------------------- |
||
10 | begin : Fre Apr 6 21:09:31 CEST 2001 |
||
11 | copyright : (C) 2001 by Franz Schmid |
||
12 | email : Franz.Schmid@altmuehlnet.de |
||
13 | ***************************************************************************/ |
||
14 | |||
15 | /*************************************************************************** |
||
16 | * * |
||
17 | * This program is free software; you can redistribute it and/or modify * |
||
18 | * it under the terms of the GNU General Public License as published by * |
||
19 | * the Free Software Foundation; either version 2 of the License, or * |
||
20 | * (at your option) any later version. * |
||
21 | * * |
||
22 | ***************************************************************************/ |
||
23 | |||
8501 | cbradney | 24 | #include <q3accel.h> |
8591 | cbradney | 25 | #include <QApplication> |
204 | Franz | 26 | #include <qeventloop.h> |
3 | paul | 27 | #include <qcolordialog.h> |
28 | #include <qcolor.h> |
||
8501 | cbradney | 29 | #include <qicon.h> |
30 | #include <q3textstream.h> |
||
3 | paul | 31 | #include <qstylefactory.h> |
32 | #include <qregexp.h> |
||
33 | #include <qtextcodec.h> |
||
34 | #include <qcursor.h> |
||
8501 | cbradney | 35 | #include <q3vbox.h> |
1208 | cbradney | 36 | #include <qpixmap.h> |
37 | #include <qkeysequence.h> |
||
8501 | cbradney | 38 | //Added by qt3to4: |
39 | #include <QMouseEvent> |
||
40 | #include <Q3Frame> |
||
8635 | cbradney | 41 | #include <QDesktopWidget> |
8501 | cbradney | 42 | #include <QDropEvent> |
43 | #include <QCloseEvent> |
||
44 | #include <Q3ValueList> |
||
45 | #include <QLabel> |
||
46 | #include <QEvent> |
||
47 | #include <QWheelEvent> |
||
48 | #include <QTranslator> |
||
49 | #include <QDragEnterEvent> |
||
50 | #include <QKeyEvent> |
||
9535 | fschmid | 51 | #include <QByteArray> |
1208 | cbradney | 52 | |
3 | paul | 53 | #include <cstdio> |
54 | #include <cstdlib> |
||
391 | Franz | 55 | #include <cmath> |
9082 | avox | 56 | #include <cassert> |
2629 | craig | 57 | |
2688 | craig | 58 | #include "scconfig.h" |
2629 | craig | 59 | |
60 | #ifdef HAVE_DLFCN_H |
||
3 | paul | 61 | #include <dlfcn.h> |
2629 | craig | 62 | #endif |
63 | |||
64 | #ifdef HAVE_UNISTD_H |
||
135 | Franz | 65 | #include <unistd.h> |
2629 | craig | 66 | #endif |
67 | |||
3 | paul | 68 | #include <iostream> |
8289 | avox | 69 | #include <sstream> |
119 | Franz | 70 | #include <signal.h> |
80 | Franz | 71 | #include <string> |
1208 | cbradney | 72 | |
3457 | avox | 73 | #include "sccombobox.h" |
2160 | cbradney | 74 | #include "scribusapp.h" |
5243 | cbradney | 75 | #include "scribuscore.h" |
3 | paul | 76 | #include "scribus.h" |
8508 | cbradney | 77 | //#include "scribus.moc" |
3 | paul | 78 | #include "newfile.h" |
79 | #include "page.h" |
||
80 | #include "query.h" |
||
81 | #include "mdup.h" |
||
6442 | cbradney | 82 | #include "multipleduplicate.h" |
3 | paul | 83 | #include "docinfo.h" |
84 | #include "reformdoc.h" |
||
85 | #include "serializer.h" |
||
2355 | cbradney | 86 | #include "aligndistribute.h" |
8638 | cbradney | 87 | //#include "fmitem.h" |
3 | paul | 88 | #include "fontprefs.h" |
1641 | cbradney | 89 | #include "prefs.h" |
3251 | craig | 90 | #include "prefscontext.h" |
1158 | cbradney | 91 | #include "prefstable.h" |
3 | paul | 92 | #include "pdfopts.h" |
3133 | fschmid | 93 | #include "pdflib.h" |
3 | paul | 94 | #include "inspage.h" |
95 | #include "delpages.h" |
||
96 | #include "movepage.h" |
||
97 | #include "helpbrowser.h" |
||
98 | #include "scribusXml.h" |
||
1641 | cbradney | 99 | #include "about.h" |
3247 | craig | 100 | #include "aboutplugins.h" |
3136 | fschmid | 101 | #include "pslib.h" |
3 | paul | 102 | #include "druck.h" |
103 | #include "editformats.h" |
||
104 | #include "muster.h" |
||
3187 | fschmid | 105 | #include "newtemp.h" |
1806 | cbradney | 106 | #include "applytemplatedialog.h" |
3 | paul | 107 | #include "picstatus.h" |
108 | #include "customfdialog.h" |
||
109 | #include "cmsprefs.h" |
||
110 | #include "annot.h" |
||
111 | #include "annota.h" |
||
112 | #include "javadocs.h" |
||
151 | Franz | 113 | #include "colorm.h" |
265 | Franz | 114 | #include "mpalette.h" |
3540 | cbradney | 115 | #include "cpalette.h" |
1525 | cbradney | 116 | #include "bookpalette.h" |
117 | #include "seiten.h" |
||
118 | #include "layers.h" |
||
119 | #include "frameedit.h" |
||
120 | #include "splash.h" |
||
284 | Franz | 121 | #include "measurements.h" |
364 | Franz | 122 | #include "gtgettext.h" |
506 | fschmid | 123 | #include "fileloader.h" |
740 | fschmid | 124 | #include "arrowchooser.h" |
788 | fschmid | 125 | #include "tabtypography.h" |
879 | fschmid | 126 | #include "tabguides.h" |
1194 | fschmid | 127 | #include "tabtools.h" |
1114 | tsoots | 128 | #include "undogui.h" |
1151 | fschmid | 129 | #include "filewatcher.h" |
1202 | fschmid | 130 | #include "charselect.h" |
1232 | fschmid | 131 | #include "checkDocument.h" |
1235 | fschmid | 132 | #include "tabcheckdoc.h" |
1307 | fschmid | 133 | #include "tabpdfoptions.h" |
1641 | cbradney | 134 | #include "docitemattrprefs.h" |
1644 | cbradney | 135 | #include "pageitemattributes.h" |
3829 | cbradney | 136 | #include "pageitem_textframe.h" |
4579 | cbradney | 137 | #include "pageitem_imageframe.h" |
1694 | cbradney | 138 | #include "tocindexprefs.h" |
2441 | cbradney | 139 | #include "tocgenerator.h" |
3201 | subik | 140 | #include "collect4output.h" |
6397 | cbradney | 141 | #include "fpoint.h" |
3 | paul | 142 | #include "fpointarray.h" |
143 | #include "hysettings.h" |
||
144 | #include "guidemanager.h" |
||
145 | #include "mergedoc.h" |
||
27 | Franz | 146 | #include "lineformats.h" |
102 | Franz | 147 | #include "story.h" |
123 | Franz | 148 | #include "autoform.h" |
140 | Franz | 149 | #include "tabmanager.h" |
164 | Franz | 150 | #include "search.h" |
169 | Franz | 151 | #include "fontcombo.h" |
4689 | mrdocs | 152 | #include "colorcombo.h" |
415 | Franz | 153 | #include "prefsfile.h" |
1114 | tsoots | 154 | #include "undomanager.h" |
731 | fschmid | 155 | #include "polygonwidget.h" |
766 | cbradney | 156 | #include "werktoolb.h" |
806 | cbradney | 157 | #include "units.h" |
838 | cbradney | 158 | #include "hruler.h" |
159 | #include "vruler.h" |
||
3053 | avox | 160 | #include "pageselector.h" |
1208 | cbradney | 161 | #include "scraction.h" |
162 | #include "menumanager.h" |
||
1293 | tsoots | 163 | #include "undostate.h" |
1414 | fschmid | 164 | #include "tree.h" |
1500 | cbradney | 165 | #include "scrap.h" |
1549 | subik | 166 | #include "pluginmanager.h" |
1693 | craig | 167 | #include "scpaths.h" |
1972 | craig | 168 | #include "pdfoptions.h" |
1993 | cbradney | 169 | #include "actionmanager.h" |
2024 | cbradney | 170 | #include "documentinformation.h" |
2056 | fschmid | 171 | #include "effectsdialog.h" |
2111 | cbradney | 172 | #include "documentchecker.h" |
4506 | cbradney | 173 | #include "gsutil.h" |
2658 | fschmid | 174 | #include "pagesize.h" |
2707 | subik | 175 | #include "loremipsum.h" |
2769 | fschmid | 176 | #include "marginWidget.h" |
2777 | fschmid | 177 | #include "margindialog.h" |
2834 | cbradney | 178 | #include "prefsmanager.h" |
2901 | fschmid | 179 | #include "pagelayout.h" |
2952 | cbradney | 180 | #include "commonstrings.h" |
3165 | fschmid | 181 | #include "preview.h" |
3252 | craig | 182 | #include "scribuswin.h" |
183 | #include "hyphenator.h" |
||
3510 | cbradney | 184 | #include "scmessagebox.h" |
3706 | fschmid | 185 | #include "imageinfodialog.h" |
8772 | cbradney | 186 | #include "resourcecollection.h" |
3934 | cbradney | 187 | #include "selection.h" |
4829 | tsoots | 188 | #include "stylemanager.h" |
189 | #include "smlinestyle.h" |
||
5184 | avox | 190 | #include "util.h" |
191 | #include "text/nlsconfig.h" |
||
5653 | cbradney | 192 | #include "plugins/formatidlist.h" |
5731 | avox | 193 | #include "scgtplugin.h" |
5806 | fschmid | 194 | #include "stencilreader.h" |
5851 | subik | 195 | #include "langmgr.h" |
5850 | tsoots | 196 | #include "smtextstyles.h" |
6083 | cbradney | 197 | #include "insertaframe.h" |
6368 | fschmid | 198 | #include "patterndialog.h" |
7478 | jghali | 199 | #include "sccolorengine.h" |
8190 | avox | 200 | #include "desaxe/saxXML.h" |
8293 | avox | 201 | #include "desaxe/digester.h" |
202 | #include "desaxe/simple_actions.h" |
||
134 | Franz | 203 | |
4361 | cbradney | 204 | #if defined(_WIN32) |
205 | #include "scwinprint.h" |
||
5178 | mrdocs | 206 | #include "scdocoutput_ps2.h" |
4361 | cbradney | 207 | #endif |
208 | |||
3 | paul | 209 | using namespace std; |
210 | |||
3234 | fschmid | 211 | bool previewDinUse; |
212 | bool printDinUse; |
||
2891 | cbradney | 213 | |
3 | paul | 214 | QString DocDir; |
3205 | craig | 215 | |
5781 | cbradney | 216 | //extern ScribusCore* ScCore; |
2536 | cbradney | 217 | extern ScribusQApp* ScQApp; |
2634 | cbradney | 218 | extern bool emergencyActivated; |
3 | paul | 219 | |
4026 | craig | 220 | ScribusMainWindow::ScribusMainWindow() |
2161 | cbradney | 221 | { |
5781 | cbradney | 222 | actionManager=0; |
223 | scrMenuMgr=0; |
||
224 | prefsManager=0; |
||
225 | mainWindowStatusLabel=0; |
||
7354 | cbradney | 226 | ExternalApp=0; |
3580 | avox | 227 | #ifdef Q_WS_MAC |
228 | noIcon = loadIcon("noicon.xpm"); |
||
229 | #endif |
||
4026 | craig | 230 | } // ScribusMainWindow::ScribusMainWindow() |
188 | Franz | 231 | |
767 | cbradney | 232 | /* |
233 | * retval 0 - ok, 1 - no fonts, ... |
||
234 | */ |
||
5243 | cbradney | 235 | int ScribusMainWindow::initScMW(bool primaryMainWindow) |
188 | Franz | 236 | { |
767 | cbradney | 237 | int retVal=0; |
5243 | cbradney | 238 | |
239 | // CommonStrings::languageChange(); |
||
3234 | fschmid | 240 | previewDinUse = false; |
241 | printDinUse = false; |
||
5243 | cbradney | 242 | // guiLanguage = newGuiLanguage; |
243 | // initSplash(showSplash); |
||
1208 | cbradney | 244 | setUsesBigPixmaps(true); |
355 | Franz | 245 | CurrStED = NULL; |
272 | Franz | 246 | setCaption( tr("Scribus " VERSION)); |
118 | Franz | 247 | setKeyCompression(false); |
272 | Franz | 248 | setIcon(loadIcon("AppIcon.png")); |
1325 | cbradney | 249 | scrActionGroups.clear(); |
250 | scrActionGroups.setAutoDelete(true); |
||
1208 | cbradney | 251 | scrActions.clear(); |
252 | scrRecentFileActions.clear(); |
||
5800 | fschmid | 253 | scrRecentPasteActions.clear(); |
1260 | cbradney | 254 | scrWindowsActions.clear(); |
2408 | cbradney | 255 | scrLayersActions.clear(); |
5781 | cbradney | 256 | scrMenuMgr = new MenuManager(menuBar()); |
2835 | cbradney | 257 | prefsManager = PrefsManager::instance(); |
5243 | cbradney | 258 | objectSpecificUndo = false; |
7087 | subik | 259 | |
1247 | tsoots | 260 | undoManager = UndoManager::instance(); |
7880 | fschmid | 261 | PrefsContext *undoPrefs = prefsManager->prefsFile->getContext("undo"); |
262 | undoManager->setUndoEnabled(undoPrefs->getBool("enabled", true)); |
||
2441 | cbradney | 263 | tocGenerator = new TOCGenerator(); |
4510 | subik | 264 | |
7087 | subik | 265 | |
1780 | cbradney | 266 | initDefaultValues(); |
7087 | subik | 267 | |
272 | Franz | 268 | initStatusBar(); |
7087 | subik | 269 | |
490 | cbradney | 270 | qApp->processEvents(); |
675 | cbradney | 271 | |
3 | paul | 272 | BuFromApp = false; |
7087 | subik | 273 | |
5243 | cbradney | 274 | actionManager = new ActionManager(this, "actionManager"); |
5257 | cbradney | 275 | actionManager->init(this); |
5243 | cbradney | 276 | initMenuBar(); |
277 | initToolBars(); |
||
8591 | cbradney | 278 | //Qt4 buildFontMenu(); |
5243 | cbradney | 279 | ScCore->pluginManager->setupPluginActions(this); |
280 | ScCore->pluginManager->languageChange(); |
||
5352 | cbradney | 281 | initKeyboardShortcuts(); |
5243 | cbradney | 282 | if (primaryMainWindow) |
283 | ScCore->setSplashStatus( tr("Setting up Shortcuts") ); |
||
284 | SetShortCut(); |
||
1485 | tsoots | 285 | |
5243 | cbradney | 286 | resize(610, 600); |
8695 | fschmid | 287 | // Q3VBox* vb = new Q3VBox( this ); |
288 | // vb->setFrameStyle( Q3Frame::StyledPanel | Q3Frame::Sunken ); |
||
289 | wsp = new QWorkspace( this ); |
||
290 | setCentralWidget( wsp ); |
||
5243 | cbradney | 291 | connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *))); |
292 | //Connect windows cascade and tile actions to the workspace after its created. Only depends on wsp created. |
||
293 | connect( scrActions["windowsCascade"], SIGNAL(activated()) , wsp, SLOT(cascade()) ); |
||
294 | connect( scrActions["windowsTile"], SIGNAL(activated()) , wsp, SLOT(tile()) ); |
||
295 | initPalettes(); |
||
7087 | subik | 296 | |
5243 | cbradney | 297 | prefsManager->setupMainWindow(this); |
770 | cbradney | 298 | |
5243 | cbradney | 299 | if (primaryMainWindow) |
300 | ScCore->setSplashStatus( tr("Initializing Story Editor") ); |
||
301 | storyEditor = new StoryEditor(this); |
||
770 | cbradney | 302 | |
5243 | cbradney | 303 | DocDir = prefsManager->documentDir(); |
1485 | tsoots | 304 | |
801 | cbradney | 305 | |
5243 | cbradney | 306 | if (primaryMainWindow) |
5800 | fschmid | 307 | ScCore->setSplashStatus( tr("Initializing Hyphenator") ); |
308 | QString preLang = prefsManager->appPrefs.Language; |
||
309 | initHyphenator(); |
||
310 | if (Sprachen.contains(preLang)) |
||
311 | prefsManager->appPrefs.Language = preLang; |
||
312 | if (primaryMainWindow) |
||
313 | ScCore->setSplashStatus( tr("Reading Scrapbook") ); |
||
314 | initScrapbook(); |
||
315 | |||
316 | scrActions["helpTooltips"]->setOn(prefsManager->appPrefs.showToolTips); |
||
7350 | fschmid | 317 | scrActions["stickyTools"]->setOn(prefsManager->appPrefs.stickyTools); |
5800 | fschmid | 318 | ToggleTips(); |
319 | propertiesPalette->setFontSize(); |
||
6451 | fschmid | 320 | if (scrActions["SaveAsDocumentTemplate"]) |
321 | scrActions["SaveAsDocumentTemplate"]->setEnabled(false); |
||
7087 | subik | 322 | |
5800 | fschmid | 323 | connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecent(QString))); |
8998 | cbradney | 324 | //Qt4 connect(this, SIGNAL(TextIFont(const QString&)), this, SLOT(AdjustFontMenu(const QString&))); |
9067 | avox | 325 | connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&))); |
5800 | fschmid | 326 | connect(this, SIGNAL(TextIFont(QString)), propertiesPalette, SLOT(setFontFace(QString))); |
327 | connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int))); |
||
328 | connect(this, SIGNAL(TextISize(int)), propertiesPalette, SLOT(setSize(int))); |
||
329 | connect(this, SIGNAL(TextUSval(int)), propertiesPalette, SLOT(setExtra(int))); |
||
330 | connect(this, SIGNAL(TextStil(int)), propertiesPalette, SLOT(setStil(int))); |
||
331 | connect(this, SIGNAL(TextScale(int)), propertiesPalette, SLOT(setTScale(int))); |
||
332 | connect(this, SIGNAL(TextScaleV(int)), propertiesPalette, SLOT(setTScaleV(int))); |
||
333 | connect(this, SIGNAL(TextBase(int)), propertiesPalette, SLOT(setTBase(int))); |
||
334 | connect(this, SIGNAL(TextShadow(int, int )), propertiesPalette, SLOT(setShadowOffs(int, int ))); |
||
335 | connect(this, SIGNAL(TextOutline(int)), propertiesPalette, SLOT(setOutlineW(int))); |
||
336 | connect(this, SIGNAL(TextUnderline(int, int)), propertiesPalette, SLOT(setUnderline(int, int))); |
||
337 | connect(this, SIGNAL(TextStrike(int, int)), propertiesPalette, SLOT(setStrike(int, int))); |
||
338 | connect(this, SIGNAL(TextFarben(QString, QString, int, int)), propertiesPalette, SLOT(setActFarben(QString, QString, int, int))); |
||
339 | connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange())); |
||
7337 | fschmid | 340 | // connect(ClipB, SIGNAL(selectionChanged()), this, SLOT(ClipChange())); |
5800 | fschmid | 341 | setAcceptDrops(true); |
9562 | fschmid | 342 | QCoreApplication::instance()->installEventFilter(this); |
5800 | fschmid | 343 | return retVal; |
344 | } |
||
345 | |||
346 | ScribusMainWindow::~ScribusMainWindow() |
||
347 | { |
||
348 | } |
||
349 | |||
350 | |||
351 | void ScribusMainWindow::initToolBars() |
||
352 | { |
||
6259 | fschmid | 353 | fileToolBar = new ScToolBar( tr("File"), "File", this); |
5800 | fschmid | 354 | scrActions["fileNew"]->addTo(fileToolBar); |
355 | scrActions["fileOpen"]->addTo(fileToolBar); |
||
356 | scrMenuMgr->addMenuToWidgetOfAction("FileOpenRecent", scrActions["fileOpen"]); |
||
357 | scrActions["fileSave"]->addTo(fileToolBar); |
||
358 | scrActions["fileClose"]->addTo(fileToolBar); |
||
359 | scrActions["filePrint"]->addTo(fileToolBar); |
||
360 | scrActions["toolsPreflightVerifier"]->addTo(fileToolBar); |
||
361 | scrActions["fileExportAsPDF"]->addTo(fileToolBar); |
||
362 | |||
363 | editToolBar = new ScToolBar( tr("Edit"), "Edit", this); |
||
364 | UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget"); |
||
365 | undoManager->registerGui(uWidget); |
||
366 | |||
367 | mainToolBar = new ModeToolBar(this); |
||
368 | pdfToolBar = new PDFToolBar(this); |
||
7087 | subik | 369 | |
5800 | fschmid | 370 | connect(mainToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarTools"], SLOT(setOn(bool))); |
371 | connect(scrActions["toolsToolbarPDF"], SIGNAL(toggled(bool)), pdfToolBar, SLOT(setShown(bool))); |
||
372 | connect(pdfToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarPDF"], SLOT(setOn(bool))); |
||
373 | connect(scrActions["toolsToolbarTools"], SIGNAL(toggled(bool)), mainToolBar, SLOT(setShown(bool)) ); |
||
374 | } |
||
375 | |||
376 | void ScribusMainWindow::initDefaultValues() |
||
377 | { |
||
378 | HaveDoc = false; |
||
379 | ScriptRunning = false; |
||
380 | view = NULL; |
||
381 | doc = NULL; |
||
382 | Buffer2 = ""; |
||
383 | DocNr = 1; |
||
384 | PrinterUsed = false; |
||
385 | PDef.Pname = ""; |
||
386 | PDef.Dname = ""; |
||
387 | PDef.Command = ""; |
||
388 | keyrep = false; |
||
389 | _arrowKeyDown = false; |
||
390 | ClipB = QApplication::clipboard(); |
||
391 | palettesStatus[0] = false; |
||
392 | guidesStatus[0] = false; |
||
393 | } |
||
394 | |||
395 | void ScribusMainWindow::initKeyboardShortcuts() |
||
396 | { |
||
8501 | cbradney | 397 | for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrActions.begin(); it!=scrActions.end(); ++it ) |
5800 | fschmid | 398 | { |
399 | if ((ScrAction*)(it.data())!=NULL) |
||
400 | { |
||
401 | QString accelerator=it.data()->accel(); |
||
402 | prefsManager->setKeyEntry(it.key(), it.data()->cleanMenuText(), accelerator,0); |
||
403 | } |
||
404 | //else |
||
405 | // qDebug(it.key()); |
||
406 | //qDebug(QString("|-\n|%1||%2||%3").arg(it.key()).arg(it.data()->cleanMenuText()).arg(QString(it.data()->accel()))); |
||
407 | } |
||
408 | } |
||
409 | |||
410 | void ScribusMainWindow::initPalettes() |
||
411 | { |
||
412 | //CB TODO hide the publicly available members of some palettes |
||
413 | // these must be filtered too as they take control of the palettes events |
||
414 | outlinePalette = new Tree(this); |
||
415 | outlinePalette->setMainWindow(this); |
||
416 | connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool)) ); |
||
417 | connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setOn(bool))); |
||
8678 | subik | 418 | propertiesPalette = new Mpalette(this); |
5800 | fschmid | 419 | propertiesPalette->setMainWindow(this); |
420 | connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool)) ); |
||
421 | connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setOn(bool))); |
||
422 | |||
423 | //CB dont need this until we have a doc... |
||
424 | //propertiesPalette->Cpal->SetColors(prefsManager->colorSet()); |
||
425 | propertiesPalette->Fonts->RebuildList(0); |
||
426 | propertiesPalette->installEventFilter(this); |
||
427 | nodePalette = new NodePalette(this); |
||
428 | nodePalette->installEventFilter(this); |
||
429 | layerPalette = new LayerPalette(this); |
||
430 | guidePalette = new GuideManager(this); |
||
7087 | subik | 431 | charPalette = new CharSelect(this); |
5800 | fschmid | 432 | connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) ); |
433 | connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setOn(bool))); |
||
434 | layerPalette->installEventFilter(this); |
||
435 | layerPalette->Table->installEventFilter(this); |
||
436 | scrapbookPalette = new Biblio(this); |
||
437 | connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) ); |
||
438 | connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setOn(bool))); |
||
439 | scrapbookPalette->installEventFilter(this); |
||
440 | pagePalette = new PagePalette(this); |
||
441 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) ); |
||
442 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , this, SLOT(setPagePalette(bool)) ); |
||
443 | connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setOn(bool))); |
||
444 | pagePalette->installEventFilter(this); |
||
445 | bookmarkPalette = new BookPalette(this); |
||
446 | connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) ); |
||
447 | connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setOn(bool))); |
||
448 | bookmarkPalette->installEventFilter(this); |
||
449 | measurementPalette = new Measurements(this); |
||
450 | connect( scrActions["toolsMeasurements"], SIGNAL(toggled(bool)) , measurementPalette, SLOT(setPaletteShown(bool)) ); |
||
451 | connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool, int)) , this, SLOT(setAppModeByToggle(bool, int)) ); |
||
452 | connect( measurementPalette, SIGNAL(paletteShown(bool)), scrActions["toolsMeasurements"], SLOT(setOn(bool))); |
||
453 | measurementPalette->installEventFilter(this); |
||
454 | measurementPalette->hide(); |
||
455 | docCheckerPalette = new CheckDocument(this, false); |
||
456 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) ); |
||
457 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , this, SLOT(docCheckToggle(bool)) ); |
||
458 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setOn(bool))); |
||
459 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool))); |
||
460 | docCheckerPalette->installEventFilter(this); |
||
461 | docCheckerPalette->hide(); |
||
462 | |||
463 | alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette", false); |
||
464 | connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) ); |
||
465 | connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setOn(bool))); |
||
466 | connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh())); |
||
467 | alignDistributePalette->installEventFilter(this); |
||
7087 | subik | 468 | |
5800 | fschmid | 469 | undoPalette = new UndoPalette(this, "undoPalette"); |
470 | undoPalette->installEventFilter(this); |
||
471 | undoManager->registerGui(undoPalette); |
||
472 | connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); |
||
473 | connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); |
||
474 | |||
475 | // initializing style manager here too even it's not strictly a palette |
||
476 | styleManager = new StyleManager(this, "styleManager"); |
||
477 | styleManager->addStyle(new SMLineStyle()); |
||
7063 | tsoots | 478 | SMCharacterStyle *tmpCS = new SMCharacterStyle(); |
479 | styleManager->addStyle(new SMParagraphStyle(tmpCS->tmpStyles())); |
||
480 | styleManager->addStyle(tmpCS); |
||
8005 | cbradney | 481 | connect( scrActions["editStyles"], SIGNAL(toggled(bool)) , styleManager, SLOT(setPaletteShown(bool)) ); |
8003 | cbradney | 482 | connect( styleManager, SIGNAL(paletteShown(bool)), scrActions["editStyles"], SLOT(setOn(bool))); |
8005 | cbradney | 483 | styleManager->installEventFilter(this); |
5800 | fschmid | 484 | |
485 | connect(docCheckerPalette, SIGNAL(selectElement(int, int)), this, SLOT(selectItemsFromOutlines(int, int))); |
||
486 | connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
||
487 | connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString))); |
||
488 | connect(outlinePalette, SIGNAL(selectElement(int, int, bool)), this, SLOT(selectItemsFromOutlines(int, int, bool))); |
||
489 | connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
||
490 | connect(outlinePalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString))); |
||
9067 | avox | 491 | connect(propertiesPalette->paraStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setNewParStyle(const QString&))); |
492 | connect(propertiesPalette->charStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setNewCharStyle(const QString&))); |
||
5800 | fschmid | 493 | // connect(propertiesPalette, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles())); |
494 | connect(nodePalette, SIGNAL(Schliessen()), this, SLOT(NoFrameEdit())); |
||
495 | connect(nodePalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
||
496 | connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
||
497 | |||
498 | connect(bookmarkPalette->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks())); |
||
499 | connect(bookmarkPalette->BView, SIGNAL(changed()), this, SLOT(slotDocCh())); |
||
500 | connect(bookmarkPalette->BView, SIGNAL(SelectElement(PageItem *)), this, SLOT(selectItemsFromOutlines(PageItem *))); |
||
501 | // guides |
||
502 | connect(scrActions["pageManageGuides"], SIGNAL(toggled(bool)), guidePalette, SLOT(setPaletteShown(bool))); |
||
503 | connect(guidePalette, SIGNAL(paletteShown(bool)), scrActions["pageManageGuides"], SLOT(setOn(bool))); |
||
7087 | subik | 504 | // char palette |
505 | connect(scrActions["insertGlyph"], SIGNAL(toggled(bool)), charPalette, SLOT(setPaletteShown(bool))); |
||
506 | connect(charPalette, SIGNAL(paletteShown(bool)), scrActions["insertGlyph"], SLOT(setOn(bool))); |
||
5800 | fschmid | 507 | } |
508 | |||
509 | void ScribusMainWindow::initScrapbook() |
||
510 | { |
||
511 | QString scrapbookFileO = QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrap13.scs"); |
||
512 | QFileInfo scrapbookFileInfoO = QFileInfo(scrapbookFileO); |
||
513 | if (scrapbookFileInfoO.exists()) |
||
514 | { |
||
515 | scrapbookPalette->readOldContents(scrapbookFileO, QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrapbook/main")); |
||
516 | QDir d = QDir(); |
||
517 | d.rename(scrapbookFileO, QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrap13.backup")); |
||
518 | } |
||
519 | QString scrapbookTemp = QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrapbook/tmp"); |
||
520 | QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp); |
||
521 | if (scrapbookTempInfo.exists()) |
||
522 | scrapbookPalette->readTempContents(scrapbookTemp); |
||
523 | QString scrapbookFile = QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrapbook/main"); |
||
524 | QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile); |
||
525 | if (scrapbookFileInfo.exists()) |
||
526 | scrapbookPalette->readContents(scrapbookFile); |
||
527 | scrapbookPalette->setScrapbookFileName(scrapbookFile); |
||
528 | scrapbookPalette->setOpenScrapbooks(prefsManager->appPrefs.RecentScrapbooks); |
||
529 | rebuildRecentPasteMenu(); |
||
5806 | fschmid | 530 | connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu())); |
5800 | fschmid | 531 | } |
532 | |||
533 | bool ScribusMainWindow::warningVersion(QWidget *parent) |
||
534 | { |
||
535 | bool retval = false; |
||
536 | int t = ScMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" + |
||
6442 | cbradney | 537 | QObject::tr("You are running a development version of Scribus 1.3.x. The document you are working with was created in Scribus 1.2.x. Saving the current file under 1.3.x renders it unable to be edited in Scribus 1.2.x versions. To preserve the ability to edit in 1.2.x, save this file under a different name and further edit the newly named file and the original will be untouched. Are you sure you wish to proceed with this operation?") + "</qt>", |
9422 | fschmid | 538 | QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel); |
539 | if (t == QMessageBox::Ok) |
||
5800 | fschmid | 540 | retval = true; |
541 | return retval; |
||
542 | } |
||
543 | |||
544 | void ScribusMainWindow::initMenuBar() |
||
545 | { |
||
546 | RecentDocs.clear(); |
||
547 | |||
548 | scrMenuMgr->createMenu("File", tr("&File")); |
||
549 | scrMenuMgr->addMenuItem(scrActions["fileNew"], "File"); |
||
550 | scrMenuMgr->addMenuItem(scrActions["fileOpen"], "File"); |
||
551 | recentFileMenuName="FileOpenRecent"; |
||
8501 | cbradney | 552 | scrMenuMgr->createMenu(recentFileMenuName, QIcon(noIcon), tr("Open &Recent"), "File"); |
5800 | fschmid | 553 | scrMenuMgr->addMenuSeparator("File"); |
554 | scrMenuMgr->addMenuItem(scrActions["fileClose"], "File"); |
||
555 | scrMenuMgr->addMenuItem(scrActions["fileSave"], "File"); |
||
556 | scrMenuMgr->addMenuItem(scrActions["fileSaveAs"], "File"); |
||
557 | scrMenuMgr->addMenuItem(scrActions["fileRevert"], "File"); |
||
558 | scrMenuMgr->addMenuItem(scrActions["fileCollect"], "File"); |
||
559 | scrMenuMgr->addMenuSeparator("File"); |
||
8501 | cbradney | 560 | scrMenuMgr->createMenu("FileImport", QIcon(noIcon), tr("&Import"), "File"); |
5800 | fschmid | 561 | scrMenuMgr->addMenuItem(scrActions["fileImportText"], "FileImport"); |
7615 | cbradney | 562 | // scrMenuMgr->addMenuItem(scrActions["fileImportText2"], "FileImport"); |
5800 | fschmid | 563 | scrMenuMgr->addMenuItem(scrActions["fileImportAppendText"], "FileImport"); |
564 | scrMenuMgr->addMenuItem(scrActions["fileImportImage"], "FileImport"); |
||
8501 | cbradney | 565 | scrMenuMgr->createMenu("FileExport", QIcon(noIcon), tr("&Export"), "File"); |
5800 | fschmid | 566 | scrMenuMgr->addMenuItem(scrActions["fileExportText"], "FileExport"); |
567 | scrMenuMgr->addMenuItem(scrActions["fileExportAsEPS"], "FileExport"); |
||
568 | scrMenuMgr->addMenuItem(scrActions["fileExportAsPDF"], "FileExport"); |
||
569 | scrMenuMgr->addMenuSeparator("File"); |
||
570 | scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File"); |
||
571 | scrMenuMgr->addMenuItem(scrActions["filePreferences"], "File"); |
||
572 | scrMenuMgr->addMenuSeparator("File"); |
||
573 | scrMenuMgr->addMenuItem(scrActions["filePrint"], "File"); |
||
574 | scrMenuMgr->addMenuItem(scrActions["PrintPreview"], "File"); |
||
575 | scrMenuMgr->addMenuSeparator("File"); |
||
576 | scrMenuMgr->addMenuItem(scrActions["fileQuit"], "File"); |
||
577 | |||
578 | scrActions["fileClose"]->setEnabled(false); |
||
579 | scrActions["fileSave"]->setEnabled(false); |
||
580 | scrActions["fileSaveAs"]->setEnabled(false); |
||
581 | scrActions["fileRevert"]->setEnabled(false); |
||
582 | scrActions["fileCollect"]->setEnabled(false); |
||
583 | scrActions["fileImportText"]->setEnabled(false); |
||
584 | scrActions["fileImportText2"]->setEnabled(false); |
||
585 | scrActions["fileImportImage"]->setEnabled(false); |
||
586 | scrActions["fileImportAppendText"]->setEnabled(false); |
||
587 | scrActions["pageImport"]->setEnabled(false); |
||
588 | scrActions["fileExportText"]->setEnabled(false); |
||
589 | scrActions["fileExportAsEPS"]->setEnabled(false); |
||
590 | scrActions["fileExportAsPDF"]->setEnabled(false); |
||
6451 | fschmid | 591 | scrMenuMgr->setMenuEnabled("FileImport", false); |
5800 | fschmid | 592 | scrMenuMgr->setMenuEnabled("FileExport", false); |
593 | scrActions["fileDocSetup"]->setEnabled(false); |
||
594 | scrActions["filePrint"]->setEnabled(false); |
||
595 | scrActions["PrintPreview"]->setEnabled(false); |
||
596 | |||
597 | scrMenuMgr->createMenu("Edit", tr("&Edit")); |
||
598 | scrMenuMgr->addMenuItem(scrActions["editUndoAction"], "Edit"); |
||
599 | scrMenuMgr->addMenuItem(scrActions["editRedoAction"], "Edit"); |
||
600 | scrMenuMgr->addMenuItem(scrActions["editActionMode"], "Edit"); |
||
601 | scrMenuMgr->addMenuSeparator("Edit"); |
||
602 | scrMenuMgr->addMenuItem(scrActions["editCut"], "Edit"); |
||
603 | scrMenuMgr->addMenuItem(scrActions["editCopy"], "Edit"); |
||
604 | scrMenuMgr->addMenuItem(scrActions["editPaste"], "Edit"); |
||
605 | recentPasteMenuName="EditPasteRecent"; |
||
8501 | cbradney | 606 | scrMenuMgr->createMenu(recentPasteMenuName, QIcon(noIcon), tr("Paste Recent"), "Edit"); |
5943 | cbradney | 607 | scrMenuMgr->createMenu("EditContents", QPixmap(noIcon), tr("Contents"), "Edit"); |
5800 | fschmid | 608 | scrMenuMgr->addMenuItem(scrActions["editCopyContents"], "EditContents"); |
609 | scrMenuMgr->addMenuItem(scrActions["editPasteContents"], "EditContents"); |
||
610 | scrMenuMgr->addMenuItem(scrActions["editPasteContentsAbs"], "EditContents"); |
||
611 | scrMenuMgr->addMenuItem(scrActions["editClearContents"], "EditContents"); |
||
612 | scrMenuMgr->addMenuSeparator("Edit"); |
||
613 | scrMenuMgr->addMenuItem(scrActions["editSelectAll"], "Edit"); |
||
614 | scrMenuMgr->addMenuItem(scrActions["editDeselectAll"], "Edit"); |
||
615 | scrMenuMgr->addMenuSeparator("Edit"); |
||
616 | scrMenuMgr->addMenuItem(scrActions["editSearchReplace"], "Edit"); |
||
617 | scrMenuMgr->addMenuItem(scrActions["toolsEditWithStoryEditor"], "Edit"); |
||
618 | scrMenuMgr->addMenuItem(scrActions["editEditWithImageEditor"], "Edit"); |
||
619 | scrMenuMgr->addMenuSeparator("Edit"); |
||
620 | scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit"); |
||
6368 | fschmid | 621 | scrMenuMgr->addMenuItem(scrActions["editPatterns"], "Edit"); |
5922 | cbradney | 622 | scrMenuMgr->addMenuItem(scrActions["editStyles"], "Edit"); |
5800 | fschmid | 623 | scrMenuMgr->addMenuItem(scrActions["editMasterPages"], "Edit"); |
624 | scrMenuMgr->addMenuItem(scrActions["editJavascripts"], "Edit"); |
||
625 | scrActions["editUndoAction"]->setEnabled(false); |
||
626 | scrActions["editRedoAction"]->setEnabled(false); |
||
627 | scrActions["editActionMode"]->setEnabled(true); |
||
628 | scrActions["editCut"]->setEnabled(false); |
||
629 | scrActions["editCopy"]->setEnabled(false); |
||
630 | scrActions["editPaste"]->setEnabled(false); |
||
5827 | fschmid | 631 | scrMenuMgr->setMenuEnabled("EditPasteRecent", false); |
7565 | cbradney | 632 | scrMenuMgr->setMenuEnabled("EditContents", false); |
5800 | fschmid | 633 | scrActions["editCopyContents"]->setEnabled(false); |
634 | scrActions["editPasteContents"]->setEnabled(false); |
||
635 | scrActions["editPasteContentsAbs"]->setEnabled(false); |
||
636 | scrActions["editClearContents"]->setEnabled(false); |
||
637 | scrActions["editSelectAll"]->setEnabled(false); |
||
638 | scrActions["editDeselectAll"]->setEnabled(false); |
||
639 | scrActions["editSearchReplace"]->setEnabled(false); |
||
6368 | fschmid | 640 | scrActions["editPatterns"]->setEnabled(false); |
9566 | cbradney | 641 | scrActions["editStyles"]->setEnabled(false); |
5800 | fschmid | 642 | scrActions["editMasterPages"]->setEnabled(false); |
643 | scrActions["editJavascripts"]->setEnabled(false); |
||
644 | scrActions["toolsEditWithStoryEditor"]->setEnabled(false); |
||
645 | scrActions["editEditWithImageEditor"]->setEnabled(false); |
||
646 | |||
8591 | cbradney | 647 | /*Qt4 |
5800 | fschmid | 648 | //Style Menu |
649 | scrMenuMgr->createMenu("Style", tr("St&yle")); |
||
650 | //Color menu |
||
651 | // CB TODO |
||
652 | scrMenuMgr->createMenu("Color", tr("&Color")); |
||
653 | ColorMenC = new ColorCombo(false); |
||
654 | ColorMenC->setEditable(false); |
||
655 | scrMenuMgr->addMenuItem(ColorMenC, "Color"); |
||
656 | |||
657 | //Text size menu |
||
658 | scrMenuMgr->createMenu("FontSize", tr("&Size")); |
||
659 | scrActionGroups["fontSize"]->addTo(scrMenuMgr->getLocalPopupMenu("FontSize")); |
||
660 | |||
661 | //Shade menu |
||
662 | scrMenuMgr->createMenu("Shade", tr("&Shade")); |
||
663 | scrActionGroups["shade"]->addTo(scrMenuMgr->getLocalPopupMenu("Shade")); |
||
664 | |||
665 | //Font menu |
||
666 | scrMenuMgr->createMenu("Font", tr("&Font")); |
||
667 | FontMenu = scrMenuMgr->getLocalPopupMenu("Font"); |
||
668 | |||
669 | //Type style menu |
||
670 | scrMenuMgr->createMenu("TypeEffects", tr("&Effects")); |
||
671 | scrActionGroups["typeEffects"]->addTo(scrMenuMgr->getLocalPopupMenu("TypeEffects")); |
||
8591 | cbradney | 672 | */ |
5800 | fschmid | 673 | |
674 | //Item Menu |
||
675 | scrMenuMgr->createMenu("Item", tr("&Item")); |
||
676 | scrMenuMgr->addMenuItem(scrActions["itemDuplicate"], "Item"); |
||
677 | scrMenuMgr->addMenuItem(scrActions["itemMulDuplicate"], "Item"); |
||
678 | scrMenuMgr->addMenuItem(scrActions["itemDelete"], "Item"); |
||
679 | scrMenuMgr->addMenuSeparator("Item"); |
||
680 | scrMenuMgr->addMenuItem(scrActions["itemGroup"], "Item"); |
||
681 | scrMenuMgr->addMenuItem(scrActions["itemUngroup"], "Item"); |
||
682 | scrMenuMgr->addMenuItem(scrActions["itemLock"], "Item"); |
||
683 | scrMenuMgr->addMenuItem(scrActions["itemLockSize"], "Item"); |
||
684 | scrMenuMgr->addMenuSeparator("Item"); |
||
685 | scrMenuMgr->createMenu("ItemLevel", tr("Level")); |
||
686 | scrMenuMgr->addMenuToMenu("ItemLevel", "Item"); |
||
687 | scrMenuMgr->addMenuItem(scrActions["itemRaise"], "ItemLevel"); |
||
688 | scrMenuMgr->addMenuItem(scrActions["itemLower"], "ItemLevel"); |
||
689 | scrMenuMgr->addMenuItem(scrActions["itemRaiseToTop"], "ItemLevel"); |
||
690 | scrMenuMgr->addMenuItem(scrActions["itemLowerToBottom"], "ItemLevel"); |
||
691 | scrMenuMgr->createMenu("ItemLayer", tr("Send to La&yer")); |
||
692 | scrMenuMgr->addMenuToMenu("ItemLayer", "Item"); |
||
693 | layerMenuName="ItemLayer"; |
||
694 | scrMenuMgr->addMenuItem(scrActions["itemSendToScrapbook"], "Item"); |
||
6410 | fschmid | 695 | scrMenuMgr->addMenuItem(scrActions["itemSendToPattern"], "Item"); |
5800 | fschmid | 696 | scrMenuMgr->addMenuSeparator("Item"); |
8020 | cbradney | 697 | scrMenuMgr->addMenuItem(scrActions["itemAdjustFrameToImage"], "Item"); |
698 | scrMenuMgr->addMenuItem(scrActions["itemExtendedImageProperties"], "Item"); |
||
699 | scrMenuMgr->addMenuItem(scrActions["itemUpdateImage"], "Item"); |
||
700 | scrMenuMgr->createMenu("ItemPreviewSettings", tr("Preview Settings"), "Item"); |
||
701 | scrMenuMgr->addMenuItem(scrActions["itemImageIsVisible"], "ItemPreviewSettings"); |
||
702 | scrMenuMgr->addMenuSeparator("ItemPreviewSettings"); |
||
703 | scrMenuMgr->addMenuItem(scrActions["itemPreviewLow"], "ItemPreviewSettings"); |
||
704 | scrMenuMgr->addMenuItem(scrActions["itemPreviewNormal"], "ItemPreviewSettings"); |
||
705 | scrMenuMgr->addMenuItem(scrActions["itemPreviewFull"], "ItemPreviewSettings"); |
||
706 | scrMenuMgr->addMenuSeparator("Item"); |
||
5800 | fschmid | 707 | scrMenuMgr->addMenuItem(scrActions["itemAttributes"], "Item"); |
708 | scrMenuMgr->createMenu("ItemPDFOptions", tr("&PDF Options")); |
||
709 | scrMenuMgr->addMenuToMenu("ItemPDFOptions", "Item"); |
||
710 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsAnnotation"], "ItemPDFOptions"); |
||
711 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsBookmark"], "ItemPDFOptions"); |
||
712 | scrMenuMgr->addMenuItem(scrActions["itemPDFAnnotationProps"], "ItemPDFOptions"); |
||
713 | scrMenuMgr->addMenuItem(scrActions["itemPDFFieldProps"], "ItemPDFOptions"); |
||
714 | scrMenuMgr->createMenu("ItemShapes", tr("&Shape"), "Item"); |
||
715 | // CB TODO |
||
716 | //Shape menu |
||
8591 | cbradney | 717 | //Qt4 SCustom = new Autoforms(0); |
718 | //Qt4 scrMenuMgr->addMenuItem(SCustom, "ItemShapes"); |
||
719 | //Qt4 connect(SCustom, SIGNAL(FormSel(int, int, double *)), this, SLOT(MakeFrame(int, int, double *))); |
||
720 | //Qt4 scrMenuMgr->addMenuItem(scrActions["itemShapeEdit"], "ItemShapes"); |
||
5800 | fschmid | 721 | scrMenuMgr->createMenu("ItemConvertTo", QPixmap(noIcon), tr("C&onvert To"), "Item"); |
722 | //scrMenuMgr->createMenu("ItemConvertTo", tr("C&onvert To")); |
||
723 | //scrMenuMgr->addMenuToMenu("ItemConvertTo", "Item"); |
||
724 | scrMenuMgr->addMenuItem(scrActions["itemConvertToBezierCurve"], "ItemConvertTo"); |
||
725 | scrMenuMgr->addMenuItem(scrActions["itemConvertToImageFrame"], "ItemConvertTo"); |
||
726 | scrMenuMgr->addMenuItem(scrActions["itemConvertToOutlines"], "ItemConvertTo"); |
||
727 | scrMenuMgr->addMenuItem(scrActions["itemConvertToPolygon"], "ItemConvertTo"); |
||
728 | scrMenuMgr->addMenuItem(scrActions["itemConvertToTextFrame"], "ItemConvertTo"); |
||
729 | |||
730 | scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item"); |
||
731 | scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item"); |
||
732 | scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item"); |
||
733 | scrMenuMgr->addMenuItem(scrActions["itemSplitPolygons"], "Item"); |
||
734 | scrMenuMgr->setMenuEnabled("ItemShapes", false); |
||
735 | scrActions["itemGroup"]->setEnabled(false); |
||
736 | scrActions["itemUngroup"]->setEnabled(false); |
||
737 | scrActions["itemAttachTextToPath"]->setEnabled(false); |
||
738 | scrActions["itemDetachTextFromPath"]->setEnabled(false); |
||
739 | scrActions["itemCombinePolygons"]->setEnabled(false); |
||
740 | scrActions["itemSplitPolygons"]->setEnabled(false); |
||
741 | scrActions["itemLock"]->setEnabled(false); |
||
742 | scrActions["itemLockSize"]->setEnabled(false); |
||
743 | scrActions["itemPrintingEnabled"]->setEnabled(false); |
||
744 | scrActions["itemImageIsVisible"]->setEnabled(false); |
||
745 | scrMenuMgr->setMenuEnabled("ItemConvertTo", false); |
||
746 | scrActions["itemConvertToBezierCurve"]->setEnabled(false); |
||
747 | scrActions["itemConvertToImageFrame"]->setEnabled(false); |
||
748 | scrActions["itemConvertToOutlines"]->setEnabled(false); |
||
749 | scrActions["itemConvertToPolygon"]->setEnabled(false); |
||
750 | scrActions["itemConvertToTextFrame"]->setEnabled(false); |
||
751 | |||
752 | //Insert menu |
||
753 | scrMenuMgr->createMenu("Insert", tr("I&nsert")); |
||
6090 | cbradney | 754 | scrMenuMgr->addMenuItem(scrActions["insertFrame"], "Insert"); |
755 | scrMenuMgr->addMenuSeparator("Insert"); |
||
5800 | fschmid | 756 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTextFrame"], "Insert"); |
757 | scrMenuMgr->addMenuItem(scrActions["toolsInsertImageFrame"], "Insert"); |
||
758 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTableFrame"], "Insert"); |
||
759 | scrMenuMgr->addMenuItem(scrActions["toolsInsertShape"], "Insert"); |
||
760 | scrMenuMgr->addMenuItem(scrActions["toolsInsertPolygon"], "Insert"); |
||
761 | scrMenuMgr->addMenuItem(scrActions["toolsInsertLine"], "Insert"); |
||
762 | scrMenuMgr->addMenuItem(scrActions["toolsInsertBezier"], "Insert"); |
||
763 | scrMenuMgr->addMenuItem(scrActions["toolsInsertFreehandLine"], "Insert"); |
||
7400 | cbradney | 764 | scrMenuMgr->addMenuSeparator("Insert"); |
7350 | fschmid | 765 | scrMenuMgr->addMenuItem(scrActions["stickyTools"], "Insert"); |
5800 | fschmid | 766 | scrMenuMgr->addMenuSeparator("Insert"); |
767 | scrMenuMgr->addMenuItem(scrActions["insertGlyph"], "Insert"); |
||
768 | |||
769 | scrMenuMgr->createMenu("InsertChar", QPixmap(noIcon), tr("&Character"), "Insert"); |
||
770 | //scrMenuMgr->addMenuToMenu("InsertChar", "Insert"); |
||
771 | scrMenuMgr->addMenuItem(scrActions["unicodePageNumber"], "InsertChar"); |
||
772 | scrMenuMgr->addMenuItem(scrActions["unicodeSmartHyphen"], "InsertChar"); |
||
773 | scrMenuMgr->addMenuItem(scrActions["unicodeNonBreakingHyphen"], "InsertChar"); |
||
774 | scrMenuMgr->addMenuSeparator("InsertChar"); |
||
775 | scrMenuMgr->addMenuItem(scrActions["unicodeCopyRight"], "InsertChar"); |
||
776 | scrMenuMgr->addMenuItem(scrActions["unicodeRegdTM"], "InsertChar"); |
||
777 | scrMenuMgr->addMenuItem(scrActions["unicodeTM"], "InsertChar"); |
||
778 | scrMenuMgr->addMenuItem(scrActions["unicodeSolidus"], "InsertChar"); |
||
779 | scrMenuMgr->addMenuItem(scrActions["unicodeBullet"], "InsertChar"); |
||
780 | scrMenuMgr->addMenuItem(scrActions["unicodeMidpoint"], "InsertChar"); |
||
781 | scrMenuMgr->addMenuSeparator("InsertChar"); |
||
782 | scrMenuMgr->addMenuItem(scrActions["unicodeDashEm"], "InsertChar"); |
||
783 | scrMenuMgr->addMenuItem(scrActions["unicodeDashEn"], "InsertChar"); |
||
784 | scrMenuMgr->addMenuItem(scrActions["unicodeDashFigure"], "InsertChar"); |
||
785 | scrMenuMgr->addMenuItem(scrActions["unicodeDashQuotation"], "InsertChar"); |
||
786 | |||
787 | scrMenuMgr->createMenu("InsertQuote", QPixmap(noIcon), tr("&Quote"), "Insert"); |
||
788 | //scrMenuMgr->addMenuToMenu("InsertQuote", "Insert"); |
||
789 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteApostrophe"], "InsertQuote"); |
||
790 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteStraight"], "InsertQuote"); |
||
791 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
792 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleLeft"], "InsertQuote"); |
||
793 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleRight"], "InsertQuote"); |
||
794 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleLeft"], "InsertQuote"); |
||
795 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleRight"], "InsertQuote"); |
||
796 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
8755 | cbradney | 797 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleReversed"], "InsertQuote"); |
798 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleReversed"], "InsertQuote"); |
||
799 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
5800 | fschmid | 800 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteLowSingleComma"], "InsertQuote"); |
801 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteLowDoubleComma"], "InsertQuote"); |
||
802 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
803 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleLeftGuillemet"], "InsertQuote"); |
||
804 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleRightGuillemet"], "InsertQuote"); |
||
805 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleLeftGuillemet"], "InsertQuote"); |
||
806 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleRightGuillemet"], "InsertQuote"); |
||
807 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
808 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKSingleLeft"], "InsertQuote"); |
||
809 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKSingleRight"], "InsertQuote"); |
||
810 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKDoubleLeft"], "InsertQuote"); |
||
811 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKDoubleRight"], "InsertQuote"); |
||
812 | |||
813 | scrMenuMgr->createMenu("InsertSpace", QPixmap(noIcon), tr("S&paces && Breaks"), "Insert"); |
||
814 | scrMenuMgr->addMenuItem(scrActions["unicodeNonBreakingSpace"], "InsertSpace"); |
||
815 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceEN"], "InsertSpace"); |
||
816 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceEM"], "InsertSpace"); |
||
817 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceThin"], "InsertSpace"); |
||
818 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceThick"], "InsertSpace"); |
||
819 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceMid"], "InsertSpace"); |
||
820 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceHair"], "InsertSpace"); |
||
821 | scrMenuMgr->addMenuSeparator("InsertSpace"); |
||
822 | scrMenuMgr->addMenuItem(scrActions["unicodeNewLine"], "InsertSpace"); |
||
823 | scrMenuMgr->addMenuItem(scrActions["unicodeFrameBreak"], "InsertSpace"); |
||
824 | scrMenuMgr->addMenuItem(scrActions["unicodeColumnBreak"], "InsertSpace"); |
||
7038 | avox | 825 | scrMenuMgr->addMenuItem(scrActions["unicodeZerowidthSpace"], "InsertSpace"); |
5800 | fschmid | 826 | |
827 | scrMenuMgr->createMenu("InsertLigature", QPixmap(noIcon), tr("Liga&ture"), "Insert"); |
||
828 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ff"], "InsertLigature"); |
||
829 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_fi"], "InsertLigature"); |
||
830 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_fl"], "InsertLigature"); |
||
831 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ffi"], "InsertLigature"); |
||
832 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ffl"], "InsertLigature"); |
||
833 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ft"], "InsertLigature"); |
||
834 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_st"], "InsertLigature"); |
||
835 | |||
836 | scrMenuMgr->addMenuSeparator("Insert"); |
||
837 | scrMenuMgr->addMenuItem(scrActions["insertSampleText"], "Insert"); |
||
6115 | cbradney | 838 | scrActions["insertFrame"]->setEnabled(false); |
5800 | fschmid | 839 | |
840 | //Page menu |
||
841 | scrMenuMgr->createMenu("Page", tr("&Page")); |
||
842 | scrMenuMgr->addMenuItem(scrActions["pageInsert"], "Page"); |
||
843 | scrMenuMgr->addMenuItem(scrActions["pageImport"], "Page"); |
||
844 | scrMenuMgr->addMenuItem(scrActions["pageDelete"], "Page"); |
||
845 | scrMenuMgr->addMenuItem(scrActions["pageCopy"], "Page"); |
||
846 | scrMenuMgr->addMenuItem(scrActions["pageMove"], "Page"); |
||
847 | scrMenuMgr->addMenuItem(scrActions["pageApplyMasterPage"], "Page"); |
||
848 | scrMenuMgr->addMenuItem(scrActions["pageCopyToMasterPage"], "Page"); |
||
849 | scrMenuMgr->addMenuItem(scrActions["pageManageGuides"], "Page"); |
||
850 | scrMenuMgr->addMenuItem(scrActions["pageManageMargins"], "Page"); |
||
851 | scrMenuMgr->addMenuSeparator("Page"); |
||
852 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "Page"); |
||
853 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "Page"); |
||
854 | scrActions["pageDelete"]->setEnabled(false); |
||
855 | scrActions["pageMove"]->setEnabled(false); |
||
856 | |||
857 | //View menu |
||
858 | scrMenuMgr->createMenu("View", tr("&View")); |
||
859 | scrMenuMgr->addMenuItem(scrActions["viewFitInWindow"], "View"); |
||
7164 | fschmid | 860 | scrMenuMgr->addMenuItem(scrActions["viewFitWidth"], "View"); |
5800 | fschmid | 861 | scrMenuMgr->addMenuItem(scrActions["viewFit50"], "View"); |
862 | scrMenuMgr->addMenuItem(scrActions["viewFit75"], "View"); |
||
863 | scrMenuMgr->addMenuItem(scrActions["viewFit100"], "View"); |
||
864 | scrMenuMgr->addMenuItem(scrActions["viewFit200"], "View"); |
||
865 | scrMenuMgr->addMenuSeparator("View"); |
||
7587 | cbradney | 866 | scrMenuMgr->addMenuItem(scrActions["viewFitPreview"], "View"); |
867 | scrMenuMgr->addMenuSeparator("View"); |
||
5800 | fschmid | 868 | scrMenuMgr->addMenuItem(scrActions["viewShowMargins"], "View"); |
7051 | fschmid | 869 | scrMenuMgr->addMenuItem(scrActions["viewShowBleeds"], "View"); |
5800 | fschmid | 870 | scrMenuMgr->addMenuItem(scrActions["viewShowFrames"], "View"); |
871 | scrMenuMgr->addMenuItem(scrActions["viewShowLayerMarkers"], "View"); |
||
872 | scrMenuMgr->addMenuItem(scrActions["viewShowImages"], "View"); |
||
873 | scrMenuMgr->addMenuItem(scrActions["viewShowGrid"], "View"); |
||
874 | scrMenuMgr->addMenuItem(scrActions["viewShowGuides"], "View"); |
||
875 | scrMenuMgr->addMenuItem(scrActions["viewShowColumnBorders"], "View"); |
||
876 | scrMenuMgr->addMenuItem(scrActions["viewShowBaseline"], "View"); |
||
877 | scrMenuMgr->addMenuItem(scrActions["viewShowTextChain"], "View"); |
||
878 | scrMenuMgr->addMenuItem(scrActions["viewShowTextControls"], "View"); |
||
879 | scrMenuMgr->addMenuItem(scrActions["viewShowRulers"], "View"); |
||
880 | scrMenuMgr->addMenuItem(scrActions["viewRulerMode"], "View"); |
||
881 | |||
882 | scrActions["viewShowRulers"]->setEnabled(false); |
||
883 | |||
884 | //CB If this is viewNewView imeplemented, it should be on the windows menu |
||
885 | // scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View"); |
||
886 | |||
887 | //Tool menu |
||
888 | /* |
||
889 | scrMenuMgr->createMenu("Tools", tr("&Tools")); |
||
890 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Tools"); |
||
891 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Tools"); |
||
892 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Tools"); |
||
893 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Tools"); |
||
894 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Tools"); |
||
895 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Tools"); |
||
896 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Tools"); |
||
897 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Tools"); |
||
898 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Tools"); |
||
899 | scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Tools"); |
||
900 | scrMenuMgr->addMenuSeparator("Tools"); |
||
901 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Tools"); |
||
902 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Tools"); |
||
903 | //scrActions["toolsPreflightVerifier"]->setEnabled(false);*/ |
||
904 | |||
905 | //Extra menu |
||
906 | scrMenuMgr->createMenu("Extras", tr("E&xtras")); |
||
907 | scrMenuMgr->addMenuItem(scrActions["extrasManagePictures"], "Extras"); |
||
908 | scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras"); |
||
909 | scrMenuMgr->addMenuItem(scrActions["extrasDeHyphenateText"], "Extras"); |
||
910 | scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras"); |
||
911 | |||
912 | scrMenuMgr->setMenuEnabled("Extras", false); |
||
913 | scrActions["extrasHyphenateText"]->setEnabled(false); |
||
914 | scrActions["extrasDeHyphenateText"]->setEnabled(false); |
||
915 | |||
916 | //Window menu |
||
917 | scrMenuMgr->createMenu("Windows", tr("&Windows"), QString::null, true); |
||
8999 | cbradney | 918 | //Qt4 connect(FontMenu, SIGNAL(aboutToShow()), this, SLOT(fontMenuAboutToShow())); |
5800 | fschmid | 919 | connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
920 | addDefaultWindowMenuItems(); |
||
921 | |||
922 | //Help menu |
||
923 | scrMenuMgr->createMenu("Help", tr("&Help")); |
||
7425 | cbradney | 924 | scrMenuMgr->addMenuItem(scrActions["helpManual"], "Help"); |
925 | scrMenuMgr->addMenuSeparator("Help"); |
||
926 | scrMenuMgr->addMenuItem(scrActions["helpTooltips"], "Help"); |
||
927 | scrMenuMgr->addMenuSeparator("Help"); |
||
5800 | fschmid | 928 | scrMenuMgr->addMenuItem(scrActions["helpAboutScribus"], "Help"); |
929 | scrMenuMgr->addMenuItem(scrActions["helpAboutPlugins"], "Help"); |
||
930 | scrMenuMgr->addMenuItem(scrActions["helpAboutQt"], "Help"); |
||
7425 | cbradney | 931 | |
5800 | fschmid | 932 | scrMenuMgr->addMenuToMenuBar("File"); |
933 | scrMenuMgr->addMenuToMenuBar("Edit"); |
||
934 | scrMenuMgr->addMenuToMenuBar("Style"); |
||
935 | scrMenuMgr->setMenuEnabled("Style", false); |
||
936 | scrMenuMgr->addMenuToMenuBar("Item"); |
||
937 | scrMenuMgr->setMenuEnabled("Item", false); |
||
938 | scrMenuMgr->addMenuToMenuBar("Insert"); |
||
939 | scrMenuMgr->setMenuEnabled("Insert", false); |
||
940 | scrMenuMgr->addMenuToMenuBar("Page"); |
||
941 | scrMenuMgr->setMenuEnabled("Page", false); |
||
942 | scrMenuMgr->addMenuToMenuBar("View"); |
||
943 | scrMenuMgr->setMenuEnabled("View", false); |
||
944 | //scrMenuMgr->addMenuToMenuBar("Tools"); |
||
945 | scrMenuMgr->addMenuToMenuBar("Extras"); |
||
946 | scrMenuMgr->setMenuEnabled("Extras", false); |
||
947 | scrMenuMgr->addMenuToMenuBar("Windows"); |
||
948 | //scrMenuMgr->setMenuEnabled("Windows", false); |
||
949 | menuBar()->insertSeparator(); |
||
950 | scrMenuMgr->addMenuToMenuBar("Help"); |
||
951 | |||
952 | //Alignment menu |
||
953 | scrMenuMgr->createMenu("Alignment", tr("&Alignment")); |
||
954 | scrMenuMgr->addMenuItem(scrActions["alignLeft"], "Alignment"); |
||
955 | scrMenuMgr->addMenuItem(scrActions["alignCenter"], "Alignment"); |
||
956 | scrMenuMgr->addMenuItem(scrActions["alignRight"], "Alignment"); |
||
957 | scrMenuMgr->addMenuItem(scrActions["alignBlock"], "Alignment"); |
||
958 | scrMenuMgr->addMenuItem(scrActions["alignForced"], "Alignment"); |
||
959 | |||
8666 | cbradney | 960 | //Qt4 connect(ColorMenC, SIGNAL(activated(int)), this, SLOT(setItemFarbe(int))); |
8591 | cbradney | 961 | //Qt4 connect(FontMenu, SIGNAL(activated(int)), this, SLOT(setItemFont(int))); |
5800 | fschmid | 962 | } |
963 | |||
964 | void ScribusMainWindow::addDefaultWindowMenuItems() |
||
965 | { |
||
966 | scrMenuMgr->clearMenu("Windows"); |
||
967 | scrMenuMgr->addMenuItem(scrActions["windowsCascade"], "Windows"); |
||
968 | scrMenuMgr->addMenuItem(scrActions["windowsTile"], "Windows"); |
||
969 | scrMenuMgr->addMenuSeparator("Windows"); |
||
970 | |||
971 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Windows"); |
||
972 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Windows"); |
||
973 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Windows"); |
||
974 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Windows"); |
||
975 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Windows"); |
||
976 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Windows"); |
||
977 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Windows"); |
||
978 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Windows"); |
||
979 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Windows"); |
||
980 | scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Windows"); |
||
981 | scrMenuMgr->addMenuSeparator("Windows"); |
||
982 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Windows"); |
||
983 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Windows"); |
||
984 | } |
||
985 | |||
986 | |||
987 | void ScribusMainWindow::initStatusBar() |
||
988 | { |
||
989 | mainWindowStatusLabel = new QLabel( " ", statusBar(), "ft"); |
||
8501 | cbradney | 990 | mainWindowProgressBar = new Q3ProgressBar(statusBar(), "p"); |
5800 | fschmid | 991 | mainWindowProgressBar->setCenterIndicator(true); |
992 | mainWindowProgressBar->setFixedWidth( 100 ); |
||
993 | mainWindowProgressBar->reset(); |
||
994 | mainWindowXPosLabel = new QLabel( "X-Pos:", statusBar(), "xt"); |
||
995 | mainWindowYPosLabel = new QLabel( "Y-Pos:", statusBar(), "yt"); |
||
996 | mainWindowXPosDataLabel = new QLabel( " ", statusBar(), "dt"); |
||
997 | mainWindowYPosDataLabel = new QLabel( " ", statusBar(), "ydt"); |
||
998 | |||
999 | statusBar()->addWidget(mainWindowStatusLabel, 6, true); |
||
1000 | statusBar()->addWidget(mainWindowProgressBar, 0, true); |
||
1001 | statusBar()->addWidget(mainWindowXPosLabel, 0, true); |
||
1002 | statusBar()->addWidget(mainWindowXPosDataLabel, 1, true); |
||
1003 | statusBar()->addWidget(mainWindowYPosLabel, 0, true); |
||
1004 | statusBar()->addWidget(mainWindowYPosDataLabel, 1, true); |
||
1005 | } |
||
1006 | |||
1007 | void ScribusMainWindow::setStatusBarMousePosition(double xp, double yp) |
||
1008 | { |
||
1009 | double xn = xp; |
||
1010 | double yn = yp; |
||
1011 | if (doc->guidesSettings.rulerMode) |
||
1012 | { |
||
1013 | xn -= doc->currentPage()->xOffset(); |
||
1014 | yn -= doc->currentPage()->yOffset(); |
||
1015 | } |
||
1016 | xn -= doc->rulerXoffset; |
||
1017 | yn -= doc->rulerYoffset; |
||
1018 | QString suffix=unitGetSuffixFromIndex(doc->unitIndex()); |
||
1019 | int multiplier=unitGetDecimalsFromIndex(doc->unitIndex()); |
||
1020 | double divisor=static_cast<double>(multiplier); |
||
1021 | int precision=unitGetPrecisionFromIndex(doc->unitIndex()); |
||
1022 | QString tmp; |
||
1023 | mainWindowXPosDataLabel->setText(tmp.setNum(qRound(xn*doc->unitRatio() * multiplier) / divisor, 'f', precision) + suffix); |
||
1024 | mainWindowYPosDataLabel->setText(tmp.setNum(qRound(yn*doc->unitRatio() * multiplier) / divisor, 'f', precision) + suffix); |
||
1025 | } |
||
1026 | |||
1027 | void ScribusMainWindow::setStatusBarInfoText(QString newText) |
||
1028 | { |
||
1029 | if (mainWindowStatusLabel) |
||
1030 | mainWindowStatusLabel->setText(newText); |
||
1031 | } |
||
1032 | |||
1033 | //CB-->Doc |
||
1034 | void ScribusMainWindow::setTBvals(PageItem *currItem) |
||
1035 | { |
||
1036 | if (currItem->itemText.length() != 0) |
||
1037 | { |
||
8562 | jghali | 1038 | // int ChPos = qMin(currItem->CPos, static_cast<int>(currItem->itemText.length()-1)); |
6866 | avox | 1039 | const ParagraphStyle& currPStyle(currItem->currentStyle()); |
5800 | fschmid | 1040 | setAbsValue(currPStyle.alignment()); |
6866 | avox | 1041 | propertiesPalette->setParStyle(currPStyle.parent()); |
9607 | avox | 1042 | propertiesPalette->setCharStyle(currItem->currentCharStyle().parent()); |
9067 | avox | 1043 | doc->currentStyle = currItem->currentStyle(); |
5800 | fschmid | 1044 | doc->currentStyle.charStyle() = currItem->currentCharStyle(); |
9067 | avox | 1045 | emit TextStyle(doc->currentStyle); |
1046 | // to go: (av) |
||
5800 | fschmid | 1047 | emit TextUnderline(doc->currentStyle.charStyle().underlineOffset(), doc->currentStyle.charStyle().underlineWidth()); |
1048 | emit TextStrike(doc->currentStyle.charStyle().strikethruOffset(), doc->currentStyle.charStyle().strikethruWidth()); |
||
1049 | emit TextShadow(doc->currentStyle.charStyle().shadowXOffset(), doc->currentStyle.charStyle().shadowYOffset()); |
||
7087 | subik | 1050 | emit TextFarben(doc->currentStyle.charStyle().strokeColor(), |
1051 | doc->currentStyle.charStyle().fillColor(), |
||
1052 | doc->currentStyle.charStyle().strokeShade(), |
||
5800 | fschmid | 1053 | doc->currentStyle.charStyle().fillShade()); |
5980 | avox | 1054 | emit TextIFont(doc->currentStyle.charStyle().font().scName()); |
5800 | fschmid | 1055 | emit TextISize(doc->currentStyle.charStyle().fontSize()); |
1056 | emit TextUSval(doc->currentStyle.charStyle().tracking()); |
||
1057 | emit TextStil(doc->currentStyle.charStyle().effects()); |
||
1058 | emit TextScale(doc->currentStyle.charStyle().scaleH()); |
||
1059 | emit TextScaleV(doc->currentStyle.charStyle().scaleV()); |
||
1060 | emit TextBase(doc->currentStyle.charStyle().baselineOffset()); |
||
1061 | emit TextOutline(doc->currentStyle.charStyle().outlineWidth()); |
||
1062 | } |
||
1063 | } |
||
1064 | |||
1065 | void ScribusMainWindow::wheelEvent(QWheelEvent *w) |
||
1066 | { |
||
1067 | if (HaveDoc) |
||
1068 | { |
||
1069 | int wheelVal=prefsManager->mouseWheelValue(); |
||
8523 | cbradney | 1070 | if ((w->orientation() != Qt::Vertical) || ( w->state() & Qt::ShiftButton )) |
5800 | fschmid | 1071 | { |
1072 | if (w->delta() < 0) |
||
1073 | view->scrollBy(wheelVal, 0); |
||
1074 | else |
||
1075 | view->scrollBy(-wheelVal, 0); |
||
1076 | } |
||
1077 | else |
||
1078 | { |
||
1079 | if (w->delta() < 0) |
||
1080 | view->scrollBy(0, wheelVal); |
||
1081 | else |
||
1082 | view->scrollBy(0, -wheelVal); |
||
1083 | } |
||
1084 | w->accept(); |
||
1085 | } |
||
1086 | } |
||
1087 | |||
1088 | //Special keys assigned to actions are stolen by the action and not passed to |
||
1089 | //keyPressEvent so process them here. |
||
8080 | cbradney | 1090 | void ScribusMainWindow::specialActionKeyEvent(const QString& actionName, int unicodevalue) |
5800 | fschmid | 1091 | { |
1092 | if (HaveDoc) |
||
1093 | { |
||
1094 | if (doc->appMode==modeEdit) |
||
1095 | { |
||
1096 | if (doc->m_Selection->count() == 1) |
||
1097 | { |
||
1098 | PageItem *currItem = doc->m_Selection->itemAt(0); |
||
1099 | if (currItem!=NULL) |
||
1100 | { |
||
1101 | if (unicodevalue!=-1) |
||
1102 | { |
||
1103 | if (currItem->HasSel && currItem->itemType()==PageItem::TextFrame) |
||
1104 | currItem->asTextFrame()->deleteSelectedTextFromFrame(); |
||
1105 | |||
9646 | avox | 1106 | currItem->itemText.insertChars(currItem->CPos, QString(QChar(unicodevalue)), true); |
5800 | fschmid | 1107 | currItem->CPos += 1; |
8177 | avox | 1108 | // currItem->Tinput = true; |
5800 | fschmid | 1109 | view->RefreshItem(currItem); |
1110 | } |
||
1111 | else if (actionName=="unicodeSmartHyphen") //ignore the char as we use an attribute if the text item, for now. |
||
1112 | { |
||
7087 | subik | 1113 | // this code is currently dead since unicodeSmartHyphen |
6999 | avox | 1114 | // doesnt have unicodevalue == -1 any more |
5800 | fschmid | 1115 | if (currItem->CPos-1>0) |
1116 | { |
||
7442 | avox | 1117 | #if 0 |
8562 | jghali | 1118 | StyleFlag fl = currItem->itemText.item(qMax(currItem->CPos-1,0))->effects(); |
5800 | fschmid | 1119 | fl |= ScStyle_HyphenationPossible; |
8562 | jghali | 1120 | currItem->itemText.item(qMax(currItem->CPos-1,0))->setEffects(fl); |
5800 | fschmid | 1121 | #else |
9646 | avox | 1122 | currItem->itemText.insertChars(currItem->CPos, QString(SpecialChars::SHYPHEN), true); |
5800 | fschmid | 1123 | currItem->CPos += 1; |
1124 | #endif |
||
8177 | avox | 1125 | // currItem->Tinput = true; |
5800 | fschmid | 1126 | view->RefreshItem(currItem); |
1127 | } |
||
1128 | } |
||
1129 | } |
||
1130 | } |
||
1131 | } |
||
1132 | } |
||
1133 | } |
||
1134 | |||
1135 | bool ScribusMainWindow::eventFilter( QObject* /*o*/, QEvent *e ) |
||
1136 | { |
||
1137 | bool retVal; |
||
9562 | fschmid | 1138 | if (e->type() == QEvent::ToolTip) |
1139 | { |
||
1140 | if (prefsManager->appPrefs.showToolTips) |
||
1141 | return false; |
||
1142 | else |
||
1143 | return true; |
||
1144 | } |
||
5800 | fschmid | 1145 | if ( e->type() == QEvent::KeyPress ) { |
1146 | QKeyEvent *k = (QKeyEvent *)e; |
||
1147 | int keyMod=0; |
||
8523 | cbradney | 1148 | if (k->state() & Qt::ShiftButton) |
1149 | keyMod |= Qt::SHIFT; |
||
1150 | if (k->state() & Qt::ControlButton) |
||
1151 | keyMod |= Qt::CTRL; |
||
1152 | if (k->state() & Qt::AltButton) |
||
1153 | keyMod |= Qt::ALT; |
||
5800 | fschmid | 1154 | |
1155 | QKeySequence currKeySeq = QKeySequence(k->key() | keyMod); |
||
1156 | if (QString(currKeySeq).isNull()) |
||
1157 | return false; |
||
1158 | retVal=true; |
||
1159 | //Palette actions |
||
1160 | if (currKeySeq == scrActions["specialToggleAllPalettes"]->accel()) |
||
8613 | cbradney | 1161 | scrActions["specialToggleAllPalettes"]->activate(QAction::Trigger); |
5800 | fschmid | 1162 | else |
1163 | if (currKeySeq == scrActions["toolsProperties"]->accel()) |
||
1164 | scrActions["toolsProperties"]->toggle(); |
||
1165 | else |
||
1166 | if (currKeySeq == scrActions["toolsOutline"]->accel()) |
||
1167 | scrActions["toolsOutline"]->toggle(); |
||
1168 | else |
||
1169 | if (currKeySeq == scrActions["toolsScrapbook"]->accel()) |
||
1170 | scrActions["toolsScrapbook"]->toggle(); |
||
1171 | else |
||
1172 | if (currKeySeq == scrActions["toolsLayers"]->accel()) |
||
1173 | scrActions["toolsLayers"]->toggle(); |
||
1174 | else |
||
1175 | if (currKeySeq == scrActions["toolsPages"]->accel()) |
||
1176 | scrActions["toolsPages"]->toggle(); |
||
1177 | else |
||
1178 | if (currKeySeq == scrActions["toolsBookmarks"]->accel()) |
||
1179 | scrActions["toolsBookmarks"]->toggle(); |
||
1180 | else |
||
1181 | if (currKeySeq == scrActions["toolsActionHistory"]->accel()) |
||
1182 | scrActions["toolsActionHistory"]->toggle(); |
||
1183 | else |
||
1184 | if (currKeySeq == scrActions["toolsPreflightVerifier"]->accel()) |
||
1185 | scrActions["toolsPreflightVerifier"]->toggle(); |
||
1186 | else |
||
1187 | if (currKeySeq == scrActions["toolsAlignDistribute"]->accel()) |
||
1188 | scrActions["toolsAlignDistribute"]->toggle(); |
||
1189 | else |
||
8005 | cbradney | 1190 | //Edit actions |
1191 | if (currKeySeq == scrActions["editStyles"]->accel()) |
||
1192 | scrActions["editStyles"]->toggle(); |
||
1193 | else |
||
5800 | fschmid | 1194 | if (currKeySeq == scrActions["editUndoAction"]->accel() && scrActions["editUndoAction"]->isEnabled()) |
8613 | cbradney | 1195 | scrActions["editUndoAction"]->activate(QAction::Trigger); |
5800 | fschmid | 1196 | else |
1197 | if (currKeySeq == scrActions["editRedoAction"]->accel() && scrActions["editRedoAction"]->isEnabled()) |
||
8613 | cbradney | 1198 | scrActions["editRedoAction"]->activate(QAction::Trigger); |
5800 | fschmid | 1199 | else |
1200 | //Other actions |
||
1201 | if (currKeySeq == scrActions["fileQuit"]->accel()) |
||
8613 | cbradney | 1202 | scrActions["fileQuit"]->activate(QAction::Trigger); |
5800 | fschmid | 1203 | else |
1204 | //Zoom actions |
||
1205 | if (currKeySeq == scrActions["toolsZoomIn"]->accel()) |
||
8613 | cbradney | 1206 | scrActions["toolsZoomIn"]->activate(QAction::Trigger); |
5800 | fschmid | 1207 | else |
1208 | if (currKeySeq == scrActions["toolsZoomOut"]->accel()) |
||
8613 | cbradney | 1209 | scrActions["toolsZoomOut"]->activate(QAction::Trigger); |
5800 | fschmid | 1210 | else |
1211 | retVal=false; |
||
1212 | } |
||
1213 | else |
||
1214 | retVal=false; |
||
1215 | //Return false to pass event to object |
||
1216 | return retVal; |
||
1217 | } |
||
1218 | |||
1219 | void ScribusMainWindow::keyPressEvent(QKeyEvent *k) |
||
1220 | { |
||
1221 | QWidgetList windows; |
||
1222 | QWidget* w = NULL; |
||
1223 | int kk = k->key(); |
||
1224 | QString uc = k->text(); |
||
1225 | QString cr, Tcha, Twort; |
||
7435 | fschmid | 1226 | if (HaveDoc) |
1227 | { |
||
8523 | cbradney | 1228 | if ((doc->appMode == modeMagnifier) && (kk == Qt::Key_Shift)) |
7435 | fschmid | 1229 | { |
9380 | fschmid | 1230 | qApp->changeOverrideCursor(QCursor(loadIcon("LupeZm.xpm"))); |
7435 | fschmid | 1231 | return; |
1232 | } |
||
1233 | } |
||
5800 | fschmid | 1234 | if (keyrep) |
1235 | return; |
||
1236 | keyrep = true; |
||
1237 | int KeyMod; |
||
1238 | switch (k->state()) |
||
1239 | { |
||
8523 | cbradney | 1240 | case Qt::ShiftButton: |
1241 | KeyMod = Qt::SHIFT; |
||
5800 | fschmid | 1242 | break; |
8523 | cbradney | 1243 | case Qt::AltButton: |
1244 | KeyMod = Qt::ALT; |
||
5800 | fschmid | 1245 | break; |
8523 | cbradney | 1246 | case Qt::ControlButton: |
1247 | KeyMod = Qt::CTRL; |
||
5800 | fschmid | 1248 | break; |
1249 | default: |
||
1250 | KeyMod = 0; |
||
1251 | break; |
||
1252 | } |
||
1253 | //User presses escape and we have a doc open, and we have an item selected |
||
8523 | cbradney | 1254 | if ((kk == Qt::Key_Escape) && (HaveDoc)) |
5800 | fschmid | 1255 | { |
1256 | keyrep = false; |
||
1257 | PageItem *currItem; |
||
1258 | if (doc->m_Selection->count() != 0) |
||
1259 | { |
||
1260 | currItem = doc->m_Selection->itemAt(0); |
||
1261 | switch (doc->appMode) |
||
1262 | { |
||
1263 | case modeNormal: |
||
1264 | currItem->Sizing = false; |
||
1265 | if (doc->SubMode != -1) |
||
1266 | { |
||
1267 | view->Deselect(false); |
||
1268 | doc->Items->remove(currItem->ItemNr); |
||
1269 | } |
||
5967 | fschmid | 1270 | else |
1271 | view->Deselect(false); |
||
5800 | fschmid | 1272 | break; |
7436 | fschmid | 1273 | case modeEdit: |
1274 | break; |
||
5800 | fschmid | 1275 | case modeLinkFrames: |
1276 | case modeUnlinkFrames: |
||
1277 | case modeRotation: |
||
1278 | case modeEditGradientVectors: |
||
8942 | cbradney | 1279 | case modeCopyProperties: |
5800 | fschmid | 1280 | view->Deselect(false); |
1281 | case modePanning: |
||
1282 | break; |
||
1283 | case modeDrawBezierLine: |
||
1284 | currItem->PoLine.resize(currItem->PoLine.size()-2); |
||
1285 | if (currItem->PoLine.size() < 4) |
||
1286 | { |
||
1287 | view->Deselect(false); |
||
1288 | doc->Items->remove(currItem->ItemNr); |
||
1289 | } |
||
1290 | else |
||
1291 | { |
||
7736 | cbradney | 1292 | doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false); |
8591 | cbradney | 1293 | currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2.0, 1.0))); |
7736 | cbradney | 1294 | doc->AdjustItemSize(currItem); |
5800 | fschmid | 1295 | currItem->ContourLine = currItem->PoLine.copy(); |
1296 | currItem->ClipEdited = true; |
||
1297 | currItem->FrameType = 3; |
||
1298 | slotDocCh(); |
||
1299 | } |
||
1300 | view->FirstPoly = true; |
||
1301 | break; |
||
1302 | default: |
||
1303 | view->Deselect(false); |
||
1304 | doc->Items->remove(currItem->ItemNr); |
||
1305 | break; |
||
1306 | } |
||
1307 | } |
||
1308 | view->m_MouseButtonPressed = false; |
||
1309 | doc->DragP = false; |
||
1310 | doc->leaveDrag = false; |
||
1311 | view->operItemMoving = false; |
||
1312 | view->operItemResizing = false; |
||
7284 | fschmid | 1313 | view->inItemCreation = false; |
5800 | fschmid | 1314 | view->MidButt = false; |
1315 | doc->SubMode = -1; |
||
1316 | doc->ElemToLink = NULL; |
||
1317 | NoFrameEdit(); |
||
1318 | slotSelect(); |
||
1319 | return; |
||
1320 | } |
||
8523 | cbradney | 1321 | Qt::ButtonState buttonState = k->state(); |
5800 | fschmid | 1322 | /**If we have a doc and we are not changing the page or zoom level in the status bar */ |
1323 | if ((HaveDoc) && (!view->zoomSpinBox->hasFocus()) && (!view->pageSelector->hasFocus())) |
||
1324 | { |
||
1325 | /** |
||
1326 | * With no item selected we can: |
||
1327 | * - With space, get into panning mode (modePanning) |
||
1328 | * - With PageUp, scroll up |
||
1329 | * - With PageDown, scroll down |
||
1330 | * - With Tab, change active document windowActivated |
||
1331 | */ |
||
1332 | |||
1333 | if ((doc->appMode != modeEdit) && (doc->m_Selection->count() == 0)) |
||
1334 | { |
||
6284 | fschmid | 1335 | int pg; |
8970 | fschmid | 1336 | int wheelVal = prefsManager->mouseWheelValue(); |
1337 | if ((buttonState & Qt::ShiftButton) && !(buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
||
1338 | wheelVal = qMax(qRound(wheelVal / 10.0), 1); |
||
5800 | fschmid | 1339 | switch (kk) |
1340 | { |
||
8523 | cbradney | 1341 | case Qt::Key_Space: |
5800 | fschmid | 1342 | keyrep = false; |
1343 | if (doc->appMode == modePanning) |
||
1344 | setAppMode(modeNormal); |
||
1345 | else |
||
1346 | setAppMode(modePanning); |
||
1347 | return; |
||
1348 | break; |
||
8523 | cbradney | 1349 | case Qt::Key_Prior: |
6284 | fschmid | 1350 | if (doc->masterPageMode()) |
1351 | view->scrollBy(0, -prefsManager->mouseWheelValue()); |
||
1352 | else |
||
1353 | { |
||
1354 | pg = doc->currentPageNumber(); |
||
8523 | cbradney | 1355 | if ((buttonState & Qt::ShiftButton) && !(buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
6284 | fschmid | 1356 | pg--; |
1357 | else |
||
1358 | pg -= doc->pageSets[doc->currentPageLayout].Columns; |
||
1359 | if (pg > -1) |
||
1360 | view->GotoPage(pg); |
||
1361 | } |
||
5800 | fschmid | 1362 | keyrep = false; |
1363 | return; |
||
1364 | break; |
||
8523 | cbradney | 1365 | case Qt::Key_Next: |
6284 | fschmid | 1366 | if (doc->masterPageMode()) |
1367 | view->scrollBy(0, prefsManager->mouseWheelValue()); |
||
1368 | else |
||
1369 | { |
||
1370 | pg = doc->currentPageNumber(); |
||
8523 | cbradney | 1371 | if ((buttonState & Qt::ShiftButton) && !(buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
6284 | fschmid | 1372 | pg++; |
1373 | else |
||
1374 | pg += doc->pageSets[doc->currentPageLayout].Columns; |
||
7328 | fschmid | 1375 | if (pg < static_cast<int>(doc->Pages->count())) |
6284 | fschmid | 1376 | view->GotoPage(pg); |
1377 | } |
||
5800 | fschmid | 1378 | keyrep = false; |
1379 | return; |
||
1380 | break; |
||
8970 | fschmid | 1381 | case Qt::Key_Left: |
1382 | view->scrollBy(-wheelVal, 0); |
||
1383 | keyrep = false; |
||
1384 | return; |
||
1385 | break; |
||
1386 | case Qt::Key_Right: |
||
1387 | view->scrollBy(wheelVal, 0); |
||
1388 | keyrep = false; |
||
1389 | return; |
||
1390 | break; |
||
1391 | case Qt::Key_Up: |
||
1392 | view->scrollBy(0, -wheelVal); |
||
1393 | keyrep = false; |
||
1394 | return; |
||
1395 | break; |
||
1396 | case Qt::Key_Down: |
||
1397 | view->scrollBy(0, wheelVal); |
||
1398 | keyrep = false; |
||
1399 | return; |
||
1400 | break; |
||
8523 | cbradney | 1401 | case Qt::Key_Tab: |
5800 | fschmid | 1402 | keyrep = false; |
1403 | windows = wsp->windowList(); |
||
1404 | if (windows.count() > 1) |
||
1405 | { |
||
1406 | for (int i = 0; i < static_cast<int>(windows.count()); ++i) |
||
1407 | { |
||
1408 | if (wsp->activeWindow() == windows.at(i)) |
||
1409 | { |
||
1410 | if (i == static_cast<int>(windows.count()-1)) |
||
1411 | w = windows.at(0); |
||
1412 | else |
||
1413 | w = windows.at(i+1); |
||
1414 | break; |
||
1415 | } |
||
1416 | } |
||
8220 | fschmid | 1417 | outlinePalette->buildReopenVals(); |
5800 | fschmid | 1418 | docCheckerPalette->clearErrorList(); |
1419 | if ( w ) |
||
1420 | w->showNormal(); |
||
1421 | newActWin(w); |
||
1422 | } |
||
1423 | return; |
||
1424 | break; |
||
1425 | } |
||
1426 | } |
||
1427 | /** Now if we have an item selected |
||
1428 | * - In normal mode we can: |
||
1429 | * -- Use backspace or delete to delete the item |
||
1430 | * -- Use PageUp to raise an item |
||
1431 | * -- Use PageDown to lower an item |
||
6083 | cbradney | 1432 | * -- Use the arrow keys to move an item or group around for !inches: |
5800 | fschmid | 1433 | With no meta, by 1.0 unit |
5975 | cbradney | 1434 | Ctrl, by 10.0 units |
1435 | Shift by 0.1 units |
||
1436 | Ctrl Shift 0.01 units |
||
6083 | cbradney | 1437 | - For inches: |
1438 | With no meta, by 1.0 pt |
||
1439 | Ctrl, by 1.0 unit |
||
1440 | Shift by 0.1 units |
||
1441 | Ctrl Shift 0.01 units |
||
5800 | fschmid | 1442 | * -- Use the arrow keys to resize an item: |
1443 | Alt right arrow, move right side outwards (expand) |
||
1444 | Alt left arrow, move left side outwards (expand) |
||
1445 | Alt Shift right arrow, move left side inwards (shrink) |
||
1446 | Alt Shift left arrow, move right side inwards (shrink) |
||
1447 | * -- In edit mode of an image frame, use the arrow keys to resize the image: |
||
1448 | (flows to pageitem_imageframe for control) |
||
1449 | Alt right arrow, move right side of image outwards (expand) |
||
1450 | Alt left arrow, move right side inwards (shrink) |
||
1451 | Alt down arrow, move bottom side downwards (expand) |
||
1452 | Alt up arrow, move top side inwards (shrink) |
||
1453 | */ |
||
1454 | if (doc->m_Selection->count() != 0) |
||
1455 | { |
||
1456 | double moveBy=1.0; |
||
6083 | cbradney | 1457 | if (doc->unitIndex()!=SC_INCHES) |
1458 | { |
||
8523 | cbradney | 1459 | if ((buttonState & Qt::ShiftButton) && !(buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
6083 | cbradney | 1460 | moveBy=0.1; |
8523 | cbradney | 1461 | else if (!(buttonState & Qt::ShiftButton) && (buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
6083 | cbradney | 1462 | moveBy=10.0; |
8523 | cbradney | 1463 | else if ((buttonState & Qt::ShiftButton) && (buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
6083 | cbradney | 1464 | moveBy=0.01; |
7087 | subik | 1465 | |
6083 | cbradney | 1466 | moveBy/=doc->unitRatio();//Lets allow movement by the current doc ratio, not only points |
1467 | } |
||
1468 | else |
||
1469 | { |
||
8523 | cbradney | 1470 | if ((buttonState & Qt::ShiftButton) && !(buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
6083 | cbradney | 1471 | moveBy=0.1/doc->unitRatio(); |
8523 | cbradney | 1472 | else if (!(buttonState & Qt::ShiftButton) && (buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
6083 | cbradney | 1473 | moveBy=1.0/doc->unitRatio(); |
8523 | cbradney | 1474 | else if ((buttonState & Qt::ShiftButton) && (buttonState & Qt::ControlButton) && !(buttonState & Qt::AltButton)) |
6083 | cbradney | 1475 | moveBy=0.01/doc->unitRatio(); |
1476 | } |
||
8523 | cbradney | 1477 | bool resizing=((buttonState & Qt::AltButton) && !(buttonState & Qt::ControlButton)); |
1478 | bool resizingsmaller=(resizing && (buttonState & Qt::ShiftButton)); |
||
5800 | fschmid | 1479 | double resizeBy=1.0; |
1480 | //CB with control locked out due to the requirement of moveby of 0.01, we cannot support |
||
1481 | //resizeby 10 units unless we move to supporting modifier keys that most people dont have. |
||
8523 | cbradney | 1482 | //if (buttonState & Qt::ControlButton) |
5800 | fschmid | 1483 | // resizeBy*=10.0; |
1484 | resizeBy/=doc->unitRatio(); |
||
1485 | if (resizingsmaller) |
||
1486 | resizeBy*=-1.0; |
||
1487 | |||
1488 | |||
1489 | PageItem *currItem = doc->m_Selection->itemAt(0); |
||
1490 | switch (doc->appMode) |
||
1491 | { |
||
1492 | case modeNormal: |
||
1493 | switch (kk) |
||
1494 | { |
||
8523 | cbradney | 1495 | case Qt::Key_Backspace: |
1496 | case Qt::Key_Delete: |
||
5800 | fschmid | 1497 | doc->itemSelection_DeleteItem(); |
1498 | break; |
||
8523 | cbradney | 1499 | case Qt::Key_Prior: |
5800 | fschmid | 1500 | if (!currItem->locked()) |
1501 | { |
||
1502 | view->RaiseItem(); |
||
1503 | } |
||
1504 | break; |
||
8523 | cbradney | 1505 | case Qt::Key_Next: |
5800 | fschmid | 1506 | if (!currItem->locked()) |
1507 | { |
||
1508 | view->LowerItem(); |
||
1509 | } |
||
1510 | break; |
||
8523 | cbradney | 1511 | case Qt::Key_Left: |
5800 | fschmid | 1512 | if (!currItem->locked()) |
1513 | { |
||
1514 | if (!resizing) |
||
1515 | { |
||
1516 | if ((doc->EditClip) && (view->ClRe != -1)) |
||
1517 | { |
||
1518 | FPoint np; |
||
1519 | if (view->EditContour) |
||
1520 | np = currItem->ContourLine.point(view->ClRe); |
||
1521 | else |
||
1522 | np = currItem->PoLine.point(view->ClRe); |
||
1523 | np = np - FPoint(moveBy, 0); |
||
1524 | view->MoveClipPoint(currItem, np); |
||
1525 | } |
||
1526 | else |
||
1527 | { |
||
1528 | /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ |
||
1529 | /* as the user might be trying to fine tune a position */ |
||
1530 | bool sav1 = doc->SnapGuides; |
||
1531 | bool sav2 = doc->useRaster; |
||
1532 | doc->SnapGuides = false; |
||
1533 | doc->useRaster = false; |
||
1534 | view->moveGroup(-moveBy, 0); |
||
1535 | doc->SnapGuides = sav1; |
||
1536 | doc->useRaster = sav2; |
||
1537 | } |
||
1538 | } |
||
1539 | else |
||
1540 | { |
||
1541 | //CB If in EditContour mode, allow contour line to be scaled with arrow keys too |
||
1542 | if(view->EditContour) |
||
1543 | view->TransformPoly(10, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex())); |
||
1544 | else |
||
1545 | { |
||
1546 | if (resizingsmaller) |
||
1547 | { |
||
1548 | currItem->Sizing = false; |
||
7736 | cbradney | 1549 | doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true); |
5800 | fschmid | 1550 | } |
1551 | else |
||
1552 | { |
||
7736 | cbradney | 1553 | doc->MoveItem(-resizeBy, 0, currItem, false); |
5922 | cbradney | 1554 | currItem->moveImageXYOffsetBy(resizeBy/currItem->imageXScale(), 0); |
5800 | fschmid | 1555 | currItem->Sizing = false; |
7736 | cbradney | 1556 | doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true); |
5800 | fschmid | 1557 | } |
1558 | } |
||
1559 | } |
||
1560 | view->updateContents(); |
||
1561 | slotDocCh(); |
||
1562 | } |
||
1563 | break; |
||
8523 | cbradney | 1564 | case Qt::Key_Right: |
5800 | fschmid | 1565 | if (!currItem->locked()) |
1566 | { |
||
1567 | if (!resizing) |
||
1568 | { |
||
1569 | if ((doc->EditClip) && (view->ClRe != -1)) |
||
1570 | { |
||
1571 | FPoint np; |
||
1572 | if (view->EditContour) |
||
1573 | np = currItem->ContourLine.point(view->ClRe); |
||
1574 | else |
||
1575 | np = currItem->PoLine.point(view->ClRe); |
||
1576 | np = np + FPoint(moveBy, 0); |
||
1577 | view->MoveClipPoint(currItem, np); |
||
1578 | } |
||
1579 | else |
||
1580 | { |
||
1581 | /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ |
||
1582 | /* as the user might be trying to fine tune a position */ |
||
1583 | bool sav1 = doc->SnapGuides; |
||
1584 | bool sav2 = doc->useRaster; |
||
1585 | doc->SnapGuides = false; |
||
1586 | doc->useRaster = false; |
||
1587 | view->moveGroup(moveBy, 0); |
||
1588 | doc->SnapGuides = sav1; |
||
1589 | doc->useRaster = sav2; |
||
1590 | } |
||
1591 | } |
||
1592 | else |
||
1593 | { |
||
1594 | //CB If in EditContour mode, allow contour line to be scaled with arrow keys too |
||
1595 | if(view->EditContour) |
||
1596 | view->TransformPoly(11, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex())); |
||
1597 | else |
||
1598 | { |
||
1599 | if (resizingsmaller) |
||
1600 | { |
||
7736 | cbradney | 1601 | doc->MoveItem(-resizeBy, 0, currItem, false); |
5922 | cbradney | 1602 | currItem->moveImageXYOffsetBy(resizeBy/currItem->imageXScale(), 0); |
5800 | fschmid | 1603 | currItem->Sizing = false; |
7736 | cbradney | 1604 | doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true); |
5800 | fschmid | 1605 | } |
1606 | else |
||
1607 | { |
||
1608 | currItem->Sizing = false; |
||
7736 | cbradney | 1609 | doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true); |
5800 | fschmid | 1610 | } |
1611 | } |
||
1612 | } |
||
1613 | view->updateContents(); |
||
1614 | slotDocCh(); |
||
1615 | } |
||
1616 | break; |
||
8523 | cbradney | 1617 | case Qt::Key_Up: |
5800 | fschmid | 1618 | if (!currItem->locked()) |
1619 | { |
||
1620 | if (!resizing) |
||
1621 | { |
||
1622 | if ((doc->EditClip) && (view->ClRe != -1)) |
||
1623 | { |
||
1624 | FPoint np; |
||
1625 | if (view->EditContour) |
||
1626 | np = currItem->ContourLine.point(view->ClRe); |
||
1627 | else |
||
1628 | np = currItem->PoLine.point(view->ClRe); |
||
1629 | np = np - FPoint(0, moveBy); |
||
1630 | view->MoveClipPoint(currItem, np); |
||
1631 | } |
||
1632 | else |
||
1633 | { |
||
1634 | /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ |
||
1635 | /* as the user might be trying to fine tune a position */ |
||
1636 | bool sav1 = doc->SnapGuides; |
||
1637 | bool sav2 = doc->useRaster; |
||
1638 | doc->SnapGuides = false; |
||
1639 | doc->useRaster = false; |
||
1640 | view->moveGroup(0, -moveBy); |
||
1641 | doc->SnapGuides = sav1; |
||
1642 | doc->useRaster = sav2; |
||
1643 | } |
||
1644 | } |
||
1645 | else |
||
1646 | { |
||
1647 | //CB If in EditContour mode, allow contour line to be scaled with arrow keys too |
||
1648 | if(view->EditContour) |
||
1649 | view->TransformPoly(12, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex())); |
||
1650 | else |
||
1651 | { |
||
1652 | if (resizingsmaller) |
||
1653 | { |
||
1654 | currItem->Sizing = false; |
||
7736 | cbradney | 1655 | doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true); |
5800 | fschmid | 1656 | } |
1657 | else |
||
1658 | { |
||
7736 | cbradney | 1659 | doc->MoveItem(0, -resizeBy, currItem, false); |
5922 | cbradney | 1660 | currItem->moveImageXYOffsetBy(0, resizeBy/currItem->imageYScale()); |
5800 | fschmid | 1661 | currItem->Sizing = false; |
7736 | cbradney | 1662 | doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true); |
5800 | fschmid | 1663 | } |
1664 | } |
||
1665 | } |
||
1666 | view->updateContents(); |
||
1667 | slotDocCh(); |
||
1668 | } |
||
1669 | break; |
||
8523 | cbradney | 1670 | case Qt::Key_Down: |
5800 | fschmid | 1671 | if (!currItem->locked()) |
1672 | { |
||
1673 | if (!resizing) |
||
1674 | { |
||
1675 | if ((doc->EditClip) && (view->ClRe != -1)) |
||
1676 | { |
||
1677 | FPoint np; |
||
1678 | if (view->EditContour) |
||
1679 | np = currItem->ContourLine.point(view->ClRe); |
||
1680 | else |
||
1681 | np = currItem->PoLine.point(view->ClRe); |
||
1682 | np = np + FPoint(0, moveBy); |
||
1683 | view->MoveClipPoint(currItem, np); |
||
1684 | } |
||
1685 | else |
||
1686 | { |
||
1687 | /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ |
||
1688 | /* as the user might be trying to fine tune a position */ |
||
1689 | bool sav1 = doc->SnapGuides; |
||
1690 | bool sav2 = doc->useRaster; |
||
1691 | doc->SnapGuides = false; |
||
1692 | doc->useRaster = false; |
||
1693 | view->moveGroup(0, moveBy); |
||
1694 | doc->SnapGuides = sav1; |
||
1695 | doc->useRaster = sav2; |
||
1696 | } |
||
1697 | } |
||
1698 | else |
||
1699 | { |
||
1700 | //CB If in EditContour mode, allow contour line to be scaled with arrow keys too |
||
1701 | if(view->EditContour) |
||
1702 | view->TransformPoly(13, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex())); |
||
1703 | else |
||
1704 | { |
||
1705 | if (resizingsmaller) |
||
1706 | { |
||
7736 | cbradney | 1707 | doc->MoveItem(0, -resizeBy, currItem, false); |
5922 | cbradney | 1708 | currItem->moveImageXYOffsetBy(0, resizeBy/currItem->imageYScale()); |
5800 | fschmid | 1709 | currItem->Sizing = false; |
7736 | cbradney | 1710 | doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true); |
5800 | fschmid | 1711 | } |
1712 | else |
||
1713 | { |
||
1714 | currItem->Sizing = false; |
||
7736 | cbradney | 1715 | doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true); |
5800 | fschmid | 1716 | } |
1717 | } |
||
1718 | } |
||
1719 | view->updateContents(); |
||
1720 | slotDocCh(); |
||
1721 | } |
||
1722 | break; |
||
1723 | default: |
||
1724 | break; |
||
1725 | } |
||
1726 | break; |
||
1727 | case modeEdit: |
||
1728 | if (currItem->asImageFrame() && !currItem->locked()) |
||
1729 | { |
||
1730 | currItem->handleModeEditKey(k, keyrep); |
||
1731 | /* |
||
1732 | double dX=0.0,dY=0.0; |
||
1733 | switch (kk) |
||
1734 | { |
||
8523 | cbradney | 1735 | case Qt::Key_Left: |
5800 | fschmid | 1736 | dX=-moveBy; |
1737 | break; |
||
8523 | cbradney | 1738 | case Qt::Key_Right: |
5800 | fschmid | 1739 | dX=moveBy; |
1740 | break; |
||
8523 | cbradney | 1741 | case Qt::Key_Up: |
5800 | fschmid | 1742 | dY=-moveBy; |
1743 | break; |
||
8523 | cbradney | 1744 | case Qt::Key_Down: |
5800 | fschmid | 1745 | dY=moveBy; |
1746 | break; |
||
1747 | } |
||
1748 | if (dX!=0.0 || dY!=0.0) |
||
1749 | { |
||
1750 | currItem->moveImageInFrame(dX, dY); |
||
1751 | view->updateContents(currItem->getRedrawBounding(view->scale())); |
||
1752 | }*/ |
||
1753 | } |
||
1754 | view->oldCp = currItem->CPos; |
||
1755 | if (currItem->itemType() == PageItem::TextFrame) |
||
1756 | { |
||
1757 | bool kr=keyrep; |
||
1758 | currItem->handleModeEditKey(k, keyrep); |
||
1759 | keyrep=kr; |
||
1760 | } |
||
1761 | slotDocCh(false); |
||
1762 | break; |
||
1763 | } |
||
1764 | } |
||
1765 | } |
||
1766 | switch(kk) |
||
1767 | { |
||
8523 | cbradney | 1768 | case Qt::Key_Left: |
1769 | case Qt::Key_Right: |
||
1770 | case Qt::Key_Up: |
||
1771 | case Qt::Key_Down: |
||
5800 | fschmid | 1772 | _arrowKeyDown = true; |
1773 | } |
||
1774 | keyrep = false; |
||
1775 | } |
||
1776 | |||
1777 | void ScribusMainWindow::keyReleaseEvent(QKeyEvent *k) |
||
1778 | { |
||
8523 | cbradney | 1779 | if (HaveDoc && (k->state() & Qt::ControlButton)) |
5800 | fschmid | 1780 | { |
1781 | if ((doc->appMode == modePanning) && (k->state() & Qt::RightButton)) |
||
1782 | setAppMode(modeNormal); |
||
1783 | } |
||
7435 | fschmid | 1784 | if (HaveDoc) |
1785 | { |
||
1786 | if (doc->appMode == modeMagnifier) |
||
9380 | fschmid | 1787 | qApp->changeOverrideCursor(QCursor(loadIcon("LupeZ.xpm"))); |
7435 | fschmid | 1788 | } |
5800 | fschmid | 1789 | if (k->isAutoRepeat() || !_arrowKeyDown) |
1790 | return; |
||
1791 | switch(k->key()) |
||
1792 | { |
||
8523 | cbradney | 1793 | case Qt::Key_Left: |
1794 | case Qt::Key_Right: |
||
1795 | case Qt::Key_Up: |
||
1796 | case Qt::Key_Down: |
||
5800 | fschmid | 1797 | _arrowKeyDown = false; |
1798 | if ((HaveDoc) && (!view->zoomSpinBox->hasFocus()) && (!view->pageSelector->hasFocus())) |
||
1799 | { |
||
1800 | uint docSelectionCount=doc->m_Selection->count(); |
||
1801 | if ((docSelectionCount != 0) && (doc->appMode == modeNormal) && (doc->EditClip) && (view->ClRe != -1)) |
||
1802 | view->updateContents(); |
||
1803 | for (uint i = 0; i < docSelectionCount; ++i) |
||
1804 | doc->m_Selection->itemAt(i)->checkChanges(true); |
||
1805 | if (docSelectionCount > 1 && view->groupTransactionStarted()) |
||
1806 | undoManager->commit(); |
||
1807 | } |
||
1808 | break; |
||
1809 | } |
||
1810 | } |
||
1811 | |||
1812 | void ScribusMainWindow::closeEvent(QCloseEvent *ce) |
||
1813 | { |
||
1814 | QWidgetList windows = wsp->windowList(); |
||
1815 | ScribusWin* tw; |
||
1816 | disconnect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *))); |
||
1817 | if (!windows.isEmpty()) |
||
1818 | { |
||
1819 | uint windowCount=windows.count(); |
||
1820 | for ( uint i = 0; i < windowCount; ++i ) |
||
1821 | { |
||
1822 | newActWin(windows.at(i)); |
||
1823 | tw = ActWin; |
||
7839 | fschmid | 1824 | slotSelect(); |
5800 | fschmid | 1825 | ActWin->close(); |
1826 | if (tw == ActWin) |
||
1827 | { |
||
1828 | ce->ignore(); |
||
1829 | connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *))); |
||
1830 | return; |
||
1831 | } |
||
1832 | } |
||
1833 | } |
||
1834 | propertiesPalette->hide(); |
||
1835 | outlinePalette->hide(); |
||
1836 | scrapbookPalette->hide(); |
||
1837 | bookmarkPalette->hide(); |
||
1838 | layerPalette->hide(); |
||
1839 | pagePalette->hide(); |
||
1840 | measurementPalette->hide(); |
||
1841 | docCheckerPalette->hide(); |
||
1842 | undoPalette->hide(); |
||
1843 | alignDistributePalette->hide(); |
||
1844 | guidePalette->hide(); |
||
7087 | subik | 1845 | charPalette->hide(); |
5800 | fschmid | 1846 | |
1847 | // Clean up plugins, THEN save prefs to disk |
||
1848 | ScCore->pluginManager->cleanupPlugins(); |
||
1849 | if (!prefsManager->appPrefs.persistentScrapbook) |
||
1850 | scrapbookPalette->CleanUpTemp(); |
||
1851 | prefsManager->appPrefs.RecentScrapbooks.clear(); |
||
1852 | prefsManager->appPrefs.RecentScrapbooks = scrapbookPalette->getOpenScrapbooks(); |
||
1853 | if (!emergencyActivated) |
||
1854 | prefsManager->SavePrefs(); |
||
1855 | UndoManager::deleteInstance(); |
||
9380 | fschmid | 1856 | qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); |
5800 | fschmid | 1857 | exit(0); |
1858 | } |
||
1859 | |||
1860 | ///////////////////////////////////////////////////////////////////// |
||
1861 | // SLOT IMPLEMENTATION |
||
1862 | ///////////////////////////////////////////////////////////////////// |
||
1863 | |||
1864 | |||
1865 | bool ScribusMainWindow::arrowKeyDown() |
||
1866 | { |
||
1867 | return _arrowKeyDown; |
||
1868 | } |
||
1869 | |||
1870 | void ScribusMainWindow::startUpDialog() |
||
1871 | { |
||
7025 | fschmid | 1872 | bool docSet = false; |
5800 | fschmid | 1873 | PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false); |
1874 | NewDoc* dia = new NewDoc(this, RecentDocs, true); |
||
1875 | if (dia->exec()) |
||
1876 | { |
||
1877 | if (dia->tabSelected == 0) |
||
1878 | { |
||
1879 | int facingPages = dia->choosenLayout; |
||
7025 | fschmid | 1880 | int firstPage = dia->firstPage->currentItem(); |
1881 | docSet = dia->startDocSetup->isChecked(); |
||
5800 | fschmid | 1882 | double topMargin = dia->marginGroup->top(); |
1883 | double bottomMargin = dia->marginGroup->bottom(); |
||
1884 | double leftMargin = dia->marginGroup->left(); |
||
1885 | double rightMargin = dia->marginGroup->right(); |
||
1886 | double columnDistance = dia->Dist; |
||
1887 | double pageWidth = dia->pageWidth; |
||
1888 | double pageHeight = dia->pageHeight; |
||
1889 | double numberCols = dia->numberOfCols->value(); |
||
7023 | fschmid | 1890 | bool autoframes = dia->autoTextFrame->isChecked(); |
5800 | fschmid | 1891 | int orientation = dia->Orient; |
5918 | cbradney | 1892 | int pageCount=dia->pageCountSpinBox->value(); |
7518 | fschmid | 1893 | QString pagesize; |
1894 | if (dia->pageSizeComboBox->currentText() == CommonStrings::trCustomPageSize) |
||
1895 | pagesize = CommonStrings::customPageSize; |
||
1896 | else |
||
1897 | { |
||
1898 | PageSize ps2(dia->pageSizeComboBox->currentText()); |
||
1899 | pagesize = ps2.name(); |
||
1900 | } |
||
5918 | cbradney | 1901 | doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentItem(), firstPage, orientation, 1, pagesize, true, pageCount); |
5800 | fschmid | 1902 | doc->pageSets[facingPages].FirstPage = firstPage; |
7225 | cbradney | 1903 | doc->bleeds.Bottom = dia->bleedBottom; |
1904 | doc->bleeds.Top = dia->bleedTop; |
||
1905 | doc->bleeds.Left = dia->bleedLeft; |
||
1906 | doc->bleeds.Right = dia->bleedRight; |
||
5800 | fschmid | 1907 | HaveNewDoc(); |
1908 | } |
||
1909 | else |
||
1910 | { |
||
1911 | if (dia->tabSelected == 1) |
||
1912 | { |
||
1913 | QString fileName(dia->fileDialog->selectedFile()); |
||
1914 | if (!fileName.isEmpty()) |
||
1915 | { |
||
1916 | docContext->set("docsopen", fileName.left(fileName.findRev("/"))); |
||
1917 | loadDoc(fileName); |
||
1918 | } |
||
1919 | } |
||
1920 | else |
||
1921 | { |
||
1922 | QString fileName(dia->recentDocListBox->currentText()); |
||
1923 | if (!fileName.isEmpty()) |
||
7117 | jghali | 1924 | loadRecent(ScPaths::separatorsToSlashes(fileName)); |
5800 | fschmid | 1925 | } |
1926 | } |
||
1927 | } |
||
1928 | prefsManager->setShowStartupDialog(!dia->startUpDialog->isChecked()); |
||
1929 | delete dia; |
||
1930 | mainWindowStatusLabel->setText( tr("Ready")); |
||
7025 | fschmid | 1931 | if (docSet) |
1932 | slotDocSetup(); |
||
5800 | fschmid | 1933 | } |
1934 | |||
1935 | bool ScribusMainWindow::slotFileNew() |
||
1936 | { |
||
6541 | cbradney | 1937 | if (HaveDoc && doc->EditClip) |
1938 | ToggleFrameEdit(); |
||
6189 | jghali | 1939 | bool retVal = false; |
7025 | fschmid | 1940 | bool docSet = false; |
5800 | fschmid | 1941 | NewDoc* dia = new NewDoc(this, RecentDocs); |
1942 | if (dia->exec()) |
||
1943 | { |
||
1944 | int facingPages = dia->choosenLayout; |
||
7025 | fschmid | 1945 | int firstPage = dia->firstPage->currentItem(); |
1946 | docSet = dia->startDocSetup->isChecked(); |
||
5800 | fschmid | 1947 | double topMargin = dia->marginGroup->top(); |
1948 | double bottomMargin = dia->marginGroup->bottom(); |
||
1949 | double leftMargin = dia->marginGroup->left(); |
||
1950 | double rightMargin = dia->marginGroup->right(); |
||
1951 | double columnDistance = dia->Dist; |
||
1952 | double pageWidth = dia->pageWidth; |
||
1953 | double pageHeight = dia->pageHeight; |
||
1954 | double numberCols = dia->numberOfCols->value(); |
||
7023 | fschmid | 1955 | bool autoframes = dia->autoTextFrame->isChecked(); |
5800 | fschmid | 1956 | int orientation = dia->Orient; |
5918 | cbradney | 1957 | int pageCount=dia->pageCountSpinBox->value(); |
7518 | fschmid | 1958 | QString pagesize; |
1959 | if (dia->pageSizeComboBox->currentText() == CommonStrings::trCustomPageSize) |
||
1960 | pagesize = CommonStrings::customPageSize; |
||
1961 | else |
||
6189 | jghali | 1962 | { |
7518 | fschmid | 1963 | PageSize ps2(dia->pageSizeComboBox->currentText()); |
1964 | pagesize = ps2.name(); |
||
1965 | } |
||
1966 | if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentItem(), firstPage, orientation, 1, pagesize, true, pageCount)) |
||
1967 | { |
||
6189 | jghali | 1968 | doc->pageSets[facingPages].FirstPage = firstPage; |
7225 | cbradney | 1969 | doc->bleeds.Bottom = dia->bleedBottom; |
1970 | doc->bleeds.Top = dia->bleedTop; |
||
1971 | doc->bleeds.Left = dia->bleedLeft; |
||
1972 | doc->bleeds.Right = dia->bleedRight; |
||
6189 | jghali | 1973 | mainWindowStatusLabel->setText( tr("Ready")); |
1974 | HaveNewDoc(); |
||
1975 | retVal = true; |
||
1976 | } |
||
5800 | fschmid | 1977 | } |
1978 | delete dia; |
||
7025 | fschmid | 1979 | if (docSet) |
1980 | slotDocSetup(); |
||
6189 | jghali | 1981 | return retVal; |
5800 | fschmid | 1982 | } |
1983 | |||
1984 | //TODO move to core, assign doc to doc list, optionally create gui for it |
||
5808 | cbradney | 1985 | ScribusDoc *ScribusMainWindow::newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount, bool showView) |
5800 | fschmid | 1986 | { |
5808 | cbradney | 1987 | return doFileNew(width, height, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, columnCount, autoTextFrames, pageArrangement, unitIndex, firstPageLocation, orientation, firstPageNumber, defaultPageSize, requiresGUI, pageCount, showView); |
5800 | fschmid | 1988 | /* TODO CB finish later this week. |
1989 | if (HaveDoc) |
||
1990 | doc->OpenNodes = outlinePalette->buildReopenVals(); |
||
1991 | MarginStruct margins(topMargin, leftMargin, bottomMargin, rightMargin); |
||
1992 | DocPagesSetup pagesSetup(pageArrangement, firstPageLocation, firstPageNumber, orientation, autoTextFrames, columnDistance, columnCount); |
||
1993 |