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