Rev 17644 | Rev 17708 | Go to most recent revision | 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 | |||
16546 | jghali | 24 | #include <QAction> |
8591 | cbradney | 25 | #include <QApplication> |
10862 | cbradney | 26 | #include <QByteArray> |
27 | #include <QCloseEvent> |
||
28 | #include <QColor> |
||
10223 | cbradney | 29 | #include <QColorDialog> |
30 | #include <QCursor> |
||
8635 | cbradney | 31 | #include <QDesktopWidget> |
10862 | cbradney | 32 | #include <QDragEnterEvent> |
8501 | cbradney | 33 | #include <QDropEvent> |
34 | #include <QEvent> |
||
10862 | cbradney | 35 | #include <QEventLoop> |
15130 | cbradney | 36 | #include <QFileDialog> |
10862 | cbradney | 37 | #include <QFrame> |
16546 | jghali | 38 | #include <QFont> |
10862 | cbradney | 39 | #include <QIcon> |
40 | #include <QInputDialog> |
||
8501 | cbradney | 41 | #include <QKeyEvent> |
10862 | cbradney | 42 | #include <QKeySequence> |
43 | #include <QLabel> |
||
44 | #include <QList> |
||
45 | #include <QLocale> |
||
16546 | jghali | 46 | #include <QMdiArea> |
47 | #include <QMdiSubWindow> |
||
48 | #include <QMessageBox> |
||
10862 | cbradney | 49 | #include <QMouseEvent> |
50 | #include <QPixmap> |
||
16546 | jghali | 51 | #include <QProgressBar> |
10862 | cbradney | 52 | #include <QRegExp> |
53 | #include <QStyleFactory> |
||
9853 | fschmid | 54 | #include <QTableWidget> |
10862 | cbradney | 55 | #include <QTextCodec> |
16546 | jghali | 56 | #include <QToolButton> |
10862 | cbradney | 57 | #include <QTranslator> |
58 | #include <QWheelEvent> |
||
1208 | cbradney | 59 | |
14539 | jghali | 60 | #ifdef DEBUG_LOAD_TIMES |
61 | #include <QDebug> |
||
62 | #include <QTime> |
||
63 | #include <sys/times.h> |
||
64 | #endif |
||
65 | |||
3 | paul | 66 | #include <cstdio> |
67 | #include <cstdlib> |
||
9082 | avox | 68 | #include <cassert> |
2629 | craig | 69 | |
2688 | craig | 70 | #include "scconfig.h" |
2629 | craig | 71 | |
72 | #ifdef HAVE_DLFCN_H |
||
3 | paul | 73 | #include <dlfcn.h> |
2629 | craig | 74 | #endif |
75 | |||
76 | #ifdef HAVE_UNISTD_H |
||
135 | Franz | 77 | #include <unistd.h> |
2629 | craig | 78 | #endif |
79 | |||
3 | paul | 80 | #include <iostream> |
8289 | avox | 81 | #include <sstream> |
119 | Franz | 82 | #include <signal.h> |
80 | Franz | 83 | #include <string> |
1208 | cbradney | 84 | |
16546 | jghali | 85 | |
86 | #include "actionmanager.h" |
||
87 | #include "canvasmode.h" |
||
88 | #include "commonstrings.h" |
||
89 | #include "desaxe/digester.h" |
||
90 | #include "desaxe/saxXML.h" |
||
91 | #include "desaxe/simple_actions.h" |
||
92 | #include "docinfo.h" |
||
93 | #include "documentchecker.h" |
||
94 | #include "documentinformation.h" |
||
95 | #include "fileloader.h" |
||
96 | #include "filewatcher.h" |
||
97 | #include "fpoint.h" |
||
98 | #include "fpointarray.h" |
||
99 | #include "gtgettext.h" |
||
100 | #include "hyphenator.h" |
||
101 | #include "langmgr.h" |
||
16916 | fschmid | 102 | #include "pageitem_group.h" |
16546 | jghali | 103 | #include "pageitem_imageframe.h" |
104 | #include "pageitem_latexframe.h" |
||
16856 | craig | 105 | #include "pageitem_table.h" |
16546 | jghali | 106 | #include "pageitem_textframe.h" |
107 | #include "pagesize.h" |
||
108 | #include "pdflib.h" |
||
109 | #include "pdfoptions.h" |
||
110 | #include "pluginmanager.h" |
||
111 | #include "plugins/formatidlist.h" |
||
112 | #include "prefscontext.h" |
||
113 | #include "prefsfile.h" |
||
114 | #include "prefsmanager.h" |
||
115 | #include "prefstable.h" |
||
116 | #include "pslib.h" |
||
117 | #include "resourcecollection.h" |
||
118 | #include "sccolorengine.h" |
||
119 | #include "scgtplugin.h" |
||
120 | #include "scmimedata.h" |
||
16736 | jghali | 121 | #include "scpage.h" |
16546 | jghali | 122 | #include "scpaths.h" |
123 | #include "scprintengine_ps.h" |
||
124 | #include "scraction.h" |
||
125 | #include "scribus.h" |
||
126 | #include "scribusdoc.h" |
||
127 | #include "scribusXml.h" |
||
128 | #include "scribusapp.h" |
||
129 | #include "scribuscore.h" |
||
130 | #include "scribusview.h" |
||
131 | #include "scribuswin.h" |
||
132 | #include "selection.h" |
||
133 | #include "serializer.h" |
||
13552 | cbradney | 134 | #include "ui/about.h" |
13544 | cbradney | 135 | #include "ui/aboutplugins.h" |
136 | #include "ui/aligndistribute.h" |
||
13650 | cbradney | 137 | #include "ui/annot.h" |
138 | #include "ui/annota.h" |
||
13552 | cbradney | 139 | #include "ui/applytemplatedialog.h" |
13576 | cbradney | 140 | #include "ui/arrowchooser.h" |
13650 | cbradney | 141 | #include "ui/autoform.h" |
13576 | cbradney | 142 | #include "ui/basepointwidget.h" |
13551 | cbradney | 143 | #include "ui/bookmarkpalette.h" |
13544 | cbradney | 144 | #include "ui/charselect.h" |
13650 | cbradney | 145 | #include "ui/checkDocument.h" |
14798 | cbradney | 146 | #include "ui/collectforoutput_ui.h" |
13650 | cbradney | 147 | #include "ui/colorcombo.h" |
13576 | cbradney | 148 | #include "ui/contextmenu.h" |
13551 | cbradney | 149 | #include "ui/cpalette.h" |
13552 | cbradney | 150 | #include "ui/customfdialog.h" |
13650 | cbradney | 151 | #include "ui/delpages.h" |
13552 | cbradney | 152 | #include "ui/effectsdialog.h" |
13650 | cbradney | 153 | #include "ui/fontcombo.h" |
13544 | cbradney | 154 | #include "ui/guidemanager.h" |
13576 | cbradney | 155 | #include "ui/helpbrowser.h" |
156 | #include "ui/hruler.h" |
||
13552 | cbradney | 157 | #include "ui/imageinfodialog.h" |
17405 | fschmid | 158 | #include "ui/inlinepalette.h" |
13544 | cbradney | 159 | #include "ui/insertaframe.h" |
13650 | cbradney | 160 | #include "ui/inspage.h" |
161 | #include "ui/javadocs.h" |
||
13576 | cbradney | 162 | #include "ui/layers.h" |
13650 | cbradney | 163 | #include "ui/loremipsum.h" |
164 | #include "ui/marginwidget.h" |
||
13552 | cbradney | 165 | #include "ui/margindialog.h" |
13650 | cbradney | 166 | #include "ui/mergedoc.h" |
167 | #include "ui/movepage.h" |
||
13544 | cbradney | 168 | #include "ui/multipleduplicate.h" |
13650 | cbradney | 169 | #include "ui/newfile.h" |
170 | #include "ui/newtemp.h" |
||
13188 | fschmid | 171 | #include "nfttemplate.h" |
13544 | cbradney | 172 | #include "ui/nftdialog.h" |
13188 | fschmid | 173 | #include "ui_nftdialog.h" |
13544 | cbradney | 174 | #include "ui/nftwidget.h" |
13551 | cbradney | 175 | #include "ui/nodeeditpalette.h" |
13839 | fschmid | 176 | #ifdef HAVE_OSG |
177 | #include "ui/osgeditor.h" |
||
178 | #endif |
||
13551 | cbradney | 179 | #include "ui/outlinepalette.h" |
13544 | cbradney | 180 | #include "ui/pageitemattributes.h" |
13650 | cbradney | 181 | #include "ui/pagelayout.h" |
13551 | cbradney | 182 | #include "ui/pagepalette.h" |
13576 | cbradney | 183 | #include "ui/pageselector.h" |
15599 | fschmid | 184 | #include "ui/paintmanager.h" |
13650 | cbradney | 185 | #include "ui/pdfopts.h" |
13544 | cbradney | 186 | #include "ui/picstatus.h" |
187 | #include "ui/polygonwidget.h" |
||
13761 | cbradney | 188 | #include "ui/preferencesdialog.h" |
13650 | cbradney | 189 | #include "ui/preview.h" |
13544 | cbradney | 190 | #include "ui/printdialog.h" |
13551 | cbradney | 191 | #include "ui/propertiespalette.h" |
16546 | jghali | 192 | #include "ui/propertiespalette_image.h" |
193 | #include "ui/propertiespalette_line.h" |
||
194 | #include "ui/propertiespalette_shape.h" |
||
195 | #include "ui/propertiespalette_text.h" |
||
196 | #include "ui/propertiespalette_xyz.h" |
||
13650 | cbradney | 197 | #include "ui/query.h" |
13544 | cbradney | 198 | #include "ui/replacecolors.h" |
13650 | cbradney | 199 | #include "ui/sccombobox.h" |
13576 | cbradney | 200 | #include "ui/scmessagebox.h" |
13551 | cbradney | 201 | #include "ui/scrapbookpalette.h" |
14509 | cbradney | 202 | #include "ui/scmwmenumanager.h" |
16546 | jghali | 203 | #include "ui/selectobjects.h" |
13650 | cbradney | 204 | #include "ui/search.h" |
16856 | craig | 205 | #include "ui/smcellstyle.h" |
13544 | cbradney | 206 | #include "ui/smlinestyle.h" |
16856 | craig | 207 | #include "ui/smtablestyle.h" |
13544 | cbradney | 208 | #include "ui/smtextstyles.h" |
13551 | cbradney | 209 | #include "ui/splash.h" |
13576 | cbradney | 210 | #include "ui/storyeditor.h" |
13544 | cbradney | 211 | #include "ui/stylemanager.h" |
15060 | fschmid | 212 | #include "ui/symbolpalette.h" |
13544 | cbradney | 213 | #include "ui/tabmanager.h" |
10862 | cbradney | 214 | #include "text/nlsconfig.h" |
10212 | cbradney | 215 | #include "tocgenerator.h" |
15309 | cbradney | 216 | #include "ui/transformdialog.h" |
16034 | fschmid | 217 | #include "ui/transparencypalette.h" |
10862 | cbradney | 218 | #include "ui/copypagetomasterpagedialog.h" |
10976 | cbradney | 219 | #include "ui/edittoolbar.h" |
220 | #include "ui/filetoolbar.h" |
||
221 | #include "ui/modetoolbar.h" |
||
222 | #include "ui/pdftoolbar.h" |
||
10212 | cbradney | 223 | #include "undogui.h" |
224 | #include "undomanager.h" |
||
225 | #include "undostate.h" |
||
226 | #include "units.h" |
||
10311 | cbradney | 227 | #include "urllauncher.h" |
5184 | avox | 228 | #include "util.h" |
10212 | cbradney | 229 | #include "util_formats.h" |
230 | #include "util_ghostscript.h" |
||
10200 | cbradney | 231 | #include "util_icon.h" |
14170 | jghali | 232 | #include "util_math.h" |
13576 | cbradney | 233 | #include "ui/vruler.h" |
12110 | fschmid | 234 | #include "loadsaveplugin.h" |
235 | #include "plugins/formatidlist.h" |
||
14539 | jghali | 236 | #include "scimagecachemanager.h" |
134 | Franz | 237 | |
4361 | cbradney | 238 | #if defined(_WIN32) |
5178 | mrdocs | 239 | #include "scdocoutput_ps2.h" |
10967 | jghali | 240 | #include "scprintengine_gdi.h" |
4361 | cbradney | 241 | #endif |
242 | |||
15023 | jghali | 243 | #include "sclimits.h" |
244 | |||
3 | paul | 245 | using namespace std; |
246 | |||
3234 | fschmid | 247 | bool previewDinUse; |
248 | bool printDinUse; |
||
2891 | cbradney | 249 | |
3 | paul | 250 | QString DocDir; |
3205 | craig | 251 | |
10532 | avox | 252 | |
2536 | cbradney | 253 | extern ScribusQApp* ScQApp; |
2634 | cbradney | 254 | extern bool emergencyActivated; |
3 | paul | 255 | |
10532 | avox | 256 | |
4026 | craig | 257 | ScribusMainWindow::ScribusMainWindow() |
2161 | cbradney | 258 | { |
5781 | cbradney | 259 | actionManager=0; |
260 | scrMenuMgr=0; |
||
261 | prefsManager=0; |
||
10181 | cbradney | 262 | formatsManager=0; |
10311 | cbradney | 263 | UrlLauncher::instance(); |
5781 | cbradney | 264 | mainWindowStatusLabel=0; |
7354 | cbradney | 265 | ExternalApp=0; |
3580 | avox | 266 | #ifdef Q_WS_MAC |
267 | noIcon = loadIcon("noicon.xpm"); |
||
268 | #endif |
||
10625 | cbradney | 269 | } |
188 | Franz | 270 | |
11158 | avox | 271 | /* |
272 | static QCoreApplication::EventFilter origEventFilter = 0; |
||
10532 | avox | 273 | |
11158 | avox | 274 | bool reportFocusChanges(void *message, long *result) |
275 | { |
||
276 | unsigned* data = static_cast<unsigned*>(message); |
||
277 | if (QApplication::focusWidget()) |
||
278 | qDebug() << QApplication::applicationFilePath() << reinterpret_cast<void*>(QApplication::focusWidget()) << typeid(*QApplication::focusWidget()).name() << QApplication::focusWidget()->objectName() << message << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7]; |
||
279 | else |
||
280 | qDebug() << QApplication::applicationFilePath() << "no focus" << message << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7]; |
||
281 | return origEventFilter && origEventFilter(message, result); |
||
282 | } |
||
283 | */ |
||
284 | |||
767 | cbradney | 285 | /* |
286 | * retval 0 - ok, 1 - no fonts, ... |
||
287 | */ |
||
5243 | cbradney | 288 | int ScribusMainWindow::initScMW(bool primaryMainWindow) |
188 | Franz | 289 | { |
767 | cbradney | 290 | int retVal=0; |
17407 | fschmid | 291 | qsrand(1234); |
9909 | avox | 292 | QByteArray stylesheet; |
9910 | jghali | 293 | if (loadRawText(ScPaths::getApplicationDataDir() + "/stylesheet.css", stylesheet)) |
9909 | avox | 294 | { |
295 | qApp->setStyleSheet(QString(stylesheet)); |
||
296 | } |
||
10953 | subik | 297 | |
11158 | avox | 298 | // origEventFilter = qApp->setEventFilter(reportFocusChanges); |
11960 | subik | 299 | |
3234 | fschmid | 300 | previewDinUse = false; |
301 | printDinUse = false; |
||
9721 | fschmid | 302 | internalCopy = false; |
17016 | fschmid | 303 | internalCopyBuffer = ""; |
16016 | fschmid | 304 | m_doc = new ScribusDoc(); |
305 | m_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom"); |
||
306 | m_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false); |
||
307 | m_doc->addPage(0); |
||
308 | m_doc->setGUI(false, this, 0); |
||
355 | Franz | 309 | CurrStED = NULL; |
10495 | cbradney | 310 | setWindowTitle( tr("Scribus " VERSION)); |
10564 | fschmid | 311 | setAttribute(Qt::WA_KeyCompression, false); |
16546 | jghali | 312 | setAttribute(Qt::WA_InputMethodEnabled, true); |
10564 | fschmid | 313 | setWindowIcon(loadIcon("AppIcon.png")); |
16612 | fschmid | 314 | setObjectName("MainWindow"); |
1325 | cbradney | 315 | scrActionGroups.clear(); |
1208 | cbradney | 316 | scrActions.clear(); |
317 | scrRecentFileActions.clear(); |
||
5800 | fschmid | 318 | scrRecentPasteActions.clear(); |
1260 | cbradney | 319 | scrWindowsActions.clear(); |
2408 | cbradney | 320 | scrLayersActions.clear(); |
15516 | fschmid | 321 | scrScrapActions.clear(); |
14509 | cbradney | 322 | scrMenuMgr = new ScMWMenuManager(menuBar()); |
2835 | cbradney | 323 | prefsManager = PrefsManager::instance(); |
10181 | cbradney | 324 | formatsManager = FormatsManager::instance(); |
5243 | cbradney | 325 | objectSpecificUndo = false; |
7087 | subik | 326 | |
1247 | tsoots | 327 | undoManager = UndoManager::instance(); |
7880 | fschmid | 328 | PrefsContext *undoPrefs = prefsManager->prefsFile->getContext("undo"); |
329 | undoManager->setUndoEnabled(undoPrefs->getBool("enabled", true)); |
||
2441 | cbradney | 330 | tocGenerator = new TOCGenerator(); |
4510 | subik | 331 | |
7087 | subik | 332 | |
1780 | cbradney | 333 | initDefaultValues(); |
7087 | subik | 334 | |
272 | Franz | 335 | initStatusBar(); |
7087 | subik | 336 | |
490 | cbradney | 337 | qApp->processEvents(); |
675 | cbradney | 338 | |
10427 | cbradney | 339 | actionManager = new ActionManager(this); |
5257 | cbradney | 340 | actionManager->init(this); |
11174 | fschmid | 341 | // if (primaryMainWindow) |
342 | // ScCore->setSplashStatus( tr("Applying User Shortcuts") ); |
||
343 | // prefsManager->applyLoadedShortCuts(); |
||
344 | // initKeyboardShortcuts(); |
||
345 | initMenuBar(); |
||
346 | initToolBars(); |
||
347 | ScCore->pluginManager->setupPluginActions(this); |
||
14509 | cbradney | 348 | ScCore->pluginManager->enableOnlyStartupPluginActions(this); |
11174 | fschmid | 349 | ScCore->pluginManager->languageChange(); |
10977 | cbradney | 350 | if (primaryMainWindow) |
351 | ScCore->setSplashStatus( tr("Applying User Shortcuts") ); |
||
352 | prefsManager->applyLoadedShortCuts(); |
||
353 | initKeyboardShortcuts(); |
||
11960 | subik | 354 | |
5243 | cbradney | 355 | resize(610, 600); |
13959 | jghali | 356 | mdiArea = new QMdiArea(this); |
357 | mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
||
358 | mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
||
14224 | fschmid | 359 | if (prefsManager->appPrefs.uiPrefs.useTabs) |
360 | mdiArea->setViewMode(QMdiArea::TabbedView); |
||
361 | else |
||
362 | mdiArea->setViewMode(QMdiArea::SubWindowView); |
||
13959 | jghali | 363 | setCentralWidget( mdiArea ); |
364 | connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(newActWin(QMdiSubWindow *))); |
||
365 | //Connect windows cascade and tile actions to the workspace after its created. Only depends on mdiArea created. |
||
366 | connect( scrActions["windowsCascade"], SIGNAL(triggered()) , mdiArea, SLOT(cascadeSubWindows()) ); |
||
367 | connect( scrActions["windowsTile"], SIGNAL(triggered()) , mdiArea, SLOT(tileSubWindows()) ); |
||
5243 | cbradney | 368 | initPalettes(); |
7087 | subik | 369 | |
5243 | cbradney | 370 | prefsManager->setupMainWindow(this); |
770 | cbradney | 371 | |
5243 | cbradney | 372 | if (primaryMainWindow) |
373 | ScCore->setSplashStatus( tr("Initializing Story Editor") ); |
||
374 | storyEditor = new StoryEditor(this); |
||
770 | cbradney | 375 | |
5243 | cbradney | 376 | DocDir = prefsManager->documentDir(); |
1485 | tsoots | 377 | |
5243 | cbradney | 378 | if (primaryMainWindow) |
5800 | fschmid | 379 | ScCore->setSplashStatus( tr("Initializing Hyphenator") ); |
13955 | cbradney | 380 | QString preLang(prefsManager->appPrefs.hyphPrefs.Language); |
5800 | fschmid | 381 | initHyphenator(); |
17501 | craig | 382 | if (!LanguageManager::instance()->getHyphFilename( preLang, true ).isEmpty() ) |
13955 | cbradney | 383 | prefsManager->appPrefs.hyphPrefs.Language = preLang; |
5800 | fschmid | 384 | if (primaryMainWindow) |
385 | ScCore->setSplashStatus( tr("Reading Scrapbook") ); |
||
386 | initScrapbook(); |
||
387 | |||
13955 | cbradney | 388 | scrActions["helpTooltips"]->setChecked(prefsManager->appPrefs.displayPrefs.showToolTips); |
389 | scrActions["showMouseCoordinates"]->setChecked(prefsManager->appPrefs.displayPrefs.showMouseCoordinates); |
||
390 | scrActions["stickyTools"]->setChecked(prefsManager->appPrefs.uiPrefs.stickyTools); |
||
5800 | fschmid | 391 | ToggleTips(); |
12754 | fschmid | 392 | ToggleMouseTips(); |
5800 | fschmid | 393 | propertiesPalette->setFontSize(); |
6451 | fschmid | 394 | if (scrActions["SaveAsDocumentTemplate"]) |
395 | scrActions["SaveAsDocumentTemplate"]->setEnabled(false); |
||
7087 | subik | 396 | |
15946 | jghali | 397 | connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecentFromWatcher(QString))); |
16742 | fschmid | 398 | // connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&))); |
399 | // connect(this, SIGNAL(TextEffects(int)), propertiesPalette, SLOT(setStil(int))); |
||
5800 | fschmid | 400 | connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange())); |
7337 | fschmid | 401 | // connect(ClipB, SIGNAL(selectionChanged()), this, SLOT(ClipChange())); |
5800 | fschmid | 402 | setAcceptDrops(true); |
9562 | fschmid | 403 | QCoreApplication::instance()->installEventFilter(this); |
12846 | fschmid | 404 | scrActions["toolsSelect"]->setChecked(true); |
16016 | fschmid | 405 | ColorSetManager csm; |
406 | csm.findPaletteLocations(); |
||
407 | csm.findPalettes(); |
||
408 | csm.findUserPalettes(); |
||
16577 | craig | 409 | QString Cpfad = QDir::toNativeSeparators(ScPaths::getApplicationDataDir())+"DefaultColors.xml"; |
16016 | fschmid | 410 | QFile fc(Cpfad); |
411 | if (fc.exists()) |
||
412 | csm.loadPalette(Cpfad, m_doc, prefsManager->appPrefs.colorPrefs.DColors, prefsManager->appPrefs.defaultGradients, prefsManager->appPrefs.defaultPatterns, false); |
||
413 | else |
||
414 | { |
||
415 | if (prefsManager->appPrefs.colorPrefs.DColorSet != "Scribus Small") |
||
416 | { |
||
417 | QStringList CustomColorSets = csm.userPaletteNames(); |
||
418 | if (CustomColorSets.contains(prefsManager->appPrefs.colorPrefs.DColorSet)) |
||
419 | Cpfad = csm.userPaletteFileFromName(prefsManager->appPrefs.colorPrefs.DColorSet); |
||
420 | else |
||
421 | Cpfad = csm.paletteFileFromName(prefsManager->appPrefs.colorPrefs.DColorSet); |
||
422 | csm.loadPalette(Cpfad, m_doc, prefsManager->appPrefs.colorPrefs.DColors, prefsManager->appPrefs.defaultGradients, prefsManager->appPrefs.defaultPatterns, false); |
||
423 | } |
||
424 | } |
||
5800 | fschmid | 425 | return retVal; |
426 | } |
||
427 | |||
10532 | avox | 428 | |
5800 | fschmid | 429 | ScribusMainWindow::~ScribusMainWindow() |
430 | { |
||
16016 | fschmid | 431 | delete m_doc; |
5800 | fschmid | 432 | } |
433 | |||
11040 | fschmid | 434 | void ScribusMainWindow::addScToolBar(ScToolBar *tb, QString name) |
435 | { |
||
436 | if (!scrToolBars.contains(name)) |
||
437 | scrToolBars.insert(name, tb); |
||
438 | addToolBar(tb); |
||
439 | } |
||
5800 | fschmid | 440 | |
441 | void ScribusMainWindow::initToolBars() |
||
442 | { |
||
10976 | cbradney | 443 | fileToolBar = new FileToolBar(this); |
444 | editToolBar = new EditToolBar(this); |
||
5800 | fschmid | 445 | UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget"); |
446 | undoManager->registerGui(uWidget); |
||
10976 | cbradney | 447 | modeToolBar = new ModeToolBar(this); |
5800 | fschmid | 448 | pdfToolBar = new PDFToolBar(this); |
10953 | subik | 449 | |
15260 | cbradney | 450 | addScToolBar(fileToolBar, fileToolBar->objectName()); |
451 | addScToolBar(editToolBar, editToolBar->objectName()); |
||
452 | addScToolBar(modeToolBar, modeToolBar->objectName()); |
||
453 | addScToolBar(pdfToolBar, pdfToolBar->objectName()); |
||
10976 | cbradney | 454 | connect(modeToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarTools"], SLOT(setChecked(bool))); |
10734 | jghali | 455 | connect(scrActions["toolsToolbarPDF"], SIGNAL(toggled(bool)), pdfToolBar, SLOT(setVisible(bool))); |
10969 | subik | 456 | connect(pdfToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarPDF"], SLOT(setChecked(bool))); |
10976 | cbradney | 457 | connect(scrActions["toolsToolbarTools"], SIGNAL(toggled(bool)), modeToolBar, SLOT(setVisible(bool)) ); |
5800 | fschmid | 458 | } |
459 | |||
10532 | avox | 460 | |
5800 | fschmid | 461 | void ScribusMainWindow::initDefaultValues() |
462 | { |
||
463 | HaveDoc = false; |
||
14754 | jghali | 464 | ScriptRunning = 0; |
5800 | fschmid | 465 | view = NULL; |
466 | doc = NULL; |
||
467 | DocNr = 1; |
||
468 | PrinterUsed = false; |
||
469 | PDef.Pname = ""; |
||
470 | PDef.Dname = ""; |
||
471 | PDef.Command = ""; |
||
472 | keyrep = false; |
||
473 | _arrowKeyDown = false; |
||
474 | ClipB = QApplication::clipboard(); |
||
475 | palettesStatus[0] = false; |
||
476 | guidesStatus[0] = false; |
||
477 | } |
||
478 | |||
10532 | avox | 479 | |
5800 | fschmid | 480 | void ScribusMainWindow::initKeyboardShortcuts() |
481 | { |
||
8501 | cbradney | 482 | for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrActions.begin(); it!=scrActions.end(); ++it ) |
5800 | fschmid | 483 | { |
10516 | cbradney | 484 | if ((ScrAction*)(it.value())!=NULL) |
5800 | fschmid | 485 | { |
10564 | fschmid | 486 | QString accelerator=it.value()->shortcut(); |
10516 | cbradney | 487 | prefsManager->setKeyEntry(it.key(), it.value()->cleanMenuText(), accelerator,0); |
5800 | fschmid | 488 | } |
489 | //else |
||
13085 | jghali | 490 | // qDebug() << it.key(); |
491 | //qDebug() << QString("|-\n|%1||%2||%3").arg(it.key()).arg(it.value()->cleanMenuText()).arg(QString(it.data()->accel())); |
||
5800 | fschmid | 492 | } |
493 | } |
||
494 | |||
10532 | avox | 495 | |
5800 | fschmid | 496 | void ScribusMainWindow::initPalettes() |
497 | { |
||
498 | //CB TODO hide the publicly available members of some palettes |
||
499 | // these must be filtered too as they take control of the palettes events |
||
10862 | cbradney | 500 | outlinePalette = new OutlinePalette(this); |
5800 | fschmid | 501 | outlinePalette->setMainWindow(this); |
502 | connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 503 | connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setChecked(bool))); |
16546 | jghali | 504 | |
10862 | cbradney | 505 | propertiesPalette = new PropertiesPalette(this); |
5800 | fschmid | 506 | propertiesPalette->setMainWindow(this); |
507 | connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 508 | connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setChecked(bool))); |
5800 | fschmid | 509 | //CB dont need this until we have a doc... |
16546 | jghali | 510 | //propertiesPalette->Cpal->setColors(prefsManager->colorSet()); |
511 | emit UpdateRequest(reqDefFontListUpdate); |
||
5800 | fschmid | 512 | propertiesPalette->installEventFilter(this); |
513 | nodePalette = new NodePalette(this); |
||
514 | nodePalette->installEventFilter(this); |
||
515 | layerPalette = new LayerPalette(this); |
||
516 | guidePalette = new GuideManager(this); |
||
7087 | subik | 517 | charPalette = new CharSelect(this); |
5800 | fschmid | 518 | connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) ); |
10581 | cbradney | 519 | connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setChecked(bool))); |
5800 | fschmid | 520 | layerPalette->installEventFilter(this); |
521 | layerPalette->Table->installEventFilter(this); |
||
522 | scrapbookPalette = new Biblio(this); |
||
523 | connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 524 | connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setChecked(bool))); |
11554 | fschmid | 525 | connect( scrapbookPalette, SIGNAL(pasteToActualPage(QString)), this, SLOT(pasteFromScrapbook(QString))); |
5800 | fschmid | 526 | scrapbookPalette->installEventFilter(this); |
527 | pagePalette = new PagePalette(this); |
||
528 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 529 | connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setChecked(bool))); |
5800 | fschmid | 530 | pagePalette->installEventFilter(this); |
531 | bookmarkPalette = new BookPalette(this); |
||
532 | connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 533 | connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setChecked(bool))); |
5800 | fschmid | 534 | bookmarkPalette->installEventFilter(this); |
11190 | avox | 535 | // measurementPalette = new Measurements(this); |
536 | // connect( scrActions["toolsMeasurements"], SIGNAL(toggled(bool)) , measurementPalette, SLOT(setPaletteShown(bool)) ); |
||
5800 | fschmid | 537 | connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool, int)) , this, SLOT(setAppModeByToggle(bool, int)) ); |
11190 | avox | 538 | // connect( measurementPalette, SIGNAL(paletteShown(bool)), scrActions["toolsMeasurements"], SLOT(setChecked(bool))); |
539 | // measurementPalette->installEventFilter(this); |
||
540 | // measurementPalette->hide(); |
||
5800 | fschmid | 541 | docCheckerPalette = new CheckDocument(this, false); |
542 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) ); |
||
543 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , this, SLOT(docCheckToggle(bool)) ); |
||
10581 | cbradney | 544 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setChecked(bool))); |
5800 | fschmid | 545 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool))); |
546 | docCheckerPalette->installEventFilter(this); |
||
547 | docCheckerPalette->hide(); |
||
548 | |||
549 | alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette", false); |
||
550 | connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 551 | connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setChecked(bool))); |
5800 | fschmid | 552 | connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh())); |
553 | alignDistributePalette->installEventFilter(this); |
||
7087 | subik | 554 | |
15060 | fschmid | 555 | symbolPalette = new SymbolPalette(this); |
556 | symbolPalette->setMainWindow(this); |
||
16029 | fschmid | 557 | connect(scrActions["toolsSymbols"], SIGNAL(toggled(bool)), symbolPalette, SLOT(setPaletteShown(bool))); |
558 | connect(symbolPalette, SIGNAL(paletteShown(bool)), scrActions["toolsSymbols"], SLOT(setChecked(bool))); |
||
559 | connect(symbolPalette, SIGNAL(startEdit(QString)), this, SLOT(editSymbolStart(QString))); |
||
560 | connect(symbolPalette, SIGNAL(endEdit()), this, SLOT(editSymbolEnd())); |
||
15060 | fschmid | 561 | symbolPalette->installEventFilter(this); |
562 | symbolPalette->hide(); |
||
17405 | fschmid | 563 | |
564 | inlinePalette = new InlinePalette(this); |
||
565 | inlinePalette->setMainWindow(this); |
||
566 | connect(scrActions["toolsInline"], SIGNAL(toggled(bool)), inlinePalette, SLOT(setPaletteShown(bool))); |
||
567 | connect(inlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsInline"], SLOT(setChecked(bool))); |
||
17410 | fschmid | 568 | connect(inlinePalette, SIGNAL(startEdit(int)), this, SLOT(editInlineStart(int))); |
569 | connect(inlinePalette, SIGNAL(endEdit()), this, SLOT(editInlineEnd())); |
||
17405 | fschmid | 570 | inlinePalette->installEventFilter(this); |
571 | inlinePalette->hide(); |
||
15060 | fschmid | 572 | |
573 | |||
5800 | fschmid | 574 | undoPalette = new UndoPalette(this, "undoPalette"); |
575 | undoPalette->installEventFilter(this); |
||
576 | undoManager->registerGui(undoPalette); |
||
577 | connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); |
||
578 | connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); |
||
579 | |||
580 | // initializing style manager here too even it's not strictly a palette |
||
581 | styleManager = new StyleManager(this, "styleManager"); |
||
582 | styleManager->addStyle(new SMLineStyle()); |
||
7063 | tsoots | 583 | SMCharacterStyle *tmpCS = new SMCharacterStyle(); |
584 | styleManager->addStyle(new SMParagraphStyle(tmpCS->tmpStyles())); |
||
585 | styleManager->addStyle(tmpCS); |
||
16856 | craig | 586 | styleManager->addStyle(new SMTableStyle()); |
587 | styleManager->addStyle(new SMCellStyle()); |
||
10627 | cbradney | 588 | connect( scrActions["editStyles"], SIGNAL(toggled(bool)), styleManager, SLOT(setPaletteShown(bool)) ); |
10581 | cbradney | 589 | connect( styleManager, SIGNAL(paletteShown(bool)), scrActions["editStyles"], SLOT(setChecked(bool))); |
8005 | cbradney | 590 | styleManager->installEventFilter(this); |
5800 | fschmid | 591 | |
16122 | fschmid | 592 | // connect(docCheckerPalette, SIGNAL(selectElement(int, int)), this, SLOT(selectItemsFromOutlines(int, int))); |
593 | connect(docCheckerPalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); |
||
17013 | fschmid | 594 | connect(docCheckerPalette, SIGNAL(selectElement(PageItem *, bool, int)), this, SLOT(selectItemFromOutlines(PageItem *, bool, int))); |
5800 | fschmid | 595 | connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
596 | connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString))); |
||
16156 | fschmid | 597 | // connect(outlinePalette, SIGNAL(selectElement(int, int, bool)), this, SLOT(selectItemsFromOutlines(int, int, bool))); |
16122 | fschmid | 598 | connect(outlinePalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); |
16999 | fschmid | 599 | connect(outlinePalette, SIGNAL(editElementByItem(PageItem *)), this, SLOT(editItemsFromOutlines(PageItem *))); |
5800 | fschmid | 600 | connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
601 | connect(outlinePalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString))); |
||
602 | // connect(propertiesPalette, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles())); |
||
16546 | jghali | 603 | // connect(nodePalette, SIGNAL(paletteClosed()), propertiesPalette, SLOT(endEdit2())); |
604 | connect(nodePalette, SIGNAL(paletteClosed()), this, SLOT(slotSelect())); |
||
5800 | fschmid | 605 | connect(nodePalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
606 | connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
||
607 | |||
608 | connect(bookmarkPalette->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks())); |
||
609 | connect(bookmarkPalette->BView, SIGNAL(changed()), this, SLOT(slotDocCh())); |
||
16122 | fschmid | 610 | connect(bookmarkPalette->BView, SIGNAL(SelectElement(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); |
5800 | fschmid | 611 | // guides |
612 | connect(scrActions["pageManageGuides"], SIGNAL(toggled(bool)), guidePalette, SLOT(setPaletteShown(bool))); |
||
10581 | cbradney | 613 | connect(guidePalette, SIGNAL(paletteShown(bool)), scrActions["pageManageGuides"], SLOT(setChecked(bool))); |
7087 | subik | 614 | // char palette |
615 | connect(scrActions["insertGlyph"], SIGNAL(toggled(bool)), charPalette, SLOT(setPaletteShown(bool))); |
||
10581 | cbradney | 616 | connect(charPalette, SIGNAL(paletteShown(bool)), scrActions["insertGlyph"], SLOT(setChecked(bool))); |
5800 | fschmid | 617 | } |
618 | |||
10532 | avox | 619 | |
5800 | fschmid | 620 | void ScribusMainWindow::initScrapbook() |
621 | { |
||
16577 | craig | 622 | QString scrapbookFileO = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrap13.scs"); |
5800 | fschmid | 623 | QFileInfo scrapbookFileInfoO = QFileInfo(scrapbookFileO); |
624 | if (scrapbookFileInfoO.exists()) |
||
625 | { |
||
16577 | craig | 626 | scrapbookPalette->readOldContents(scrapbookFileO, QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/main")); |
5800 | fschmid | 627 | QDir d = QDir(); |
16577 | craig | 628 | d.rename(scrapbookFileO, QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrap13.backup")); |
5800 | fschmid | 629 | } |
16577 | craig | 630 | QString scrapbookTemp = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/tmp"); |
5800 | fschmid | 631 | QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp); |
632 | if (scrapbookTempInfo.exists()) |
||
633 | scrapbookPalette->readTempContents(scrapbookTemp); |
||
16577 | craig | 634 | QString scrapbookFile = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/main"); |
5800 | fschmid | 635 | QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile); |
636 | if (scrapbookFileInfo.exists()) |
||
637 | scrapbookPalette->readContents(scrapbookFile); |
||
638 | scrapbookPalette->setScrapbookFileName(scrapbookFile); |
||
15527 | fschmid | 639 | ScCore->fileWatcher->addDir(scrapbookFile, true); |
13955 | cbradney | 640 | scrapbookPalette->setOpenScrapbooks(prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks); |
5800 | fschmid | 641 | rebuildRecentPasteMenu(); |
5806 | fschmid | 642 | connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu())); |
15526 | fschmid | 643 | connect(ScCore->fileWatcher, SIGNAL(dirChanged(QString )), scrapbookPalette, SLOT(reloadLib(QString ))); |
15527 | fschmid | 644 | connect(ScCore->fileWatcher, SIGNAL(dirDeleted(QString )), scrapbookPalette, SLOT(closeOnDel(QString ))); |
5800 | fschmid | 645 | } |
646 | |||
10532 | avox | 647 | |
5800 | fschmid | 648 | bool ScribusMainWindow::warningVersion(QWidget *parent) |
649 | { |
||
650 | bool retval = false; |
||
651 | int t = ScMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" + |
||
6442 | cbradney | 652 | QObject::tr("You are running a development version of Scribus 1.3.x. The document you are working with was created in Scribus 1.2.x. Saving the current file under 1.3.x renders it unable to be edited in Scribus 1.2.x versions. To preserve the ability to edit in 1.2.x, save this file under a different name and further edit the newly named file and the original will be untouched. Are you sure you wish to proceed with this operation?") + "</qt>", |
9422 | fschmid | 653 | QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel); |
654 | if (t == QMessageBox::Ok) |
||
5800 | fschmid | 655 | retval = true; |
656 | return retval; |
||
657 | } |
||
658 | |||
10532 | avox | 659 | |
5800 | fschmid | 660 | void ScribusMainWindow::initMenuBar() |
661 | { |
||
662 | RecentDocs.clear(); |
||
12940 | cbradney | 663 | scrMenuMgr->createMenu("File", ActionManager::defaultMenuNameEntryTranslated("File")); |
14509 | cbradney | 664 | scrMenuMgr->addMenuItem(scrActions["fileNew"], "File", true); |
665 | scrMenuMgr->addMenuItem(scrActions["fileNewFromTemplate"], "File", true); |
||
666 | scrMenuMgr->addMenuItem(scrActions["fileOpen"], "File", true); |
||
667 | scrMenuMgr->createMenu("FileOpenRecent", tr("Open &Recent"), "File"); |
||
5800 | fschmid | 668 | scrMenuMgr->addMenuSeparator("File"); |
14509 | cbradney | 669 | scrMenuMgr->addMenuItem(scrActions["fileClose"], "File", false); |
670 | scrMenuMgr->addMenuItem(scrActions["fileSave"], "File", false); |
||
671 | scrMenuMgr->addMenuItem(scrActions["fileSaveAs"], "File", false); |
||
672 | scrMenuMgr->addMenuItem(scrActions["fileRevert"], "File", false); |
||
673 | scrMenuMgr->addMenuItem(scrActions["fileCollect"], "File", false); |
||
5800 | fschmid | 674 | scrMenuMgr->addMenuSeparator("File"); |
10558 | cbradney | 675 | scrMenuMgr->createMenu("FileImport", tr("&Import"), "File"); |
14509 | cbradney | 676 | scrMenuMgr->addMenuItem(scrActions["fileImportText"], "FileImport", false); |
677 | // scrMenuMgr->addMenuItem(scrActions["fileImportText2"], "FileImport", false); |
||
678 | scrMenuMgr->addMenuItem(scrActions["fileImportAppendText"], "FileImport", false); |
||
679 | scrMenuMgr->addMenuItem(scrActions["fileImportImage"], "FileImport", false); |
||
680 | scrMenuMgr->addMenuItem(scrActions["fileImportVector"], "FileImport", true); |
||
12110 | fschmid | 681 | |
10558 | cbradney | 682 | scrMenuMgr->createMenu("FileExport", tr("&Export"), "File"); |
14509 | cbradney | 683 | scrMenuMgr->addMenuItem(scrActions["fileExportText"], "FileExport", false); |
684 | scrMenuMgr->addMenuItem(scrActions["fileExportAsEPS"], "FileExport", false); |
||
685 | scrMenuMgr->addMenuItem(scrActions["fileExportAsPDF"], "FileExport", false); |
||
5800 | fschmid | 686 | scrMenuMgr->addMenuSeparator("File"); |
15811 | craig | 687 | // scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File", false); |
15059 | cbradney | 688 | scrMenuMgr->addMenuItem(scrActions["fileDocSetup150"], "File", false); |
15811 | craig | 689 | // scrMenuMgr->addMenuItem(scrActions["filePreferences"], "File", true); |
14509 | cbradney | 690 | scrMenuMgr->addMenuItem(scrActions["filePreferences150"], "File", true); |
5800 | fschmid | 691 | scrMenuMgr->addMenuSeparator("File"); |
14509 | cbradney | 692 | scrMenuMgr->addMenuItem(scrActions["filePrint"], "File", false); |
693 | scrMenuMgr->addMenuItem(scrActions["PrintPreview"], "File", false); |
||
5800 | fschmid | 694 | scrMenuMgr->addMenuSeparator("File"); |
14509 | cbradney | 695 | scrMenuMgr->addMenuItem(scrActions["fileQuit"], "File", true); |
5800 | fschmid | 696 | |
6451 | fschmid | 697 | scrMenuMgr->setMenuEnabled("FileImport", false); |
5800 | fschmid | 698 | scrMenuMgr->setMenuEnabled("FileExport", false); |
699 | |||
12940 | cbradney | 700 | scrMenuMgr->createMenu("Edit", ActionManager::defaultMenuNameEntryTranslated("Edit")); |
14509 | cbradney | 701 | scrMenuMgr->addMenuItem(scrActions["editUndoAction"], "Edit", false); |
702 | scrMenuMgr->addMenuItem(scrActions["editRedoAction"], "Edit", false); |
||
703 | scrMenuMgr->addMenuItem(scrActions["editActionMode"], "Edit", true); |
||
5800 | fschmid | 704 | scrMenuMgr->addMenuSeparator("Edit"); |
14509 | cbradney | 705 | scrMenuMgr->addMenuItem(scrActions["editCut"], "Edit", false); |
706 | scrMenuMgr->addMenuItem(scrActions["editCopy"], "Edit", false); |
||
707 | scrMenuMgr->addMenuItem(scrActions["editPaste"], "Edit", false); |
||
708 | scrMenuMgr->createMenu("EditPasteRecent", tr("Paste Recent"), "Edit"); |
||
10558 | cbradney | 709 | scrMenuMgr->createMenu("EditContents", tr("Contents"), "Edit"); |
14509 | cbradney | 710 | scrMenuMgr->addMenuItem(scrActions["editCopyContents"], "EditContents", false); |
711 | scrMenuMgr->addMenuItem(scrActions["editPasteContents"], "EditContents", false); |
||
712 | scrMenuMgr->addMenuItem(scrActions["editPasteContentsAbs"], "EditContents", false); |
||
713 | scrMenuMgr->addMenuItem(scrActions["editClearContents"], "EditContents", false); |
||
5800 | fschmid | 714 | scrMenuMgr->addMenuSeparator("Edit"); |
14509 | cbradney | 715 | scrMenuMgr->addMenuItem(scrActions["editSelectAll"], "Edit", false); |
716 | scrMenuMgr->addMenuItem(scrActions["editSelectAllOnLayer"], "Edit", false); |
||
717 | scrMenuMgr->addMenuItem(scrActions["editDeselectAll"], "Edit", false); |
||
5800 | fschmid | 718 | scrMenuMgr->addMenuSeparator("Edit"); |
14509 | cbradney | 719 | scrMenuMgr->addMenuItem(scrActions["editSearchReplace"], "Edit" , false); |
720 | scrMenuMgr->addMenuItem(scrActions["toolsEditWithStoryEditor"], "Edit", false); |
||
721 | scrMenuMgr->addMenuItem(scrActions["editEditWithImageEditor"], "Edit", false); |
||
722 | scrMenuMgr->addMenuItem(scrActions["editEditRenderSource"], "Edit", false); |
||
5800 | fschmid | 723 | scrMenuMgr->addMenuSeparator("Edit"); |
14509 | cbradney | 724 | scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit", true); |
725 | scrMenuMgr->addMenuItem(scrActions["editReplaceColors"], "Edit", false); |
||
15611 | fschmid | 726 | // scrMenuMgr->addMenuItem(scrActions["editGradients"], "Edit", false); |
16016 | fschmid | 727 | // scrMenuMgr->addMenuItem(scrActions["editPatterns"], "Edit", false); |
14509 | cbradney | 728 | scrMenuMgr->addMenuItem(scrActions["editStyles"], "Edit", false); |
729 | scrMenuMgr->addMenuItem(scrActions["editMasterPages"], "Edit", false); |
||
730 | scrMenuMgr->addMenuItem(scrActions["editJavascripts"], "Edit", false); |
||
5827 | fschmid | 731 | scrMenuMgr->setMenuEnabled("EditPasteRecent", false); |
7565 | cbradney | 732 | scrMenuMgr->setMenuEnabled("EditContents", false); |
5800 | fschmid | 733 | |
14509 | cbradney | 734 | |
15108 | cbradney | 735 | |
15309 | cbradney | 736 | // scrActions["itemDuplicate"]->setEnabled(false); |
737 | // scrActions["itemMulDuplicate"]->setEnabled(false); |
||
738 | // scrActions["itemDelete"]->setEnabled(false); |
||
739 | // scrActions["itemRaise"]->setEnabled(false); |
||
740 | // scrActions["itemLower"]->setEnabled(false); |
||
741 | // scrActions["itemRaiseToTop"]->setEnabled(false); |
||
742 | // scrActions["itemLowerToBottom"]->setEnabled(false); |
||
743 | // scrActions["itemSendToScrapbook"]->setEnabled(false); |
||
744 | // scrActions["itemSendToPattern"]->setEnabled(false); |
||
745 | // scrActions["itemAdjustFrameToImage"]->setEnabled(false); |
||
746 | // scrActions["itemAdjustImageToFrame"]->setEnabled(false); |
||
747 | // scrActions["itemExtendedImageProperties"]->setEnabled(false); |
||
748 | // scrActions["itemUpdateImage"]->setEnabled(false); |
||
749 | // scrActions["itemPreviewLow"]->setEnabled(false); |
||
750 | // scrActions["itemPreviewNormal"]->setEnabled(false); |
||
751 | // scrActions["itemPreviewFull"]->setEnabled(false); |
||
752 | // scrActions["itemAttributes"]->setEnabled(false); |
||
753 | // scrActions["itemPreviewLow"]->setEnabled(false); |
||
14509 | cbradney | 754 | |
755 | |||
5800 | fschmid | 756 | //Item Menu |
12940 | cbradney | 757 | scrMenuMgr->createMenu("Item", ActionManager::defaultMenuNameEntryTranslated("Item")); |
14509 | cbradney | 758 | scrMenuMgr->addMenuItem(scrActions["itemDuplicate"], "Item", false); |
759 | scrMenuMgr->addMenuItem(scrActions["itemMulDuplicate"], "Item", false); |
||
15309 | cbradney | 760 | scrMenuMgr->addMenuItem(scrActions["itemTransform"], "Item", false); |
14509 | cbradney | 761 | scrMenuMgr->addMenuItem(scrActions["itemDelete"], "Item", false); |
5800 | fschmid | 762 | scrMenuMgr->addMenuSeparator("Item"); |
14509 | cbradney | 763 | scrMenuMgr->addMenuItem(scrActions["itemGroup"], "Item", false); |
764 | scrMenuMgr->addMenuItem(scrActions["itemUngroup"], "Item", false); |
||
765 | scrMenuMgr->addMenuItem(scrActions["itemLock"], "Item", false); |
||
766 | scrMenuMgr->addMenuItem(scrActions["itemLockSize"], "Item", false); |
||
5800 | fschmid | 767 | scrMenuMgr->addMenuSeparator("Item"); |
768 | scrMenuMgr->createMenu("ItemLevel", tr("Level")); |
||
769 | scrMenuMgr->addMenuToMenu("ItemLevel", "Item"); |
||
14509 | cbradney | 770 | scrMenuMgr->addMenuItem(scrActions["itemRaise"], "ItemLevel", false); |
771 | scrMenuMgr->addMenuItem(scrActions["itemLower"], "ItemLevel", false); |
||
772 | scrMenuMgr->addMenuItem(scrActions["itemRaiseToTop"], "ItemLevel", false); |
||
773 | scrMenuMgr->addMenuItem(scrActions["itemLowerToBottom"], "ItemLevel", false); |
||
5800 | fschmid | 774 | scrMenuMgr->createMenu("ItemLayer", tr("Send to La&yer")); |
775 | scrMenuMgr->addMenuToMenu("ItemLayer", "Item"); |
||
15516 | fschmid | 776 | scrMenuMgr->createMenu("itemSendToScrapbook", tr("Send to Scrapbook")); |
777 | scrMenuMgr->addMenuToMenu("itemSendToScrapbook", "Item"); |
||
778 | // scrMenuMgr->addMenuItem(scrActions["itemSendToScrapbook"], "Item", false); |
||
14509 | cbradney | 779 | scrMenuMgr->addMenuItem(scrActions["itemSendToPattern"], "Item", false); |
16856 | craig | 780 | // Table submenu. |
5800 | fschmid | 781 | scrMenuMgr->addMenuSeparator("Item"); |
16856 | craig | 782 | scrMenuMgr->createMenu("ItemTable", tr("Table")); |
783 | scrMenuMgr->addMenuToMenu("ItemTable", "Item"); |
||
784 | scrMenuMgr->addMenuItem(scrActions["tableInsertRows"], "ItemTable", false); |
||
785 | scrMenuMgr->addMenuItem(scrActions["tableInsertColumns"], "ItemTable", false); |
||
786 | scrMenuMgr->addMenuItem(scrActions["tableDeleteRows"], "ItemTable", false); |
||
787 | scrMenuMgr->addMenuItem(scrActions["tableDeleteColumns"], "ItemTable", false); |
||
788 | scrMenuMgr->addMenuSeparator("ItemTable"); |
||
789 | scrMenuMgr->addMenuItem(scrActions["tableMergeCells"], "ItemTable", false); |
||
790 | scrMenuMgr->addMenuItem(scrActions["tableSplitCells"], "ItemTable", false); |
||
791 | scrMenuMgr->addMenuSeparator("ItemTable"); |
||
792 | scrMenuMgr->addMenuItem(scrActions["tableSetRowHeights"], "ItemTable", false); |
||
793 | scrMenuMgr->addMenuItem(scrActions["tableSetColumnWidths"], "ItemTable", false); |
||
794 | scrMenuMgr->addMenuItem(scrActions["tableDistributeRowsEvenly"], "ItemTable", false); |
||
795 | scrMenuMgr->addMenuItem(scrActions["tableDistributeColumnsEvenly"], "ItemTable", false); |
||
796 | scrMenuMgr->addMenuSeparator("ItemTable"); |
||
797 | scrMenuMgr->addMenuItem(scrActions["tableAdjustFrameToTable"], "ItemTable", false); |
||
798 | scrMenuMgr->addMenuItem(scrActions["tableAdjustTableToFrame"], "ItemTable", false); |
||
799 | scrMenuMgr->addMenuSeparator("Item"); |
||
800 | // End Table submenu. |
||
801 | scrMenuMgr->addMenuSeparator("Item"); |
||
17595 | craig | 802 | scrMenuMgr->addMenuItem(scrActions["itemAdjustFrameHeightToText"], "Item", false); |
14509 | cbradney | 803 | scrMenuMgr->addMenuItem(scrActions["itemAdjustFrameToImage"], "Item", false); |
804 | scrMenuMgr->addMenuItem(scrActions["itemAdjustImageToFrame"], "Item", false); |
||
14778 | cbradney | 805 | scrMenuMgr->addMenuItem(scrActions["itemUpdateImage"], "Item", false); |
806 | scrMenuMgr->addMenuItem(scrActions["styleImageEffects"], "Item", false); |
||
14509 | cbradney | 807 | scrMenuMgr->addMenuItem(scrActions["itemExtendedImageProperties"], "Item", false); |
14796 | fschmid | 808 | scrMenuMgr->addMenuItem(scrActions["itemToggleInlineImage"], "Item", false); |
8020 | cbradney | 809 | scrMenuMgr->createMenu("ItemPreviewSettings", tr("Preview Settings"), "Item"); |
14509 | cbradney | 810 | scrMenuMgr->addMenuItem(scrActions["itemImageIsVisible"], "ItemPreviewSettings", false); |
8020 | cbradney | 811 | scrMenuMgr->addMenuSeparator("ItemPreviewSettings"); |
14509 | cbradney | 812 | scrMenuMgr->addMenuItem(scrActions["itemPreviewLow"], "ItemPreviewSettings", false); |
813 | scrMenuMgr->addMenuItem(scrActions["itemPreviewNormal"], "ItemPreviewSettings", false); |
||
814 | scrMenuMgr->addMenuItem(scrActions["itemPreviewFull"], "ItemPreviewSettings", false); |
||
8020 | cbradney | 815 | scrMenuMgr->addMenuSeparator("Item"); |
14509 | cbradney | 816 | scrMenuMgr->addMenuItem(scrActions["itemAttributes"], "Item", false); |
5800 | fschmid | 817 | scrMenuMgr->createMenu("ItemPDFOptions", tr("&PDF Options")); |
818 | scrMenuMgr->addMenuToMenu("ItemPDFOptions", "Item"); |
||
14509 | cbradney | 819 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsAnnotation"], "ItemPDFOptions", false); |
820 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsBookmark"], "ItemPDFOptions", false); |
||
821 | scrMenuMgr->addMenuItem(scrActions["itemPDFAnnotationProps"], "ItemPDFOptions", false); |
||
822 | scrMenuMgr->addMenuItem(scrActions["itemPDFFieldProps"], "ItemPDFOptions", false); |
||
10558 | cbradney | 823 | scrMenuMgr->createMenu("ItemConvertTo", tr("C&onvert To"), "Item"); |
14509 | cbradney | 824 | scrMenuMgr->addMenuItem(scrActions["itemConvertToBezierCurve"], "ItemConvertTo", false); |
825 | scrMenuMgr->addMenuItem(scrActions["itemConvertToImageFrame"], "ItemConvertTo", false); |
||
826 | scrMenuMgr->addMenuItem(scrActions["itemConvertToOutlines"], "ItemConvertTo", false); |
||
827 | scrMenuMgr->addMenuItem(scrActions["itemConvertToPolygon"], "ItemConvertTo", false); |
||
828 | scrMenuMgr->addMenuItem(scrActions["itemConvertToTextFrame"], "ItemConvertTo", false); |
||
15108 | cbradney | 829 | scrMenuMgr->addMenuSeparator("Item"); |
830 | scrMenuMgr->addMenuItem(scrActions["toolsLinkTextFrame"], "Item", false); |
||
831 | scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrame"], "Item", false); |
||
17565 | craig | 832 | scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrameWithTextCopy"], "Item", false); |
833 | scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrameWithTextCut"], "Item", false); |
||
15108 | cbradney | 834 | scrMenuMgr->addMenuSeparator("Item"); |
14509 | cbradney | 835 | scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item", false); |
836 | scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item", false); |
||
11050 | fschmid | 837 | // scrMenuMgr->createMenu("ItemPathOps", tr("Path Tools"), "Item"); |
14509 | cbradney | 838 | scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item", false); |
839 | scrMenuMgr->addMenuItem(scrActions["itemSplitPolygons"], "Item", false); |
||
15108 | cbradney | 840 | |
5800 | fschmid | 841 | scrActions["itemPrintingEnabled"]->setEnabled(false); |
842 | scrMenuMgr->setMenuEnabled("ItemConvertTo", false); |
||
843 | |||
16926 | fschmid | 844 | scrMenuMgr->addMenuItem(scrActions["itemsUnWeld"], "Item", false); |
845 | scrMenuMgr->addMenuItem(scrActions["itemWeld"], "Item", false); |
||
16944 | fschmid | 846 | scrMenuMgr->addMenuItem(scrActions["itemEditWeld"], "Item", false); |
15108 | cbradney | 847 | |
5800 | fschmid | 848 | //Insert menu |
12940 | cbradney | 849 | scrMenuMgr->createMenu("Insert", ActionManager::defaultMenuNameEntryTranslated("Insert")); |
14509 | cbradney | 850 | scrMenuMgr->addMenuItem(scrActions["insertFrame"], "Insert", false); |
6090 | cbradney | 851 | scrMenuMgr->addMenuSeparator("Insert"); |
14509 | cbradney | 852 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTextFrame"], "Insert", false); |
853 | scrMenuMgr->addMenuItem(scrActions["toolsInsertImageFrame"], "Insert", false); |
||
854 | scrMenuMgr->addMenuItem(scrActions["toolsInsertRenderFrame"], "Insert", false); |
||
16856 | craig | 855 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTable"], "Insert", false); |
14509 | cbradney | 856 | scrMenuMgr->addMenuItem(scrActions["toolsInsertShape"], "Insert", false); |
857 | scrMenuMgr->addMenuItem(scrActions["toolsInsertPolygon"], "Insert", false); |
||
16215 | fschmid | 858 | scrMenuMgr->addMenuItem(scrActions["toolsInsertArc"], "Insert", false); |
16311 | fschmid | 859 | scrMenuMgr->addMenuItem(scrActions["toolsInsertSpiral"], "Insert", false); |
14509 | cbradney | 860 | scrMenuMgr->addMenuItem(scrActions["toolsInsertLine"], "Insert", false); |
861 | scrMenuMgr->addMenuItem(scrActions["toolsInsertBezier"], "Insert", false); |
||
862 | scrMenuMgr->addMenuItem(scrActions["toolsInsertFreehandLine"], "Insert", false); |
||
15847 | fschmid | 863 | scrMenuMgr->addMenuItem(scrActions["toolsInsertCalligraphicLine"], "Insert", false); |
7400 | cbradney | 864 | scrMenuMgr->addMenuSeparator("Insert"); |
14509 | cbradney | 865 | scrMenuMgr->addMenuItem(scrActions["stickyTools"], "Insert", true); |
5800 | fschmid | 866 | scrMenuMgr->addMenuSeparator("Insert"); |
14509 | cbradney | 867 | scrMenuMgr->addMenuItem(scrActions["insertGlyph"], "Insert", false); |
5800 | fschmid | 868 | |
10558 | cbradney | 869 | scrMenuMgr->createMenu("InsertChar", tr("&Character"), "Insert"); |
14509 | cbradney | 870 | scrMenuMgr->addMenuItem(scrActions["unicodePageNumber"], "InsertChar", false); |
871 | scrMenuMgr->addMenuItem(scrActions["unicodePageCount"], "InsertChar", false); |
||
15009 | jghali | 872 | scrMenuMgr->addMenuItem(scrActions["unicodeSoftHyphen"], "InsertChar", false); |
14509 | cbradney | 873 | scrMenuMgr->addMenuItem(scrActions["unicodeNonBreakingHyphen"], "InsertChar", false); |
5800 | fschmid | 874 | scrMenuMgr->addMenuSeparator("InsertChar"); |
14509 | cbradney | 875 | scrMenuMgr->addMenuItem(scrActions["unicodeCopyRight"], "InsertChar", false); |
876 | scrMenuMgr->addMenuItem(scrActions["unicodeRegdTM"], "InsertChar", false); |
||
877 | scrMenuMgr->addMenuItem(scrActions["unicodeTM"], "InsertChar", false); |
||
878 | scrMenuMgr->addMenuItem(scrActions["unicodeSolidus"], "InsertChar", false); |
||
879 | scrMenuMgr->addMenuItem(scrActions["unicodeBullet"], "InsertChar", false); |
||
880 | scrMenuMgr->addMenuItem(scrActions["unicodeMidpoint"], "InsertChar", false); |
||
5800 | fschmid | 881 | scrMenuMgr->addMenuSeparator("InsertChar"); |
14509 | cbradney | 882 | scrMenuMgr->addMenuItem(scrActions["unicodeDashEm"], "InsertChar", false); |
883 | scrMenuMgr->addMenuItem(scrActions["unicodeDashEn"], "InsertChar", false); |
||
884 | scrMenuMgr->addMenuItem(scrActions["unicodeDashFigure"], "InsertChar", false); |
||
885 | scrMenuMgr->addMenuItem(scrActions["unicodeDashQuotation"], "InsertChar", false); |
||
5800 | fschmid | 886 | |
10558 | cbradney | 887 | scrMenuMgr->createMenu("InsertQuote", tr("&Quote"), "Insert"); |
14509 | cbradney | 888 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteApostrophe"], "InsertQuote", false); |
889 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteStraight"], "InsertQuote", false); |
||
5800 | fschmid | 890 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
14509 | cbradney | 891 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleLeft"], "InsertQuote", false); |
892 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleRight"], "InsertQuote", false); |
||
893 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleLeft"], "InsertQuote", false); |
||
894 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleRight"], "InsertQuote", false); |
||
5800 | fschmid | 895 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
14509 | cbradney | 896 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleReversed"], "InsertQuote", false); |
897 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleReversed"], "InsertQuote", false); |
||
8755 | cbradney | 898 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
14509 | cbradney | 899 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteLowSingleComma"], "InsertQuote", false); |
900 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteLowDoubleComma"], "InsertQuote", false); |
||
5800 | fschmid | 901 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
14509 | cbradney | 902 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleLeftGuillemet"], "InsertQuote", false); |
903 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleRightGuillemet"], "InsertQuote", false); |
||
904 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleLeftGuillemet"], "InsertQuote", false); |
||
905 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleRightGuillemet"], "InsertQuote", false); |
||
5800 | fschmid | 906 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
14509 | cbradney | 907 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKSingleLeft"], "InsertQuote", false); |
908 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKSingleRight"], "InsertQuote", false); |
||
909 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKDoubleLeft"], "InsertQuote", false); |
||
910 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKDoubleRight"], "InsertQuote", false); |
||
5800 | fschmid | 911 | |
10558 | cbradney | 912 | scrMenuMgr->createMenu("InsertSpace", tr("S&paces && Breaks"), "Insert"); |
14509 | cbradney | 913 | scrMenuMgr->addMenuItem(scrActions["unicodeNonBreakingSpace"], "InsertSpace", false); |
914 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceEN"], "InsertSpace", false); |
||
915 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceEM"], "InsertSpace", false); |
||
916 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceThin"], "InsertSpace", false); |
||
917 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceThick"], "InsertSpace", false); |
||
918 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceMid"], "InsertSpace", false); |
||
919 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceHair"], "InsertSpace", false); |
||
5800 | fschmid | 920 | scrMenuMgr->addMenuSeparator("InsertSpace"); |
14509 | cbradney | 921 | scrMenuMgr->addMenuItem(scrActions["unicodeNewLine"], "InsertSpace", false); |
922 | scrMenuMgr->addMenuItem(scrActions["unicodeFrameBreak"], "InsertSpace", false); |
||
923 | scrMenuMgr->addMenuItem(scrActions["unicodeColumnBreak"], "InsertSpace", false); |
||
924 | scrMenuMgr->addMenuItem(scrActions["unicodeZerowidthSpace"], "InsertSpace", false); |
||
5800 | fschmid | 925 | |
10558 | cbradney | 926 | scrMenuMgr->createMenu("InsertLigature", tr("Liga&ture"), "Insert"); |
14509 | cbradney | 927 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ff"], "InsertLigature", false); |
928 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_fi"], "InsertLigature", false); |
||
929 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_fl"], "InsertLigature", false); |
||
930 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ffi"], "InsertLigature", false); |
||
931 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ffl"], "InsertLigature", false); |
||
932 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ft"], "InsertLigature", false); |
||
933 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_st"], "InsertLigature", false); |
||
5800 | fschmid | 934 | |
935 | scrMenuMgr->addMenuSeparator("Insert"); |
||
14509 | cbradney | 936 | scrMenuMgr->addMenuItem(scrActions["insertSampleText"], "Insert", false); |
5800 | fschmid | 937 | |
938 | //Page menu |
||
12940 | cbradney | 939 | scrMenuMgr->createMenu("Page", ActionManager::defaultMenuNameEntryTranslated("Page")); |
14509 | cbradney | 940 | scrMenuMgr->addMenuItem(scrActions["pageInsert"], "Page", false); |
941 | scrMenuMgr->addMenuItem(scrActions["pageImport"], "Page", false); |
||
942 | scrMenuMgr->addMenuItem(scrActions["pageDelete"], "Page", false); |
||
943 | scrMenuMgr->addMenuItem(scrActions["pageCopy"], "Page", false); |
||
944 | scrMenuMgr->addMenuItem(scrActions["pageMove"], "Page", false); |
||
5800 | fschmid | 945 | scrMenuMgr->addMenuSeparator("Page"); |
14509 | cbradney | 946 | scrMenuMgr->addMenuItem(scrActions["pageApplyMasterPage"], "Page", false); |
947 | scrMenuMgr->addMenuItem(scrActions["pageCopyToMasterPage"], "Page", false); |
||
948 | scrMenuMgr->addMenuItem(scrActions["pageManageGuides"], "Page", false); |
||
949 | scrMenuMgr->addMenuItem(scrActions["pageManageMargins"], "Page", false); |
||
950 | scrMenuMgr->addMenuSeparator("Page"); |
||
951 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "Page", true); |
||
952 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "Page", true); |
||
5800 | fschmid | 953 | |
954 | //View menu |
||
12940 | cbradney | 955 | scrMenuMgr->createMenu("View", ActionManager::defaultMenuNameEntryTranslated("View")); |
14509 | cbradney | 956 | scrMenuMgr->addMenuItem(scrActions["viewFitInWindow"], "View", false); |
957 | scrMenuMgr->addMenuItem(scrActions["viewFitWidth"], "View", false); |
||
958 | scrMenuMgr->addMenuItem(scrActions["viewFit50"], "View", false); |
||
959 | scrMenuMgr->addMenuItem(scrActions["viewFit75"], "View", false); |
||
960 | scrMenuMgr->addMenuItem(scrActions["viewFit100"], "View", false); |
||
961 | scrMenuMgr->addMenuItem(scrActions["viewFit200"], "View", false); |
||
962 | scrMenuMgr->addMenuItem(scrActions["viewFit400"], "View", false); |
||
5800 | fschmid | 963 | scrMenuMgr->addMenuSeparator("View"); |
17665 | craig | 964 | scrMenuMgr->addMenuItem(scrActions["viewPreviewMode"], "View", true); |
7587 | cbradney | 965 | scrMenuMgr->addMenuSeparator("View"); |
14509 | cbradney | 966 | scrMenuMgr->addMenuItem(scrActions["viewShowMargins"], "View", true); |
967 | scrMenuMgr->addMenuItem(scrActions["viewShowBleeds"], "View", true); |
||
968 | scrMenuMgr->addMenuItem(scrActions["viewShowFrames"], "View", true); |
||
969 | scrMenuMgr->addMenuItem(scrActions["viewShowLayerMarkers"], "View", true); |
||
970 | scrMenuMgr->addMenuItem(scrActions["viewShowImages"], "View", true); |
||
971 | scrMenuMgr->addMenuItem(scrActions["viewShowGrid"], "View", true); |
||
972 | scrMenuMgr->addMenuItem(scrActions["viewShowGuides"], "View", true); |
||
973 | scrMenuMgr->addMenuItem(scrActions["viewShowColumnBorders"], "View", true); |
||
974 | scrMenuMgr->addMenuItem(scrActions["viewShowBaseline"], "View", true); |
||
975 | scrMenuMgr->addMenuItem(scrActions["viewShowTextChain"], "View", true); |
||
976 | scrMenuMgr->addMenuItem(scrActions["viewShowTextControls"], "View", true); |
||
977 | scrMenuMgr->addMenuItem(scrActions["viewShowRulers"], "View", false); |
||
978 | scrMenuMgr->addMenuItem(scrActions["viewRulerMode"], "View", true); |
||
979 | scrMenuMgr->addMenuItem(scrActions["showMouseCoordinates"], "View", true); |
||
5800 | fschmid | 980 | |
981 | //CB If this is viewNewView imeplemented, it should be on the windows menu |
||
982 | // scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View"); |
||
983 | |||
984 | //Tool menu |
||
985 | /* |
||
986 | scrMenuMgr->createMenu("Tools", tr("&Tools")); |
||
987 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Tools"); |
||
988 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Tools"); |
||
989 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Tools"); |
||
990 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Tools"); |
||
991 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Tools"); |
||
992 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Tools"); |
||
993 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Tools"); |
||
994 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Tools"); |
||
995 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Tools"); |
||
996 | scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Tools"); |
||
997 | scrMenuMgr->addMenuSeparator("Tools"); |
||
998 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Tools"); |
||
999 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Tools"); |
||
1000 | //scrActions["toolsPreflightVerifier"]->setEnabled(false);*/ |
||
1001 | |||
1002 | //Extra menu |
||
12940 | cbradney | 1003 | scrMenuMgr->createMenu("Extras", ActionManager::defaultMenuNameEntryTranslated("Extras")); |
14509 | cbradney | 1004 | scrMenuMgr->addMenuItem(scrActions["extrasManageImages"], "Extras", false); |
1005 | scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras", false); |
||
1006 | scrMenuMgr->addMenuItem(scrActions["extrasDeHyphenateText"], "Extras", false); |
||
1007 | scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras", false); |
||
5800 | fschmid | 1008 | scrMenuMgr->setMenuEnabled("Extras", false); |
11129 | subik | 1009 | connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow())); |
5800 | fschmid | 1010 | |
1011 | //Window menu |
||
15117 | cbradney | 1012 | scrMenuMgr->createMenu("Windows", ActionManager::defaultMenuNameEntryTranslated("Windows"), QString::null, true); |
5800 | fschmid | 1013 | connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
1014 | addDefaultWindowMenuItems(); |
||
1015 | |||
1016 | //Help menu |
||
12940 | cbradney | 1017 | scrMenuMgr->createMenu("Help", ActionManager::defaultMenuNameEntryTranslated("Help")); |
14509 | cbradney | 1018 | scrMenuMgr->addMenuItem(scrActions["helpManual"], "Help", true); |
1019 | scrMenuMgr->addMenuItem(scrActions["helpManual2"], "Help", true); |
||
7425 | cbradney | 1020 | scrMenuMgr->addMenuSeparator("Help"); |
14509 | cbradney | 1021 | scrMenuMgr->addMenuItem(scrActions["helpTooltips"], "Help", true); |
7425 | cbradney | 1022 | scrMenuMgr->addMenuSeparator("Help"); |
14509 | cbradney | 1023 | scrMenuMgr->addMenuItem(scrActions["helpOnlineWWW"], "Help", true); |
1024 | scrMenuMgr->addMenuItem(scrActions["helpOnlineDocs"], "Help", true); |
||
1025 | scrMenuMgr->addMenuItem(scrActions["helpOnlineWiki"], "Help", true); |
||
10558 | cbradney | 1026 | scrMenuMgr->createMenu("HelpOnlineTutorials", tr("Online &Tutorials"), "Help"); |
14509 | cbradney | 1027 | scrMenuMgr->addMenuItem(scrActions["helpOnlineTutorial1"], "HelpOnlineTutorials", true); |
10311 | cbradney | 1028 | scrMenuMgr->addMenuSeparator("Help"); |
14509 | cbradney | 1029 | scrMenuMgr->addMenuItem(scrActions["helpCheckUpdates"], "Help", true); |
10913 | jghali | 1030 | scrMenuMgr->addMenuSeparator("Help"); |
14509 | cbradney | 1031 | scrMenuMgr->addMenuItem(scrActions["helpAboutScribus"], "Help", true); |
1032 | scrMenuMgr->addMenuItem(scrActions["helpAboutPlugins"], "Help", true); |
||
1033 | scrMenuMgr->addMenuItem(scrActions["helpAboutQt"], "Help", true); |
||
10953 | subik | 1034 | |
5800 | fschmid | 1035 | scrMenuMgr->addMenuToMenuBar("File"); |
1036 | scrMenuMgr->addMenuToMenuBar("Edit"); |
||
1037 | scrMenuMgr->addMenuToMenuBar("Item"); |
||
1038 | scrMenuMgr->addMenuToMenuBar("Insert"); |
||
17573 | craig | 1039 | //scrMenuMgr->setMenuEnabled("Insert", false); |
5800 | fschmid | 1040 | scrMenuMgr->addMenuToMenuBar("Page"); |
1041 | scrMenuMgr->addMenuToMenuBar("View"); |
||
1042 | scrMenuMgr->addMenuToMenuBar("Extras"); |
||
1043 | scrMenuMgr->setMenuEnabled("Extras", false); |
||
1044 | scrMenuMgr->addMenuToMenuBar("Windows"); |
||
10564 | fschmid | 1045 | menuBar()->addSeparator(); |
5800 | fschmid | 1046 | scrMenuMgr->addMenuToMenuBar("Help"); |
1047 | } |
||
1048 | |||
10532 | avox | 1049 | |
5800 | fschmid | 1050 | void ScribusMainWindow::addDefaultWindowMenuItems() |
1051 | { |
||
1052 | scrMenuMgr->clearMenu("Windows"); |
||
14509 | cbradney | 1053 | scrMenuMgr->addMenuItem(scrActions["windowsCascade"], "Windows", true); |
1054 | scrMenuMgr->addMenuItem(scrActions["windowsTile"], "Windows", true); |
||
5800 | fschmid | 1055 | scrMenuMgr->addMenuSeparator("Windows"); |
1056 | |||
14509 | cbradney | 1057 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Windows", true); |
1058 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Windows", true); |
||
1059 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Windows", true); |
||
1060 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Windows", true); |
||
1061 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Windows", true); |
||
1062 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Windows", true); |
||
1063 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Windows", true); |
||
1064 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Windows", true); |
||
1065 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Windows", true); |
||
1066 | scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Windows", true); |
||
15060 | fschmid | 1067 | scrMenuMgr->addMenuItem(scrActions["toolsSymbols"], "Windows", true); |
17405 | fschmid | 1068 | scrMenuMgr->addMenuItem(scrActions["toolsInline"], "Windows", true); |
5800 | fschmid | 1069 | scrMenuMgr->addMenuSeparator("Windows"); |
14509 | cbradney | 1070 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Windows", true); |
1071 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Windows", true); |
||
5800 | fschmid | 1072 | } |
1073 | |||
1074 | |||
1075 | void ScribusMainWindow::initStatusBar() |
||
1076 | { |
||
10564 | fschmid | 1077 | mainWindowStatusLabel = new QLabel( " ", statusBar()); |
9953 | cbradney | 1078 | mainWindowProgressBar = new QProgressBar(statusBar()); |
1079 | mainWindowProgressBar->setAlignment(Qt::AlignHCenter); |
||
5800 | fschmid | 1080 | mainWindowProgressBar->setFixedWidth( 100 ); |
1081 | mainWindowProgressBar->reset(); |
||
12904 | jghali | 1082 | mainWindowXPosLabel = new QLabel( tr("X-Pos:"), statusBar()); |
1083 | mainWindowYPosLabel = new QLabel( tr("Y-Pos:"), statusBar()); |
||
10564 | fschmid | 1084 | mainWindowXPosDataLabel = new QLabel( " ", statusBar()); |
1085 | mainWindowYPosDataLabel = new QLabel( " ", statusBar()); |
||
5800 | fschmid | 1086 | |
10564 | fschmid | 1087 | statusBar()->addPermanentWidget(mainWindowStatusLabel, 6); |
1088 | statusBar()->addPermanentWidget(mainWindowProgressBar, 0); |
||
1089 | statusBar()->addPermanentWidget(mainWindowXPosLabel, 0); |
||
1090 | statusBar()->addPermanentWidget(mainWindowXPosDataLabel, 1); |
||
1091 | statusBar()->addPermanentWidget(mainWindowYPosLabel, 0); |
||
1092 | statusBar()->addPermanentWidget(mainWindowYPosDataLabel, 1); |
||
15675 | fschmid | 1093 | connect(statusBar(), SIGNAL(messageChanged(const QString &)), this, SLOT(setTempStatusBarText(const QString &))); |
5800 | fschmid | 1094 | } |
1095 | |||
10532 | avox | 1096 | |
5800 | fschmid | 1097 | void ScribusMainWindow::setStatusBarMousePosition(double xp, double yp) |
1098 | { |
||
1099 | double xn = xp; |
||
1100 | double yn = yp; |
||
14932 | cbradney | 1101 | if (doc->guidesPrefs().rulerMode) |
5800 | fschmid | 1102 | { |
1103 | xn -= doc->currentPage()->xOffset(); |
||
1104 | yn -= doc->currentPage()->yOffset(); |
||
1105 | } |
||
1106 | xn -= doc->rulerXoffset; |
||
1107 | yn -= doc->rulerYoffset; |
||
12652 | cbradney | 1108 | mainWindowXPosDataLabel->setText(value2String(xn, doc->unitIndex(), true, true)); |
1109 | mainWindowYPosDataLabel->setText(value2String(yn, doc->unitIndex(), true, true)); |
||
5800 | fschmid | 1110 | } |
1111 | |||
15465 | avox | 1112 | void ScribusMainWindow::setStatusBarTextPosition(double base, double xp) |
1113 | { |
||
1114 | mainWindowXPosDataLabel->setText(base + xp >= 0? value2String(xp, doc->unitIndex(), true, true): QString("-")); |
||
1115 | mainWindowYPosDataLabel->setText("-"); |
||
1116 | } |
||
10532 | avox | 1117 | |
15675 | fschmid | 1118 | void ScribusMainWindow::setTempStatusBarText(const QString &text) |
1119 | { |
||
1120 | if (mainWindowStatusLabel) |
||
1121 | { |
||
1122 | if (text.isEmpty()) |
||
1123 | mainWindowStatusLabel->setText(statusLabelText); |
||
1124 | else |
||
1125 | mainWindowStatusLabel->setText(text); |
||
1126 | } |
||
1127 | } |
||
15465 | avox | 1128 | |
5800 | fschmid | 1129 | void ScribusMainWindow::setStatusBarInfoText(QString newText) |
1130 | { |
||
1131 | if (mainWindowStatusLabel) |
||
1132 | mainWindowStatusLabel->setText(newText); |
||
15675 | fschmid | 1133 | statusLabelText = newText; |
5800 | fschmid | 1134 | } |
1135 | |||
10532 | avox | 1136 | |
1137 | //AV to be replaced with Selection::update and listener in PropertiesPalette |
||
5800 | fschmid | 1138 | void ScribusMainWindow::setTBvals(PageItem *currItem) |
1139 | { |
||
1140 | if (currItem->itemText.length() != 0) |
||
1141 | { |
||
8562 | jghali | 1142 | // int ChPos = qMin(currItem->CPos, static_cast<int>(currItem->itemText.length()-1)); |
12715 | pierre | 1143 | const ParagraphStyle& currPStyle( (doc->appMode == modeEdit) ? currItem->currentStyle() : currItem->itemText.defaultStyle()); |
16546 | jghali | 1144 | setAlignmentValue(currPStyle.alignment()); |
1145 | propertiesPalette->textPal->displayParStyle(currPStyle.parent()); |
||
1146 | propertiesPalette->textPal->displayCharStyle(currItem->currentCharStyle().parent()); |
||
9067 | avox | 1147 | doc->currentStyle = currItem->currentStyle(); |
13616 | jghali | 1148 | // #8112 : do not use operator= here as it does not update style features |
1149 | doc->currentStyle.charStyle().setStyle( currItem->currentCharStyle() ); |
||
9067 | avox | 1150 | emit TextStyle(doc->currentStyle); |
1151 | // to go: (av) |
||
16840 | jghali | 1152 | propertiesPalette->textPal->updateStyle(doc->currentStyle); |
5800 | fschmid | 1153 | } |
1154 | } |
||
1155 | |||
1156 | //Special keys assigned to actions are stolen by the action and not passed to |
||
1157 | //keyPressEvent so process them here. |
||
8080 | cbradney | 1158 | void ScribusMainWindow::specialActionKeyEvent(const QString& actionName, int unicodevalue) |
5800 | fschmid | 1159 | { |
1160 | if (HaveDoc) |
||
1161 | { |
||
17356 | fschmid | 1162 | if (doc->m_Selection->count() == 1) |
5800 | fschmid | 1163 | { |
17356 | fschmid | 1164 | PageItem* selItem = doc->m_Selection->itemAt(0); |
1165 | if (((doc->appMode == modeEdit) || (doc->appMode == modeEditTable)) && (selItem->isTextFrame() || selItem->isTable())) |
||
5800 | fschmid | 1166 | { |
17356 | fschmid | 1167 | PageItem_TextFrame *currItem; |
1168 | if (doc->appMode == modeEditTable) |
||
1169 | currItem = selItem->asTable()->activeCell().textFrame(); |
||
1170 | else |
||
1171 | currItem = selItem->asTextFrame(); |
||
5800 | fschmid | 1172 | if (currItem!=NULL) |
1173 | { |
||
1174 | if (unicodevalue!=-1) |
||
1175 | { |
||
17641 | craig | 1176 | UndoTransaction* activeTransaction = NULL; |
1177 | if (currItem->HasSel){ |
||
1178 | if (UndoManager::undoEnabled()) |
||
1179 | activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection, Um::IGroup, Um::ReplaceText, "", Um::IDelete)); |
||
17356 | fschmid | 1180 | currItem->deleteSelectedTextFromFrame(); |
17641 | craig | 1181 | } |
1182 | if (UndoManager::undoEnabled()) |
||
1183 | { |
||
1184 | SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo()); |
||
1185 | if(ss && ss->get("ETEA") == "insert_frametext") |
||
1186 | ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(QChar(unicodevalue))); |
||
1187 | else { |
||
1188 | ss = new SimpleState(Um::InsertText,"",Um::ICreate); |
||
1189 | ss->set("INSERT_FRAMETEXT", "insert_frametext"); |
||
1190 | ss->set("ETEA", QString("insert_frametext")); |
||
1191 | ss->set("TEXT_STR", QString(QChar(unicodevalue))); |
||
1192 | ss->set("START", currItem->itemText.cursorPosition()); |
||
1193 | undoManager->action(currItem, ss); |
||
1194 | } |
||
1195 | } |
||
16626 | jghali | 1196 | currItem->itemText.insertChars(QString(QChar(unicodevalue)), true); |
17641 | craig | 1197 | if (activeTransaction) |
1198 | { |
||
1199 | activeTransaction->commit(); |
||
1200 | delete activeTransaction; |
||
1201 | activeTransaction = NULL; |
||
1202 | } |
||
5800 | fschmid | 1203 | } |
15009 | jghali | 1204 | else if (actionName=="unicodeSoftHyphen") //ignore the char as we use an attribute if the text item, for now. |
5800 | fschmid | 1205 | { |
15009 | jghali | 1206 | // this code is currently dead since unicodeSoftHyphen |
6999 | avox | 1207 | // doesnt have unicodevalue == -1 any more |
16626 | jghali | 1208 | if (currItem->itemText.cursorPosition() > 1) |
5800 | fschmid | 1209 | { |
7442 | avox | 1210 | #if 0 |
8562 | jghali | 1211 | StyleFlag fl = currItem->itemText.item(qMax(currItem->CPos-1,0))->effects(); |
5800 | fschmid | 1212 | fl |= ScStyle_HyphenationPossible; |
8562 | jghali | 1213 | currItem->itemText.item(qMax(currItem->CPos-1,0))->setEffects(fl); |
5800 | fschmid | 1214 | #else |
17641 | craig | 1215 | if (UndoManager::undoEnabled()) |
1216 | { |
||
1217 | SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo()); |
||
1218 | if(ss && ss->get("ETEA") == "insert_frametext") |
||
1219 | ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(SpecialChars::SHYPHEN)); |
||
1220 | else { |
||
1221 | ss = new SimpleState(Um::InsertText,"",Um::ICreate); |
||
1222 | ss->set("INSERT_FRAMETEXT", "insert_frametext"); |
||
1223 | ss->set("ETEA", QString("insert_frametext")); |
||
1224 | ss->set("TEXT_STR", QString(SpecialChars::SHYPHEN)); |
||
1225 | ss->set("START", currItem->itemText.cursorPosition()); |
||
1226 | undoManager->action(currItem, ss); |
||
1227 | } |
||
1228 | } |
||
16626 | jghali | 1229 | currItem->itemText.insertChars(QString(SpecialChars::SHYPHEN), true); |
5800 | fschmid | 1230 | #endif |
1231 | } |
||
1232 | } |
||
17356 | fschmid | 1233 | if (doc->appMode == modeEditTable) |
1234 | selItem->asTable()->update(); |
||
1235 | else |
||
1236 | currItem->update(); |
||
5800 | fschmid | 1237 | } |
1238 | } |
||
1239 | } |
||
1240 | } |
||
1241 | } |
||
1242 | |||
1243 | bool ScribusMainWindow::eventFilter( QObject* /*o*/, QEvent *e ) |
||
1244 | { |
||
1245 | bool retVal; |
||
9562 | fschmid | 1246 | if (e->type() == QEvent::ToolTip) |
1247 | { |
||
13955 | cbradney | 1248 | return (!prefsManager->appPrefs.displayPrefs.showToolTips); |
9562 | fschmid | 1249 | } |
11960 | subik | 1250 | if ( e->type() == QEvent::KeyPress ) |
11893 | cbradney | 1251 | { |
5800 | fschmid | 1252 | QKeyEvent *k = (QKeyEvent *)e; |
1253 | int keyMod=0; |
||
10390 | cbradney | 1254 | if (k->modifiers() & Qt::ShiftModifier) |
8523 | cbradney | 1255 | keyMod |= Qt::SHIFT; |
10390 | cbradney | 1256 | if (k->modifiers() & Qt::ControlModifier) |
8523 | cbradney | 1257 | keyMod |= Qt::CTRL; |
10390 | cbradney | 1258 | if (k->modifiers() & Qt::AltModifier) |
8523 | cbradney | 1259 | keyMod |= Qt::ALT; |
5800 | fschmid | 1260 | |
1261 | QKeySequence currKeySeq = QKeySequence(k->key() | keyMod); |
||
1262 | if (QString(currKeySeq).isNull()) |
||
1263 | return false; |
||
1264 | retVal=true; |
||
1265 | //Palette actions |
||
10564 | fschmid | 1266 | if (currKeySeq == scrActions["specialToggleAllPalettes"]->shortcut()) |
8613 | cbradney | 1267 | scrActions["specialToggleAllPalettes"]->activate(QAction::Trigger); |
5800 | fschmid | 1268 | else |
15302 | cbradney | 1269 | if (currKeySeq == scrActions["specialToggleAllGuides"]->shortcut()) |
1270 | scrActions["specialToggleAllGuides"]->activate(QAction::Trigger); |
||
1271 | else |
||
10390 | cbradney | 1272 | // CB These were moved to ActionManager via the setShortcutContext(Qt::ApplicationShortcut) calls, leaving for notes for now |
10181 | cbradney | 1273 | // if (currKeySeq == scrActions["toolsProperties"]->accel()) |
1274 | // scrActions["toolsProperties"]->toggle(); |
||
1275 | // else |
||
1276 | // if (currKeySeq == scrActions["toolsOutline"]->accel()) |
||
1277 | // scrActions["toolsOutline"]->toggle(); |
||
1278 | // else |
||
1279 | // if (currKeySeq == scrActions["toolsScrapbook"]->accel()) |
||
1280 | // scrActions["toolsScrapbook"]->toggle(); |
||
1281 | // else |
||
1282 | // if (currKeySeq == scrActions["toolsLayers"]->accel()) |
||
1283 | // scrActions["toolsLayers"]->toggle(); |
||
1284 | // else |
||
1285 | // if (currKeySeq == scrActions["toolsPages"]->accel()) |
||
1286 | // scrActions["toolsPages"]->toggle(); |
||
1287 | // else |
||
1288 | // if (currKeySeq == scrActions["toolsBookmarks"]->accel()) |
||
1289 | // scrActions["toolsBookmarks"]->toggle(); |
||
1290 | // else |
||
1291 | // if (currKeySeq == scrActions["toolsActionHistory"]->accel()) |
||
1292 | // scrActions["toolsActionHistory"]->toggle(); |
||
1293 | // else |
||
1294 | // if (currKeySeq == scrActions["toolsPreflightVerifier"]->accel()) |
||
1295 | // scrActions["toolsPreflightVerifier"]->toggle(); |
||
1296 | // else |
||
1297 | // if (currKeySeq == scrActions["toolsAlignDistribute"]->accel()) |
||
1298 | // scrActions["toolsAlignDistribute"]->toggle(); |
||
1299 | // else |
||
8005 | cbradney | 1300 | //Edit actions |
15724 | fschmid | 1301 | /* if (currKeySeq == scrActions["editStyles"]->shortcut()) |
8005 | cbradney | 1302 | scrActions["editStyles"]->toggle(); |
1303 | else |
||
10564 | fschmid | 1304 | if (currKeySeq == scrActions["editUndoAction"]->shortcut() && scrActions["editUndoAction"]->isEnabled()) |
8613 | cbradney | 1305 | scrActions["editUndoAction"]->activate(QAction::Trigger); |
5800 | fschmid | 1306 | else |
10564 | fschmid | 1307 | if (currKeySeq == scrActions["editRedoAction"]->shortcut() && scrActions["editRedoAction"]->isEnabled()) |
8613 | cbradney | 1308 | scrActions["editRedoAction"]->activate(QAction::Trigger); |
5800 | fschmid | 1309 | else |
1310 | //Other actions |
||
10564 | fschmid | 1311 | if (currKeySeq == scrActions["fileQuit"]->shortcut()) |
8613 | cbradney | 1312 | scrActions["fileQuit"]->activate(QAction::Trigger); |
5800 | fschmid | 1313 | else |
1314 | //Zoom actions |
||
10564 | fschmid | 1315 | if (currKeySeq == scrActions["toolsZoomIn"]->shortcut()) |
8613 | cbradney | 1316 | scrActions["toolsZoomIn"]->activate(QAction::Trigger); |
5800 | fschmid | 1317 | else |
10564 | fschmid | 1318 | if (currKeySeq == scrActions["toolsZoomOut"]->shortcut()) |
8613 | cbradney | 1319 | scrActions["toolsZoomOut"]->activate(QAction::Trigger); |
15724 | fschmid | 1320 | else */ |
1321 | retVal=false; |
||
5800 | fschmid | 1322 | } |
1323 | else |
||
1324 | retVal=false; |
||
1325 | //Return false to pass event to object |
||
1326 | return retVal; |
||
1327 | } |
||
1328 | |||
10532 | avox | 1329 | |
16546 | jghali | 1330 | void ScribusMainWindow::inputMethodEvent ( QInputMethodEvent * event ) |
1331 | { |
||
1332 | qDebug() << "IMEmw" << event->commitString() << event->preeditString() << "attributes:" << event->attributes().count(); |
||
1333 | } |
||
1334 | |||
1335 | QVariant ScribusMainWindow::inputMethodQuery ( Qt::InputMethodQuery query ) const |
||
1336 | { |
||
1337 | qDebug() << "IMQmw" << query; |
||
1338 | return QVariant(); |
||
1339 | } |
||
1340 | |||
10532 | avox | 1341 | //AV -> CanvasMode |
5800 | fschmid | 1342 | void ScribusMainWindow::keyPressEvent(QKeyEvent *k) |
1343 | { |
||
13950 | fschmid | 1344 | QList<QMdiSubWindow *> windows; |
1345 | QMdiSubWindow* w = NULL; |
||
5800 | fschmid | 1346 | int kk = k->key(); |
1347 | QString uc = k->text(); |
||
11146 | cbradney | 1348 | // QString cr, Tcha, Twort; |
7435 | fschmid | 1349 | if (HaveDoc) |
1350 | { |
||
8523 | cbradney | 1351 | if ((doc->appMode == modeMagnifier) && (kk == Qt::Key_Shift)) |
7435 | fschmid | 1352 | { |
9380 | fschmid | 1353 | qApp->changeOverrideCursor(QCursor(loadIcon("LupeZm.xpm"))); |
7435 | fschmid | 1354 | return; |
1355 | } |
||
1356 | } |
||
5800 | fschmid | 1357 | if (keyrep) |
1358 | return; |
||
1359 | keyrep = true; |
||
10390 | cbradney | 1360 | int keyMod=0; |
1361 | if (k->modifiers() & Qt::ShiftModifier) |
||
1362 | keyMod |= Qt::SHIFT; |
||
1363 | if (k->modifiers() & Qt::ControlModifier) |
||
1364 | keyMod |= Qt::CTRL; |
||
1365 | if (k->modifiers() & Qt::AltModifier) |
||
1366 | keyMod |= Qt::ALT; |
||
5800 | fschmid | 1367 | //User presses escape and we have a doc open, and we have an item selected |
8523 | cbradney | 1368 | if ((kk == Qt::Key_Escape) && (HaveDoc)) |
5800 | fschmid | 1369 | { |
1370 | keyrep = false; |
||
1371 | PageItem *currItem; |
||
1372 | if (doc->m_Selection->count() != 0) |
||
1373 | { |
||
1374 | currItem = doc->m_Selection->itemAt(0); |
||
1375 | switch (doc->appMode) |
||
1376 | { |
||
1377 | case modeNormal: |
||
10532 | avox | 1378 | case modeEditClip: |
5800 | fschmid | 1379 | currItem->Sizing = false; |
1380 | if (doc->SubMode != -1) |
||
1381 | { |
||
1382 | view->Deselect(false); |
||
16943 | fschmid | 1383 | doc->Items->removeOne(currItem); |
5800 | fschmid | 1384 | } |
5967 | fschmid | 1385 | else |
1386 | view->Deselect(false); |
||
11576 | avox | 1387 | view->cancelGroupTransaction(); |
5800 | fschmid | 1388 | break; |
7436 | fschmid | 1389 | case modeEdit: |
11576 | avox | 1390 | view->cancelGroupTransaction(); |
7436 | fschmid | 1391 | break; |
17094 | jghali | 1392 | case modeCopyProperties: |
1393 | case modeEditGradientVectors: |
||
1394 | case modeEditMeshGradient: |
||
5800 | fschmid | 1395 | case modeLinkFrames: |
1396 | case modeUnlinkFrames: |
||
1397 | case modeRotation: |
||
1398 | view->Deselect(false); |
||
17094 | jghali | 1399 | case modeEditWeldPoint: |
12022 | cbradney | 1400 | case modeEyeDropper: |
12971 | jghali | 1401 | case modeImportObject: |
5800 | fschmid | 1402 | case modePanning: |
11490 | avox | 1403 | view->requestMode(modeNormal); |
5800 | fschmid | 1404 | break; |
1405 | case modeDrawBezierLine: |
||
11672 | cbradney | 1406 | currItem->PoLine.resize(qMax(0, static_cast<int>(currItem->PoLine.size())-2)); |
5800 | fschmid | 1407 | if (currItem->PoLine.size() < 4) |
1408 | { |
||
1409 | view->Deselect(false); |
||
16943 | fschmid | 1410 | doc->Items->removeOne(currItem); |
5800 | fschmid | 1411 | } |
1412 | else |
||
1413 | { |
||
16943 | fschmid | 1414 | doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem, false, false); |
8591 | cbradney | 1415 | currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2.0, 1.0))); |
7736 | cbradney | 1416 | doc->AdjustItemSize(currItem); |
5800 | fschmid | 1417 | currItem->ContourLine = currItem->PoLine.copy(); |
1418 | currItem->ClipEdited = true; |
||
1419 | currItem->FrameType = 3; |
||
1420 | slotDocCh(); |
||
1421 | } |
||
1422 | view->FirstPoly = true; |
||
1423 | break; |
||
1424 | default: |
||
11704 | fschmid | 1425 | if (currItem->Sizing) |
1426 | { |
||
1427 | view->Deselect(false); |
||
16943 | fschmid | 1428 | doc->Items->removeOne(currItem); |
11704 | fschmid | 1429 | } |
5800 | fschmid | 1430 | break; |
1431 | } |
||
1432 | } |
||
1433 | doc->DragP = false; |
||
1434 | doc->leaveDrag = false; |
||
10532 | avox | 1435 | view->stopAllDrags(); |
5800 | fschmid | 1436 | doc->SubMode = -1; |
1437 | doc->ElemToLink = NULL; |
||
1438 | slotSelect(); |
||
11704 | fschmid | 1439 | if (doc->m_Selection->count() == 0) |
1440 | HaveNewSel(-1); |
||
13955 | cbradney | 1441 | prefsManager->appPrefs.uiPrefs.stickyTools = false; |
1442 | scrActions["stickyTools"]->setChecked(false); |
||
5800 | fschmid | 1443 | return; |
1444 | } |
||
10390 | cbradney | 1445 | Qt::KeyboardModifiers buttonModifiers = k->modifiers(); |
5800 | fschmid | 1446 | /**If we have a doc and we are not changing the page or zoom level in the status bar */ |
1447 | if ((HaveDoc) && (!view->zoomSpinBox->hasFocus()) && (!view->pageSelector->hasFocus())) |
||
1448 | { |
||
11146 | cbradney | 1449 | //Show our context menu |
1450 | QKeySequence currKeySeq = QKeySequence(kk | keyMod); |
||
11149 | cbradney | 1451 | if (currKeySeq.matches(scrActions["viewShowContextMenu"]->shortcut()) == QKeySequence::ExactMatch) |
11146 | cbradney | 1452 | { |
1453 | ContextMenu* cmen=NULL; |
||
1454 | qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); |
||
1455 | if (doc->m_Selection->count() == 0) |
||
1456 | { |
||
1457 | //CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPos()); |
||
1458 | QPoint p(QCursor::pos() - mapToGlobal(QPoint(0,0))); |
||
1459 | FPoint fp(p.x() / view->scale() + doc->minCanvasCoordinate.x(), |
||
11960 | subik | 1460 | p.y() / view->scale() + doc->minCanvasCoordinate.y()); |
11146 | cbradney | 1461 | cmen = new ContextMenu(this, doc, fp.x(), fp.y()); |
1462 | } |
||
1463 | else |
||
1464 | cmen = new ContextMenu(*(doc->m_Selection), this, doc); |
||
1465 | if (cmen) |
||
1466 | { |
||
1467 | setUndoMode(true); |
||
1468 | cmen->exec(QCursor::pos()); |
||
1469 | setUndoMode(false); |
||
1470 | } |
||
1471 | delete cmen; |
||
1472 | } |
||
11960 | subik | 1473 | |
1474 | |||
5800 | fschmid | 1475 | /** |
1476 | * With no item selected we can: |
||
1477 | * - With space, get into panning mode (modePanning) |
||
1478 | * - With PageUp, scroll up |
||
1479 | * - With PageDown, scroll down |
||
1480 | * - With Tab, change active document windowActivated |
||
1481 | */ |
||
1482 | |||
1483 | if ((doc->appMode != modeEdit) && (doc->m_Selection->count() == 0)) |
||
1484 | { |
||
6284 | fschmid | 1485 | int pg; |
13870 | cbradney | 1486 | int wheelVal = prefsManager->mouseWheelJump(); |
10390 | cbradney | 1487 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
8970 | fschmid | 1488 | wheelVal = qMax(qRound(wheelVal / 10.0), 1); |
5800 | fschmid | 1489 | switch (kk) |
1490 | { |
||
8523 | cbradney | 1491 | case Qt::Key_Space: |
5800 | fschmid | 1492 | keyrep = false; |
1493 | if (doc->appMode == modePanning) |
||
10532 | avox | 1494 | view->requestMode(modeNormal); |
5800 | fschmid | 1495 | else |
10532 | avox | 1496 | view->requestMode(modePanning); |
5800 | fschmid | 1497 | return; |
1498 | break; |
||
10564 | fschmid | 1499 | case Qt::Key_PageUp: |
17410 | fschmid | 1500 | if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode()) |
13870 | cbradney | 1501 | view->scrollBy(0, -prefsManager->mouseWheelJump()); |
6284 | fschmid | 1502 | else |
1503 | { |
||
1504 | pg = doc->currentPageNumber(); |
||
10390 | cbradney | 1505 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6284 | fschmid | 1506 | pg--; |
1507 | else |
||
15407 | craig | 1508 | pg -= doc->pageSets()[doc->pagePositioning()].Columns; |
6284 | fschmid | 1509 | if (pg > -1) |
1510 | view->GotoPage(pg); |
||
1511 | } |
||
5800 | fschmid | 1512 | keyrep = false; |
1513 | return; |
||
1514 | break; |
||
10564 | fschmid | 1515 | case Qt::Key_PageDown: |
17410 | fschmid | 1516 | if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode()) |
13870 | cbradney | 1517 | view->scrollBy(0, prefsManager->mouseWheelJump()); |
6284 | fschmid | 1518 | else |
1519 | { |
||
1520 | pg = doc->currentPageNumber(); |
||
10390 | cbradney | 1521 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6284 | fschmid | 1522 | pg++; |
1523 | else |
||
15407 | craig | 1524 | pg += doc->pageSets()[doc->pagePositioning()].Columns; |
7328 | fschmid | 1525 | if (pg < static_cast<int>(doc->Pages->count())) |
6284 | fschmid | 1526 | view->GotoPage(pg); |
1527 | } |
||
5800 | fschmid | 1528 | keyrep = false; |
1529 | return; |
||
1530 | break; |
||
8970 | fschmid | 1531 | case Qt::Key_Left: |
1532 | view->scrollBy(-wheelVal, 0); |
||
1533 | keyrep = false; |
||
1534 | return; |
||
1535 | break; |
||
1536 | case Qt::Key_Right: |
||
1537 | view->scrollBy(wheelVal, 0); |
||
1538 | keyrep = false; |
||
1539 | return; |
||
1540 | break; |
||
1541 | case Qt::Key_Up: |
||
1542 | view->scrollBy(0, -wheelVal); |
||
1543 | keyrep = false; |
||
1544 | return; |
||
1545 | break; |
||
1546 | case Qt::Key_Down: |
||
1547 | view->scrollBy(0, wheelVal); |
||
1548 | keyrep = false; |
||
1549 | return; |
||
1550 | break; |
||
8523 | cbradney | 1551 | case Qt::Key_Tab: |
14034 | jghali | 1552 | if (buttonModifiers == Qt::ControlModifier) |
5800 | fschmid | 1553 | { |
14034 | jghali | 1554 | keyrep = false; |
1555 | windows = mdiArea->subWindowList(); |
||
1556 | if (windows.count() > 1) |
||
5800 | fschmid | 1557 | { |
14034 | jghali | 1558 | for (int i = 0; i < static_cast<int>(windows.count()); ++i) |
5800 | fschmid | 1559 | { |
14034 | jghali | 1560 | if (mdiArea->activeSubWindow() == windows.at(i)) |
1561 | { |
||
1562 | if (i == static_cast<int>(windows.count()-1)) |
||
1563 | w = windows.at(0); |
||
1564 | else |
||
1565 | w = windows.at(i+1); |
||
1566 | break; |
||
1567 | } |
||
5800 | fschmid | 1568 | } |
14034 | jghali | 1569 | outlinePalette->buildReopenVals(); |
1570 | docCheckerPalette->clearErrorList(); |
||
1571 | if ( w ) |
||
1572 | w->showNormal(); |
||
1573 | newActWin(w); |
||
5800 | fschmid | 1574 | } |
14034 | jghali | 1575 | return; |
5800 | fschmid | 1576 | } |
1577 | break; |
||
1578 | } |
||
1579 | } |
||
1580 | /** Now if we have an item selected |
||
1581 | * - In normal mode we can: |
||
1582 | * -- Use backspace or delete to delete the item |
||
1583 | * -- In edit mode of an image frame, use the arrow keys to resize the image: |
||
1584 | (flows to pageitem_imageframe for control) |
||
1585 | Alt right arrow, move right side of image outwards (expand) |
||
1586 | Alt left arrow, move right side inwards (shrink) |
||
1587 | Alt down arrow, move bottom side downwards (expand) |
||
1588 | Alt up arrow, move top side inwards (shrink) |
||
1589 | */ |
||
1590 | if (doc->m_Selection->count() != 0) |
||
1591 | { |
||
1592 | PageItem *currItem = doc->m_Selection->itemAt(0); |
||
14340 | jghali | 1593 | if (doc->appMode == modeEdit) |
5800 | fschmid | 1594 | { |
1595 | if (currItem->asImageFrame() && !currItem->locked()) |
||
1596 | { |
||
1597 | currItem->handleModeEditKey(k, keyrep); |
||
1598 | } |
||
14340 | jghali | 1599 | //FIXME:av view->oldCp = currItem->CPos; |
5800 | fschmid | 1600 | if (currItem->itemType() == PageItem::TextFrame) |
1601 | { |
||
1602 | bool kr=keyrep; |
||
16474 | craig | 1603 | view->canvasMode()->keyPressEvent(k); //Hack for 1.4.x for stopping the cursor blinking while moving about |
5800 | fschmid | 1604 | currItem->handleModeEditKey(k, keyrep); |
1605 | keyrep=kr; |
||
1606 | } |
||
1607 | slotDocCh(false); |
||
1608 | } |
||
1609 | } |
||
1610 | } |
||
1611 | switch(kk) |
||
1612 | { |
||
8523 | cbradney | 1613 | case Qt::Key_Left: |
1614 | case Qt::Key_Right: |
||
1615 | case Qt::Key_Up: |
||
1616 | case Qt::Key_Down: |
||
5800 | fschmid | 1617 | _arrowKeyDown = true; |
1618 | } |
||
1619 | keyrep = false; |
||
1620 | } |
||
1621 | |||
1622 | void ScribusMainWindow::keyReleaseEvent(QKeyEvent *k) |
||
1623 | { |
||
10390 | cbradney | 1624 | //Exit out of panning mode if Control is release while the right mouse button is pressed |
1625 | if (HaveDoc) |
||
5800 | fschmid | 1626 | { |
10390 | cbradney | 1627 | if ((doc->appMode == modePanning) && (k->key() == Qt::Key_Control) && (QApplication::mouseButtons() & Qt::RightButton)) |
10532 | avox | 1628 | view->requestMode(modeNormal); |
5800 | fschmid | 1629 | } |
7435 | fschmid | 1630 | if (HaveDoc) |
1631 | { |
||
1632 | if (doc->appMode == modeMagnifier) |
||
9380 | fschmid | 1633 | qApp->changeOverrideCursor(QCursor(loadIcon("LupeZ.xpm"))); |
7435 | fschmid | 1634 | } |
5800 | fschmid | 1635 | if (k->isAutoRepeat() || !_arrowKeyDown) |
1636 | return; |
||
1637 | switch(k->key()) |
||
1638 | { |
||
8523 | cbradney | 1639 | case Qt::Key_Left: |
1640 | case Qt::Key_Right: |
||
1641 | case Qt::Key_Up: |
||
1642 | case Qt::Key_Down: |
||
5800 | fschmid | 1643 | _arrowKeyDown = false; |
1644 | if ((HaveDoc) && (!view->zoomSpinBox->hasFocus()) && (!view->pageSelector->hasFocus())) |
||
1645 | { |
||
10390 | cbradney | 1646 | int docSelectionCount=doc->m_Selection->count(); |
10532 | avox | 1647 | if ((docSelectionCount != 0) && (doc->appMode == modeEditClip) && (doc->nodeEdit.hasNodeSelected())) |
9735 | fschmid | 1648 | { |
1649 | PageItem *currItem = doc->m_Selection->itemAt(0); |
||
1650 | double xposOrig = currItem->xPos(); |
||
1651 | double yposOrig = currItem->yPos(); |
||
1652 | doc->AdjustItemSize(currItem); |
||
10532 | avox | 1653 | if (!doc->nodeEdit.isContourLine) |
9735 | fschmid | 1654 | currItem->ContourLine.translate(xposOrig - currItem->xPos(),yposOrig - currItem->yPos()); |
10532 | avox | 1655 | currItem->update(); |
9735 | fschmid | 1656 | } |
10390 | cbradney | 1657 | for (int i = 0; i < docSelectionCount; ++i) |
5800 | fschmid | 1658 | doc->m_Selection->itemAt(i)->checkChanges(true); |
1659 | if (docSelectionCount > 1 && view->groupTransactionStarted()) |
||
11576 | avox | 1660 | view->endGroupTransaction(); |
5800 | fschmid | 1661 | } |
1662 | break; |
||
1663 | } |
||
1664 | } |
||
1665 | |||
10859 | cbradney | 1666 | void ScribusMainWindow::changeEvent(QEvent *e) |
1667 | { |
||
1668 | if (e->type() == QEvent::LanguageChange) |
||
1669 | { |
||
1670 | languageChange(); |
||
1671 | } |
||
10903 | cbradney | 1672 | else |
1673 | QWidget::changeEvent(e); |
||
10859 | cbradney | 1674 | } |
1675 | |||
5800 | fschmid | 1676 | void ScribusMainWindow::closeEvent(QCloseEvent *ce) |
1677 | { |
||
13487 | cbradney | 1678 | //Do not quit if Preferences or new doc window is open |
15834 | fschmid | 1679 | // Preferences *prefsWin = findChild<Preferences *>(QString::fromLocal8Bit("PreferencesWindow")); |
14658 | cbradney | 1680 | PreferencesDialog *prefsDialog = findChild<PreferencesDialog *>(QString::fromLocal8Bit("PreferencesDialog")); |
13487 | cbradney | 1681 | NewDoc *newDocWin = findChild<NewDoc *>(QString::fromLocal8Bit("NewDocumentWindow")); |
15834 | fschmid | 1682 | // if (prefsWin!=NULL || prefsDialog!=NULL || newDocWin!=NULL) |
1683 | if (prefsDialog!=NULL || newDocWin!=NULL) |
||
13478 | cbradney | 1684 | { |
1685 | ce->ignore(); |
||
1686 | return; |
||
1687 | } |
||
13959 | jghali | 1688 | QList<QMdiSubWindow *> windows = mdiArea->subWindowList(); |
5800 | fschmid | 1689 | ScribusWin* tw; |
13959 | jghali | 1690 | disconnect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(newActWin(QMdiSubWindow *))); |
5800 | fschmid | 1691 | if (!windows.isEmpty()) |
1692 | { |
||
1693 | uint windowCount=windows.count(); |
||
1694 | for ( uint i = 0; i < windowCount; ++i ) |
||
1695 | { |
||
14010 | fschmid | 1696 | tw = (ScribusWin *)(windows.at(i)); |
1697 | QMdiSubWindow *tws = windows.at(i); |
||
1698 | ScribusWin* scw = dynamic_cast<ScribusWin *>(tws->widget()); |
||
1699 | if (scw) |
||
5800 | fschmid | 1700 | { |
14001 | fschmid | 1701 | newActWin(windows.at(i)); |
1702 | tw = ActWin; |
||
1703 | slotSelect(); |
||
1704 | ActWin->close(); |
||
1705 | if (tw == ActWin) |
||
1706 | { |
||
1707 | ce->ignore(); |
||
1708 | connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(newActWin(QMdiSubWindow *))); |
||
1709 | return; |
||
1710 | } |
||
5800 | fschmid | 1711 | } |
1712 | } |
||
1713 | } |
||
15260 | cbradney | 1714 | fileToolBar->connectPrefsSlot(false); |
1715 | editToolBar->connectPrefsSlot(false); |
||
1716 | modeToolBar->connectPrefsSlot(false); |
||
1717 | pdfToolBar->connectPrefsSlot(false); |
||
5800 | fschmid | 1718 | propertiesPalette->hide(); |
1719 | outlinePalette->hide(); |
||
1720 | scrapbookPalette->hide(); |
||
1721 | bookmarkPalette->hide(); |
||
1722 | layerPalette->hide(); |
||
1723 | pagePalette->hide(); |
||
1724 | docCheckerPalette->hide(); |
||
1725 | undoPalette->hide(); |
||
1726 | alignDistributePalette->hide(); |
||
1727 | guidePalette->hide(); |
||
7087 | subik | 1728 | charPalette->hide(); |
15060 | fschmid | 1729 | symbolPalette->hide(); |
17405 | fschmid | 1730 | inlinePalette->hide(); |
5800 | fschmid | 1731 | |
1732 | // Clean up plugins, THEN save prefs to disk |
||
1733 | ScCore->pluginManager->cleanupPlugins(); |
||
13955 | cbradney | 1734 | if (!prefsManager->appPrefs.scrapbookPrefs.persistentScrapbook) |
5800 | fschmid | 1735 | scrapbookPalette->CleanUpTemp(); |
13955 | cbradney | 1736 | prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks.clear(); |
1737 | prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks = scrapbookPalette->getOpenScrapbooks(); |
||
5800 | fschmid | 1738 | if (!emergencyActivated) |
1739 | prefsManager->SavePrefs(); |
||
1740 | UndoManager::deleteInstance(); |
||
10181 | cbradney | 1741 | PrefsManager::deleteInstance(); |
1742 | FormatsManager::deleteInstance(); |
||
10311 | cbradney | 1743 | UrlLauncher::deleteInstance(); |
9380 | fschmid | 1744 | qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); |
10259 | jghali | 1745 | qApp->exit(0); |
5800 | fschmid | 1746 | } |
1747 | |||
16546 | jghali | 1748 | void ScribusMainWindow::requestUpdate(int val) |
1749 | { |
||
1750 | emit UpdateRequest(val); |
||
1751 | } |
||
1752 | |||
5800 | fschmid | 1753 | ///////////////////////////////////////////////////////////////////// |
1754 | // SLOT IMPLEMENTATION |
||
1755 | ///////////////////////////////////////////////////////////////////// |
||
1756 | |||
1757 | |||
1758 | bool ScribusMainWindow::arrowKeyDown() |
||
1759 | { |
||
1760 | return _arrowKeyDown; |
||
1761 | } |
||
1762 | |||
1763 | void ScribusMainWindow::startUpDialog() |
||
1764 | { |
||
7025 | fschmid | 1765 | bool docSet = false; |
5800 | fschmid | 1766 | PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false); |
15417 | craig | 1767 | NewDoc* dia = new NewDoc(this, RecentDocs, true, ScCore->getGuiLanguage()); |
5800 | fschmid | 1768 | if (dia->exec()) |
1769 | { |
||
13380 | subik | 1770 | if (dia->tabSelected() == NewDoc::NewDocumentTab) |
5800 | fschmid | 1771 | { |
13236 | jghali | 1772 | int facingPages = dia->choosenLayout(); |
10564 | fschmid | 1773 | int firstPage = dia->firstPage->currentIndex(); |
7025 | fschmid | 1774 | docSet = dia->startDocSetup->isChecked(); |
5800 | fschmid | 1775 | double topMargin = dia->marginGroup->top(); |
1776 | double bottomMargin = dia->marginGroup->bottom(); |
||
1777 | double leftMargin = dia->marginGroup->left(); |
||
1778 | double rightMargin = dia->marginGroup->right(); |
||
13236 | jghali | 1779 | double columnDistance = dia->distance(); |
1780 | double pageWidth = dia->pageWidth(); |
||
1781 | double pageHeight = dia->pageHeight(); |
||
5800 | fschmid | 1782 | double numberCols = dia->numberOfCols->value(); |
7023 | fschmid | 1783 | bool autoframes = dia->autoTextFrame->isChecked(); |
13236 | jghali | 1784 | int orientation = dia->orientation(); |
5918 | cbradney | 1785 | int pageCount=dia->pageCountSpinBox->value(); |
7518 | fschmid | 1786 | QString pagesize; |
1787 | if (dia->pageSizeComboBox->currentText() == CommonStrings::trCustomPageSize) |
||
1788 | pagesize = CommonStrings::customPageSize; |
||
1789 | else |
||
1790 | { |
||
1791 | PageSize ps2(dia->pageSizeComboBox->currentText()); |
||
1792 | pagesize = ps2.name(); |
||
1793 | } |
||
12334 | fschmid | 1794 | doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->getMarginPreset()); |
14924 | cbradney | 1795 | doc->setPageSetFirstPage(facingPages, firstPage); |
14992 | cbradney | 1796 | doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight()); |
5800 | fschmid | 1797 | HaveNewDoc(); |
10038 | fschmid | 1798 | doc->reformPages(true); |
11284 | subik | 1799 | // Don's disturb user with "save?" dialog just after new doc |
1800 | // doc changing should be rewritten maybe... maybe later... |
||
1801 | doc->setModified(false); |
||
1802 | updateActiveWindowCaption(doc->DocName); |
||
5800 | fschmid | 1803 | } |
13380 | subik | 1804 | else if (dia->tabSelected() == NewDoc::NewFromTemplateTab) |
5800 | fschmid | 1805 | { |
13236 | jghali | 1806 | QString fileName = QDir::cleanPath(dia->selectedFile()); |
1807 | if (!fileName.isEmpty() && loadDoc(fileName)) |
||
5800 | fschmid | 1808 | { |
13188 | fschmid | 1809 | doc->hasName = false; |
1810 | UndoManager::instance()->renameStack(dia->nftGui->currentDocumentTemplate->name); |
||
1811 | doc->DocName = dia->nftGui->currentDocumentTemplate->name; |
||
1812 | updateActiveWindowCaption(QObject::tr("Document Template: ") + dia->nftGui->currentDocumentTemplate->name); |
||
1813 | QDir::setCurrent(PrefsManager::instance()->documentDir()); |
||
13236 | jghali | 1814 | removeRecent(fileName); |
5800 | fschmid | 1815 | } |
13188 | fschmid | 1816 | } |
13380 | subik | 1817 | else if (dia->tabSelected() == NewDoc::OpenExistingTab) |
13188 | fschmid | 1818 | { |
13236 | jghali | 1819 | QString fileName = dia->selectedFile(); |
13188 | fschmid | 1820 | if (!fileName.isEmpty()) |
5800 | fschmid | 1821 | { |
13235 | jghali | 1822 | QFileInfo fi(fileName); |
1823 | docContext->set("docsopen", fi.absolutePath()); |
||
13188 | fschmid | 1824 | loadDoc(fileName); |
5800 | fschmid | 1825 | } |
1826 | } |
||
13380 | subik | 1827 | else // NewDoc::OpenRecentTab |
13188 | fschmid | 1828 | { |
13236 | jghali | 1829 | QString fileName = dia->selectedFile(); |
1830 | if (!fileName.isEmpty()) |
||
1831 | loadRecent(fileName); |
||
13188 | fschmid | 1832 | } |
5800 | fschmid | 1833 | } |
1834 | prefsManager->setShowStartupDialog(!dia->startUpDialog->isChecked()); |
||
1835 | delete dia; |
||
1836 | mainWindowStatusLabel->setText( tr("Ready")); |
||
7025 | fschmid | 1837 | if (docSet) |
17000 | fschmid | 1838 | slotDocSetup(); |
5800 | fschmid | 1839 | } |
1840 | |||
1841 | bool ScribusMainWindow::slotFileNew() |
||
1842 | { |
||
10532 | avox | 1843 | if (HaveDoc && doc->appMode == modeEditClip) |
1844 | view->requestMode(submodeEndNodeEdit); |
||
6189 | jghali | 1845 | bool retVal = false; |
7025 | fschmid | 1846 | bool docSet = false; |
5800 | fschmid | 1847 | NewDoc* dia = new NewDoc(this, RecentDocs); |
1848 | if (dia->exec()) |
||
1849 | { |
||
13236 | jghali | 1850 | int facingPages = dia->choosenLayout(); |
10564 | fschmid | 1851 | int firstPage = dia->firstPage->currentIndex(); |
7025 | fschmid | 1852 | docSet = dia->startDocSetup->isChecked(); |
5800 | fschmid | 1853 | double topMargin = dia->marginGroup->top(); |
1854 | double bottomMargin = dia->marginGroup->bottom(); |
||
1855 | double leftMargin = dia->marginGroup->left(); |
||
1856 | double rightMargin = dia->marginGroup->right(); |
||
13236 | jghali | 1857 | double columnDistance = dia->distance(); |
1858 | double pageWidth = dia->pageWidth(); |
||
1859 | double pageHeight = dia->pageHeight(); |
||
5800 | fschmid | 1860 | double numberCols = dia->numberOfCols->value(); |
7023 | fschmid | 1861 | bool autoframes = dia->autoTextFrame->isChecked(); |
13236 | jghali | 1862 | int orientation = dia->orientation(); |
5918 | cbradney | 1863 | int pageCount=dia->pageCountSpinBox->value(); |
7518 | fschmid | 1864 | QString pagesize; |
1865 | if (dia->pageSizeComboBox->currentText() == CommonStrings::trCustomPageSize) |
||
1866 | pagesize = CommonStrings::customPageSize; |
||
1867 | else |
||
6189 | jghali | 1868 | { |
7518 | fschmid | 1869 | PageSize ps2(dia->pageSizeComboBox->currentText()); |
1870 | pagesize = ps2.name(); |
||
1871 | } |
||
12334 | fschmid | 1872 | if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->getMarginPreset())) |
7518 | fschmid | 1873 | { |
14924 | cbradney | 1874 | doc->setPageSetFirstPage(facingPages, firstPage); |
14992 | cbradney | 1875 | doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight()); |
6189 | jghali | 1876 | mainWindowStatusLabel->setText( tr("Ready")); |
1877 | HaveNewDoc(); |
||
10038 | fschmid | 1878 | doc->reformPages(true); |
6189 | jghali | 1879 | retVal = true; |
11284 | subik | 1880 | // Don's disturb user with "save?" dialog just after new doc |
1881 | // doc changing should be rewritten maybe... maybe later... |
||
1882 | doc->setModified(false); |
||
1883 | updateActiveWindowCaption(doc->DocName); |
||
6189 | jghali | 1884 | } |
5800 | fschmid | 1885 | } |
1886 | delete dia; |
||
7025 | fschmid | 1887 | if (docSet) |
17000 | fschmid | 1888 | slotDocSetup(); |
6189 | jghali | 1889 | return retVal; |
5800 | fschmid | 1890 | } |
1891 | |||
1892 | //TODO move to core, assign doc to doc list, optionally create gui for it |
||
12334 | fschmid | 1893 | 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, int marginPreset) |
5800 | fschmid | 1894 | { |
12334 | fschmid | 1895 | return doFileNew(width, height, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, columnCount, autoTextFrames, pageArrangement, unitIndex, firstPageLocation, orientation, firstPageNumber, defaultPageSize, requiresGUI, pageCount, showView, marginPreset); |
5800 | fschmid | 1896 | } |
1897 | |||
12334 | fschmid | 1898 | 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, int marginPreset) |
5800 | fschmid | 1899 | { |
8220 | fschmid | 1900 | if (HaveDoc) |
1901 | outlinePalette->buildReopenVals(); |
||
6725 | tsoots | 1902 | undoManager->setUndoEnabled(false); |
5800 | fschmid | 1903 | MarginStruct margins(topMargin, leftMargin, bottomMargin, rightMargin); |
1904 | DocPagesSetup pagesSetup(pageArrangement, firstPageLocation, firstPageNumber, orientation, autoTextFrames, columnDistance, columnCount); |
||
6259 | fschmid | 1905 | QString newDocName( tr("Document")+"-"+QString::number(DocNr)); |
5808 | cbradney | 1906 | ScribusDoc *tempDoc = new ScribusDoc(); |
1907 | if (requiresGUI) |
||
1908 | doc=tempDoc; |
||
1909 | tempDoc->setLoading(true); |
||
7099 | fschmid | 1910 | outlinePalette->setDoc(tempDoc); |
16016 | fschmid | 1911 | ColorSetManager csm; |
1912 | csm.findPaletteLocations(); |
||
1913 | csm.findPalettes(); |
||
1914 | csm.findUserPalettes(); |
||
1915 | ColorList colorList; |
||
17400 | fschmid | 1916 | QHash<QString, VGradient> gradientsList; |
1917 | QHash<QString, ScPattern> patternsList; |
||
16577 | craig | 1918 | QString Cpfad = QDir::toNativeSeparators(ScPaths::getApplicationDataDir())+"DefaultColors.xml"; |
16016 | fschmid | 1919 | QFile fc(Cpfad); |
1920 | if (fc.exists()) |
||
1921 | { |
||
1922 | csm.loadPalette(Cpfad, doc, colorList, gradientsList, patternsList, false); |
||
1923 | doc->PageColors = colorList; |
||
1924 | doc->docGradients = gradientsList; |
||
1925 | doc->docPatterns = patternsList; |
||
1926 | } |
||
1927 | else |