Rev 22935 | Rev 23009 | 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> |
18198 | fschmid | 32 | #include <QDrag> |
10862 | cbradney | 33 | #include <QDragEnterEvent> |
8501 | cbradney | 34 | #include <QDropEvent> |
35 | #include <QEvent> |
||
10862 | cbradney | 36 | #include <QEventLoop> |
15130 | cbradney | 37 | #include <QFileDialog> |
10862 | cbradney | 38 | #include <QFrame> |
16546 | jghali | 39 | #include <QFont> |
21752 | jghali | 40 | #include <QHBoxLayout> |
10862 | cbradney | 41 | #include <QIcon> |
42 | #include <QInputDialog> |
||
8501 | cbradney | 43 | #include <QKeyEvent> |
10862 | cbradney | 44 | #include <QKeySequence> |
45 | #include <QLabel> |
||
46 | #include <QList> |
||
47 | #include <QLocale> |
||
16546 | jghali | 48 | #include <QMdiArea> |
49 | #include <QMdiSubWindow> |
||
50 | #include <QMessageBox> |
||
10862 | cbradney | 51 | #include <QMouseEvent> |
22201 | jghali | 52 | #include <QMultiMap> |
10862 | cbradney | 53 | #include <QPixmap> |
16546 | jghali | 54 | #include <QProgressBar> |
19093 | craig | 55 | #include <QPushButton> |
18758 | craig | 56 | //<<QML testing |
21752 | jghali | 57 | //#include <QQuickView> |
58 | //#include <QQmlEngine> |
||
59 | //#include <QQmlComponent> |
||
60 | //#include <QQuickItem> |
||
61 | //#include <QQmlProperty> |
||
18758 | craig | 62 | //>> |
10862 | cbradney | 63 | #include <QRegExp> |
18803 | jghali | 64 | #include <QScopedPointer> |
10862 | cbradney | 65 | #include <QStyleFactory> |
9853 | fschmid | 66 | #include <QTableWidget> |
10862 | cbradney | 67 | #include <QTextCodec> |
68 | #include <QTranslator> |
||
69 | #include <QWheelEvent> |
||
1208 | cbradney | 70 | |
14539 | jghali | 71 | #ifdef DEBUG_LOAD_TIMES |
72 | #include <QDebug> |
||
73 | #include <QTime> |
||
74 | #include <sys/times.h> |
||
75 | #endif |
||
76 | |||
3 | paul | 77 | #include <cstdio> |
78 | #include <cstdlib> |
||
9082 | avox | 79 | #include <cassert> |
2629 | craig | 80 | |
2688 | craig | 81 | #include "scconfig.h" |
2629 | craig | 82 | |
83 | #ifdef HAVE_DLFCN_H |
||
3 | paul | 84 | #include <dlfcn.h> |
2629 | craig | 85 | #endif |
86 | |||
87 | #ifdef HAVE_UNISTD_H |
||
135 | Franz | 88 | #include <unistd.h> |
2629 | craig | 89 | #endif |
90 | |||
3 | paul | 91 | #include <iostream> |
8289 | avox | 92 | #include <sstream> |
22652 | craig | 93 | #include <csignal> |
80 | Franz | 94 | #include <string> |
1208 | cbradney | 95 | |
16546 | jghali | 96 | |
97 | #include "actionmanager.h" |
||
19499 | craig | 98 | #include "appmodehelper.h" |
19067 | craig | 99 | #include "appmodes.h" |
16546 | jghali | 100 | #include "canvasmode.h" |
17735 | craig | 101 | #include "canvasmode_imageimport.h" |
16546 | jghali | 102 | #include "commonstrings.h" |
103 | #include "desaxe/digester.h" |
||
104 | #include "desaxe/saxXML.h" |
||
105 | #include "desaxe/simple_actions.h" |
||
106 | #include "docinfo.h" |
||
107 | #include "documentchecker.h" |
||
108 | #include "documentinformation.h" |
||
109 | #include "fileloader.h" |
||
110 | #include "filewatcher.h" |
||
111 | #include "fpoint.h" |
||
112 | #include "fpointarray.h" |
||
113 | #include "gtgettext.h" |
||
114 | #include "hyphenator.h" |
||
20185 | craig | 115 | #include "iconmanager.h" |
16546 | jghali | 116 | #include "langmgr.h" |
19093 | craig | 117 | #include "loadsaveplugin.h" |
17826 | craig | 118 | #include "marks.h" |
19093 | craig | 119 | #include "nfttemplate.h" |
17826 | craig | 120 | #include "notesstyles.h" |
16916 | fschmid | 121 | #include "pageitem_group.h" |
16546 | jghali | 122 | #include "pageitem_imageframe.h" |
123 | #include "pageitem_latexframe.h" |
||
19093 | craig | 124 | #include "pageitem_noteframe.h" |
16856 | craig | 125 | #include "pageitem_table.h" |
16546 | jghali | 126 | #include "pageitem_textframe.h" |
127 | #include "pagesize.h" |
||
128 | #include "pdflib.h" |
||
129 | #include "pdfoptions.h" |
||
130 | #include "pluginmanager.h" |
||
131 | #include "plugins/formatidlist.h" |
||
19093 | craig | 132 | #include "plugins/formatidlist.h" |
16546 | jghali | 133 | #include "prefscontext.h" |
134 | #include "prefsfile.h" |
||
135 | #include "prefsmanager.h" |
||
136 | #include "prefstable.h" |
||
137 | #include "pslib.h" |
||
138 | #include "resourcecollection.h" |
||
139 | #include "sccolorengine.h" |
||
140 | #include "scgtplugin.h" |
||
19093 | craig | 141 | #include "scimagecachemanager.h" |
16546 | jghali | 142 | #include "scmimedata.h" |
16736 | jghali | 143 | #include "scpage.h" |
16546 | jghali | 144 | #include "scpaths.h" |
145 | #include "scprintengine_ps.h" |
||
146 | #include "scraction.h" |
||
147 | #include "scribusXml.h" |
||
148 | #include "scribusapp.h" |
||
149 | #include "scribuscore.h" |
||
19093 | craig | 150 | #include "scribusdoc.h" |
16546 | jghali | 151 | #include "scribusview.h" |
152 | #include "scribuswin.h" |
||
153 | #include "selection.h" |
||
154 | #include "serializer.h" |
||
19093 | craig | 155 | #include "styleoptions.h" |
156 | #include "tocgenerator.h" |
||
13552 | cbradney | 157 | #include "ui/about.h" |
13544 | cbradney | 158 | #include "ui/aboutplugins.h" |
18972 | craig | 159 | #include "ui/adjustcmsdialog.h" |
13544 | cbradney | 160 | #include "ui/aligndistribute.h" |
13650 | cbradney | 161 | #include "ui/annot.h" |
162 | #include "ui/annota.h" |
||
13552 | cbradney | 163 | #include "ui/applytemplatedialog.h" |
13576 | cbradney | 164 | #include "ui/arrowchooser.h" |
13650 | cbradney | 165 | #include "ui/autoform.h" |
13576 | cbradney | 166 | #include "ui/basepointwidget.h" |
13551 | cbradney | 167 | #include "ui/bookmarkpalette.h" |
13544 | cbradney | 168 | #include "ui/charselect.h" |
13650 | cbradney | 169 | #include "ui/checkDocument.h" |
14798 | cbradney | 170 | #include "ui/collectforoutput_ui.h" |
13650 | cbradney | 171 | #include "ui/colorcombo.h" |
13576 | cbradney | 172 | #include "ui/contextmenu.h" |
19093 | craig | 173 | #include "ui/copypagetomasterpagedialog.h" |
13551 | cbradney | 174 | #include "ui/cpalette.h" |
13552 | cbradney | 175 | #include "ui/customfdialog.h" |
13650 | cbradney | 176 | #include "ui/delpages.h" |
19783 | craig | 177 | #include "ui/downloadspalette.h" |
19093 | craig | 178 | #include "ui/edittoolbar.h" |
13552 | cbradney | 179 | #include "ui/effectsdialog.h" |
19093 | craig | 180 | #include "ui/filetoolbar.h" |
13650 | cbradney | 181 | #include "ui/fontcombo.h" |
13544 | cbradney | 182 | #include "ui/guidemanager.h" |
13576 | cbradney | 183 | #include "ui/helpbrowser.h" |
184 | #include "ui/hruler.h" |
||
13552 | cbradney | 185 | #include "ui/imageinfodialog.h" |
17405 | fschmid | 186 | #include "ui/inlinepalette.h" |
13544 | cbradney | 187 | #include "ui/insertaframe.h" |
13650 | cbradney | 188 | #include "ui/inspage.h" |
189 | #include "ui/javadocs.h" |
||
13576 | cbradney | 190 | #include "ui/layers.h" |
13650 | cbradney | 191 | #include "ui/loremipsum.h" |
192 | #include "ui/marginwidget.h" |
||
17826 | craig | 193 | #include "ui/mark2item.h" |
194 | #include "ui/mark2mark.h" |
||
195 | #include "ui/markanchor.h" |
||
19093 | craig | 196 | #include "ui/markinsert.h" |
17826 | craig | 197 | #include "ui/marknote.h" |
19093 | craig | 198 | #include "ui/marksmanager.h" |
17826 | craig | 199 | #include "ui/markvariabletext.h" |
13650 | cbradney | 200 | #include "ui/mergedoc.h" |
19093 | craig | 201 | #include "ui/modetoolbar.h" |
13650 | cbradney | 202 | #include "ui/movepage.h" |
13544 | cbradney | 203 | #include "ui/multipleduplicate.h" |
13650 | cbradney | 204 | #include "ui/newfile.h" |
205 | #include "ui/newtemp.h" |
||
13544 | cbradney | 206 | #include "ui/nftdialog.h" |
207 | #include "ui/nftwidget.h" |
||
13551 | cbradney | 208 | #include "ui/nodeeditpalette.h" |
17826 | craig | 209 | #include "ui/notesstyleseditor.h" |
13551 | cbradney | 210 | #include "ui/outlinepalette.h" |
13544 | cbradney | 211 | #include "ui/pageitemattributes.h" |
13650 | cbradney | 212 | #include "ui/pagelayout.h" |
13551 | cbradney | 213 | #include "ui/pagepalette.h" |
21903 | jghali | 214 | #include "ui/pagepropertiesdialog.h" |
13576 | cbradney | 215 | #include "ui/pageselector.h" |
21926 | craig | 216 | #include "ui/colorsandfills.h" |
19966 | craig | 217 | #include "ui/pdfexportdialog.h" |
19093 | craig | 218 | #include "ui/pdftoolbar.h" |
13544 | cbradney | 219 | #include "ui/picstatus.h" |
220 | #include "ui/polygonwidget.h" |
||
13761 | cbradney | 221 | #include "ui/preferencesdialog.h" |
13650 | cbradney | 222 | #include "ui/preview.h" |
13544 | cbradney | 223 | #include "ui/printdialog.h" |
13551 | cbradney | 224 | #include "ui/propertiespalette.h" |
16546 | jghali | 225 | #include "ui/propertiespalette_image.h" |
226 | #include "ui/propertiespalette_line.h" |
||
227 | #include "ui/propertiespalette_shape.h" |
||
228 | #include "ui/propertiespalette_text.h" |
||
229 | #include "ui/propertiespalette_xyz.h" |
||
13650 | cbradney | 230 | #include "ui/query.h" |
21098 | fschmid | 231 | #include "ui/recoverdialog.h" |
13544 | cbradney | 232 | #include "ui/replacecolors.h" |
19821 | craig | 233 | #include "ui/resourcemanager.h" |
13650 | cbradney | 234 | #include "ui/sccombobox.h" |
17735 | craig | 235 | #include "ui/scfilewidget.h" |
13576 | cbradney | 236 | #include "ui/scmessagebox.h" |
19093 | craig | 237 | #include "ui/scmwmenumanager.h" |
13551 | cbradney | 238 | #include "ui/scrapbookpalette.h" |
19093 | craig | 239 | #include "ui/scrspinbox.h" |
240 | #include "ui/search.h" |
||
16546 | jghali | 241 | #include "ui/selectobjects.h" |
16856 | craig | 242 | #include "ui/smcellstyle.h" |
13544 | cbradney | 243 | #include "ui/smlinestyle.h" |
16856 | craig | 244 | #include "ui/smtablestyle.h" |
13544 | cbradney | 245 | #include "ui/smtextstyles.h" |
13551 | cbradney | 246 | #include "ui/splash.h" |
13576 | cbradney | 247 | #include "ui/storyeditor.h" |
13544 | cbradney | 248 | #include "ui/stylemanager.h" |
15060 | fschmid | 249 | #include "ui/symbolpalette.h" |
13544 | cbradney | 250 | #include "ui/tabmanager.h" |
21575 | craig | 251 | #include "ui/textpalette.h" |
15309 | cbradney | 252 | #include "ui/transformdialog.h" |
16034 | fschmid | 253 | #include "ui/transparencypalette.h" |
19009 | craig | 254 | #include "ui/viewtoolbar.h" |
19093 | craig | 255 | #include "ui/vruler.h" |
256 | #include "ui_nftdialog.h" |
||
10212 | cbradney | 257 | #include "undogui.h" |
258 | #include "undomanager.h" |
||
259 | #include "undostate.h" |
||
260 | #include "units.h" |
||
10311 | cbradney | 261 | #include "urllauncher.h" |
5184 | avox | 262 | #include "util.h" |
19917 | fschmid | 263 | #include "util_file.h" |
10212 | cbradney | 264 | #include "util_formats.h" |
265 | #include "util_ghostscript.h" |
||
14170 | jghali | 266 | #include "util_math.h" |
134 | Franz | 267 | |
21553 | craig | 268 | #ifdef HAVE_SVNVERSION |
269 | #include "svnversion.h" |
||
270 | #endif |
||
19093 | craig | 271 | |
272 | #ifdef HAVE_OSG |
||
273 | #include "ui/osgeditor.h" |
||
274 | #include <osgDB/ReaderWriter> |
||
275 | #include <osgDB/PluginQuery> |
||
276 | #endif |
||
277 | |||
4361 | cbradney | 278 | #if defined(_WIN32) |
5178 | mrdocs | 279 | #include "scdocoutput_ps2.h" |
10967 | jghali | 280 | #include "scprintengine_gdi.h" |
4361 | cbradney | 281 | #endif |
282 | |||
15023 | jghali | 283 | #include "sclimits.h" |
284 | |||
3 | paul | 285 | using namespace std; |
286 | |||
3234 | fschmid | 287 | bool previewDinUse; |
288 | bool printDinUse; |
||
2891 | cbradney | 289 | |
3 | paul | 290 | QString DocDir; |
3205 | craig | 291 | |
10532 | avox | 292 | |
22639 | craig | 293 | //extern ScribusQApp* ScQApp; |
2634 | cbradney | 294 | extern bool emergencyActivated; |
3 | paul | 295 | |
10532 | avox | 296 | |
4026 | craig | 297 | ScribusMainWindow::ScribusMainWindow() |
2161 | cbradney | 298 | { |
22561 | craig | 299 | actionManager=nullptr; |
300 | appModeHelper=nullptr; |
||
301 | scrMenuMgr=nullptr; |
||
302 | m_prefsManager=nullptr; |
||
303 | m_formatsManager=nullptr; |
||
304 | resourceManager=nullptr; |
||
10311 | cbradney | 305 | UrlLauncher::instance(); |
22561 | craig | 306 | m_mainWindowStatusLabel=nullptr; |
20691 | craig | 307 | m_ScriptRunning = 0; |
18204 | fschmid | 308 | #ifdef Q_OS_MAC |
19839 | craig | 309 | //commenting this out until this is resolved :https://bugreports.qt.io/browse/QTBUG-44565 |
310 | //ScQApp->setAttribute(Qt::AA_DontShowIconsInMenus); |
||
21740 | craig | 311 | //noIcon = IconManager::instance()->loadPixmap("noicon.png"); |
3580 | avox | 312 | #endif |
22561 | craig | 313 | m_doc = nullptr; |
314 | m_tocGenerator = nullptr; |
||
10625 | cbradney | 315 | } |
188 | Franz | 316 | |
11158 | avox | 317 | /* |
767 | cbradney | 318 | * retval 0 - ok, 1 - no fonts, ... |
319 | */ |
||
5243 | cbradney | 320 | int ScribusMainWindow::initScMW(bool primaryMainWindow) |
188 | Franz | 321 | { |
767 | cbradney | 322 | int retVal=0; |
17407 | fschmid | 323 | qsrand(1234); |
9909 | avox | 324 | QByteArray stylesheet; |
21526 | craig | 325 | if (loadRawText(ScPaths::preferencesDir() + "/stylesheet.css", stylesheet)) |
9909 | avox | 326 | { |
327 | qApp->setStyleSheet(QString(stylesheet)); |
||
328 | } |
||
10953 | subik | 329 | |
21087 | jghali | 330 | qApp->setLayoutDirection(QLocale(ScCore->getGuiLanguage()).textDirection()); |
3234 | fschmid | 331 | previewDinUse = false; |
332 | printDinUse = false; |
||
9721 | fschmid | 333 | internalCopy = false; |
17016 | fschmid | 334 | internalCopyBuffer = ""; |
16016 | fschmid | 335 | m_doc = new ScribusDoc(); |
336 | m_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom"); |
||
337 | m_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false); |
||
338 | m_doc->addPage(0); |
||
22561 | craig | 339 | m_doc->setGUI(false, this, nullptr); |
22516 | craig | 340 | CurrStED = nullptr; |
21553 | craig | 341 | QString scribusTitle(tr("Scribus") + " " + QString(VERSION)); |
342 | #if defined(HAVE_SVNVERSION) && defined(SVNVERSION) |
||
21554 | craig | 343 | if (QString(VERSION).contains("svn", Qt::CaseInsensitive)) |
21673 | craig | 344 | scribusTitle.append(QString(" (r%1)").arg(SVNVERSION)); |
21553 | craig | 345 | #endif |
346 | setWindowTitle(scribusTitle); |
||
10564 | fschmid | 347 | setAttribute(Qt::WA_KeyCompression, false); |
16546 | jghali | 348 | setAttribute(Qt::WA_InputMethodEnabled, true); |
20185 | craig | 349 | setWindowIcon(IconManager::instance()->loadIcon("AppIcon.png")); |
16612 | fschmid | 350 | setObjectName("MainWindow"); |
1325 | cbradney | 351 | scrActionGroups.clear(); |
1208 | cbradney | 352 | scrActions.clear(); |
353 | scrRecentFileActions.clear(); |
||
5800 | fschmid | 354 | scrRecentPasteActions.clear(); |
1260 | cbradney | 355 | scrWindowsActions.clear(); |
2408 | cbradney | 356 | scrLayersActions.clear(); |
15516 | fschmid | 357 | scrScrapActions.clear(); |
18533 | craig | 358 | actionManager = new ActionManager(this); |
19495 | craig | 359 | appModeHelper = new AppModeHelper(); |
19509 | craig | 360 | appModeHelper->setup(actionManager, &scrActions, &scrRecentFileActions, &scrWindowsActions, &scrScrapActions, &scrLayersActions, &scrRecentPasteActions); |
18533 | craig | 361 | scrMenuMgr = new ScMWMenuManager(menuBar(), actionManager); |
20691 | craig | 362 | m_prefsManager = PrefsManager::instance(); |
363 | m_formatsManager = FormatsManager::instance(); |
||
364 | m_objectSpecificUndo = false; |
||
7087 | subik | 365 | |
20691 | craig | 366 | m_undoManager = UndoManager::instance(); |
367 | PrefsContext *undoPrefs = m_prefsManager->prefsFile->getContext("undo"); |
||
368 | m_undoManager->setUndoEnabled(undoPrefs->getBool("enabled", true)); |
||
369 | m_tocGenerator = new TOCGenerator(); |
||
17826 | craig | 370 | m_marksCount = 0; |
4510 | subik | 371 | |
1780 | cbradney | 372 | initDefaultValues(); |
272 | Franz | 373 | initStatusBar(); |
7087 | subik | 374 | |
490 | cbradney | 375 | qApp->processEvents(); |
675 | cbradney | 376 | |
22076 | jghali | 377 | actionManager->init(this); |
18533 | craig | 378 | |
22076 | jghali | 379 | initMdiArea(); |
11174 | fschmid | 380 | initMenuBar(); |
18548 | craig | 381 | createMenuBar(); |
11174 | fschmid | 382 | initToolBars(); |
18438 | craig | 383 | ScCore->pluginManager->setupPluginActions(this); |
14509 | cbradney | 384 | ScCore->pluginManager->enableOnlyStartupPluginActions(this); |
18438 | craig | 385 | ScCore->pluginManager->languageChange(); |
18548 | craig | 386 | |
10977 | cbradney | 387 | if (primaryMainWindow) |
388 | ScCore->setSplashStatus( tr("Applying User Shortcuts") ); |
||
20691 | craig | 389 | m_prefsManager->applyLoadedShortCuts(); |
10977 | cbradney | 390 | initKeyboardShortcuts(); |
11960 | subik | 391 | |
5243 | cbradney | 392 | resize(610, 600); |
22607 | craig | 393 | connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(newActWin(QMdiSubWindow*))); |
13959 | jghali | 394 | //Connect windows cascade and tile actions to the workspace after its created. Only depends on mdiArea created. |
395 | connect( scrActions["windowsCascade"], SIGNAL(triggered()) , mdiArea, SLOT(cascadeSubWindows()) ); |
||
396 | connect( scrActions["windowsTile"], SIGNAL(triggered()) , mdiArea, SLOT(tileSubWindows()) ); |
||
5243 | cbradney | 397 | initPalettes(); |
7087 | subik | 398 | |
20691 | craig | 399 | m_prefsManager->setupMainWindow(this); |
770 | cbradney | 400 | |
20691 | craig | 401 | viewToolBar->previewQualitySwitcher->setCurrentIndex(m_prefsManager->appPrefs.itemToolPrefs.imageLowResType); |
5243 | cbradney | 402 | if (primaryMainWindow) |
403 | ScCore->setSplashStatus( tr("Initializing Story Editor") ); |
||
404 | storyEditor = new StoryEditor(this); |
||
770 | cbradney | 405 | |
20691 | craig | 406 | DocDir = m_prefsManager->documentDir(); |
1485 | tsoots | 407 | |
5243 | cbradney | 408 | if (primaryMainWindow) |
17798 | craig | 409 | ScCore->setSplashStatus( tr("Initializing Languages") ); |
410 | LanguageManager::instance(); |
||
411 | |||
5800 | fschmid | 412 | initHyphenator(); |
21563 | jghali | 413 | // QString preLang(m_prefsManager->appPrefs.hyphPrefs.Language); |
414 | // if (!LanguageManager::instance()->getHyphFilename( preLang ).isEmpty() ) |
||
415 | // m_prefsManager->appPrefs.hyphPrefs.Language = preLang; |
||
5800 | fschmid | 416 | if (primaryMainWindow) |
417 | ScCore->setSplashStatus( tr("Reading Scrapbook") ); |
||
418 | initScrapbook(); |
||
419 | |||
20691 | craig | 420 | scrActions["helpTooltips"]->setChecked(m_prefsManager->appPrefs.displayPrefs.showToolTips); |
421 | scrActions["showMouseCoordinates"]->setChecked(m_prefsManager->appPrefs.displayPrefs.showMouseCoordinates); |
||
422 | scrActions["stickyTools"]->setChecked(m_prefsManager->appPrefs.uiPrefs.stickyTools); |
||
5800 | fschmid | 423 | ToggleTips(); |
12754 | fschmid | 424 | ToggleMouseTips(); |
5800 | fschmid | 425 | propertiesPalette->setFontSize(); |
21587 | craig | 426 | textPalette->setFontSize(); |
6451 | fschmid | 427 | if (scrActions["SaveAsDocumentTemplate"]) |
428 | scrActions["SaveAsDocumentTemplate"]->setEnabled(false); |
||
7087 | subik | 429 | |
22561 | craig | 430 | connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString)), this, SLOT(removeRecentFromWatcher(QString))); |
5800 | fschmid | 431 | connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange())); |
432 | setAcceptDrops(true); |
||
9562 | fschmid | 433 | QCoreApplication::instance()->installEventFilter(this); |
12846 | fschmid | 434 | scrActions["toolsSelect"]->setChecked(true); |
16016 | fschmid | 435 | ColorSetManager csm; |
436 | csm.findPaletteLocations(); |
||
437 | csm.findPalettes(); |
||
438 | csm.findUserPalettes(); |
||
21526 | craig | 439 | QString Cpfad = QDir::toNativeSeparators(ScPaths::applicationDataDir())+"DefaultColors.xml"; |
16016 | fschmid | 440 | QFile fc(Cpfad); |
441 | if (fc.exists()) |
||
20691 | craig | 442 | csm.loadPalette(Cpfad, m_doc, m_prefsManager->appPrefs.colorPrefs.DColors, m_prefsManager->appPrefs.defaultGradients, m_prefsManager->appPrefs.defaultPatterns, false); |
16016 | fschmid | 443 | else |
444 | { |
||
20691 | craig | 445 | if (m_prefsManager->appPrefs.colorPrefs.DColorSet != "Scribus Small") |
16016 | fschmid | 446 | { |
447 | QStringList CustomColorSets = csm.userPaletteNames(); |
||
20691 | craig | 448 | if (CustomColorSets.contains(m_prefsManager->appPrefs.colorPrefs.DColorSet)) |
449 | Cpfad = csm.userPaletteFileFromName(m_prefsManager->appPrefs.colorPrefs.DColorSet); |
||
16016 | fschmid | 450 | else |
20691 | craig | 451 | Cpfad = csm.paletteFileFromName(m_prefsManager->appPrefs.colorPrefs.DColorSet); |
18562 | jghali | 452 | if (!Cpfad.isEmpty()) |
20691 | craig | 453 | csm.loadPalette(Cpfad, m_doc, m_prefsManager->appPrefs.colorPrefs.DColors, m_prefsManager->appPrefs.defaultGradients, m_prefsManager->appPrefs.defaultPatterns, false); |
16016 | fschmid | 454 | } |
455 | } |
||
19509 | craig | 456 | appModeHelper->setStartupActionsEnabled(false); |
18556 | craig | 457 | |
20196 | craig | 458 | setStyleSheet(); |
459 | |||
5800 | fschmid | 460 | return retVal; |
461 | } |
||
462 | |||
10532 | avox | 463 | |
5800 | fschmid | 464 | ScribusMainWindow::~ScribusMainWindow() |
465 | { |
||
22607 | craig | 466 | delete actionManager; |
467 | delete appModeHelper; |
||
468 | delete m_doc; |
||
469 | delete m_tocGenerator; |
||
5800 | fschmid | 470 | } |
471 | |||
22635 | craig | 472 | void ScribusMainWindow::addScToolBar(ScToolBar *tb, const QString & name) |
11040 | fschmid | 473 | { |
474 | if (!scrToolBars.contains(name)) |
||
475 | scrToolBars.insert(name, tb); |
||
476 | addToolBar(tb); |
||
477 | } |
||
5800 | fschmid | 478 | |
479 | void ScribusMainWindow::initToolBars() |
||
480 | { |
||
10976 | cbradney | 481 | fileToolBar = new FileToolBar(this); |
482 | editToolBar = new EditToolBar(this); |
||
5800 | fschmid | 483 | UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget"); |
20691 | craig | 484 | m_undoManager->registerGui(uWidget); |
10976 | cbradney | 485 | modeToolBar = new ModeToolBar(this); |
5800 | fschmid | 486 | pdfToolBar = new PDFToolBar(this); |
19009 | craig | 487 | viewToolBar = new ViewToolBar(this); |
10953 | subik | 488 | |
15260 | cbradney | 489 | addScToolBar(fileToolBar, fileToolBar->objectName()); |
490 | addScToolBar(editToolBar, editToolBar->objectName()); |
||
491 | addScToolBar(modeToolBar, modeToolBar->objectName()); |
||
492 | addScToolBar(pdfToolBar, pdfToolBar->objectName()); |
||
19009 | craig | 493 | addScToolBar(viewToolBar, viewToolBar->objectName()); |
10976 | cbradney | 494 | connect(modeToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarTools"], SLOT(setChecked(bool))); |
10734 | jghali | 495 | connect(scrActions["toolsToolbarPDF"], SIGNAL(toggled(bool)), pdfToolBar, SLOT(setVisible(bool))); |
10969 | subik | 496 | connect(pdfToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarPDF"], SLOT(setChecked(bool))); |
10976 | cbradney | 497 | connect(scrActions["toolsToolbarTools"], SIGNAL(toggled(bool)), modeToolBar, SLOT(setVisible(bool)) ); |
19009 | craig | 498 | connect(viewToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarView"], SLOT(setChecked(bool))); |
499 | connect(scrActions["toolsToolbarView"], SIGNAL(toggled(bool)), viewToolBar, SLOT(setVisible(bool)) ); |
||
5800 | fschmid | 500 | } |
501 | |||
20196 | craig | 502 | void ScribusMainWindow::setStyleSheet() |
503 | { |
||
504 | QByteArray stylesheet; |
||
505 | if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet)) |
||
506 | { |
||
507 | QString downArrow(IconManager::instance()->pathForIcon("16/go-down.png")); |
||
508 | QByteArray da; |
||
509 | da.append(downArrow); |
||
510 | stylesheet.replace("___downArrow___", da); |
||
511 | QString toolbararrow(IconManager::instance()->pathForIcon("stylesheet/down_arrow.png")); |
||
512 | QByteArray tba; |
||
513 | tba.append(toolbararrow); |
||
514 | stylesheet.replace("___tb_menu_arrow___", tba); |
||
515 | } |
||
10532 | avox | 516 | |
20196 | craig | 517 | layerMenu->setStyleSheet(stylesheet); |
518 | unitSwitcher->setStyleSheet(stylesheet); |
||
519 | zoomDefaultToolbarButton->setStyleSheet(stylesheet); |
||
520 | zoomInToolbarButton->setStyleSheet(stylesheet); |
||
521 | zoomOutToolbarButton->setStyleSheet(stylesheet); |
||
522 | zoomSpinBox->setStyleSheet(stylesheet); |
||
523 | |||
524 | fileToolBar->setStyleSheet(stylesheet); |
||
525 | editToolBar->setStyleSheet(stylesheet); |
||
526 | modeToolBar->setStyleSheet(stylesheet); |
||
527 | pdfToolBar->setStyleSheet(stylesheet); |
||
528 | viewToolBar->setStyleSheet(stylesheet); |
||
529 | } |
||
530 | |||
531 | |||
5800 | fschmid | 532 | void ScribusMainWindow::initDefaultValues() |
533 | { |
||
534 | HaveDoc = false; |
||
22516 | craig | 535 | view = nullptr; |
536 | doc = nullptr; |
||
20691 | craig | 537 | m_DocNr = 1; |
538 | m_PrinterUsed = false; |
||
5800 | fschmid | 539 | PDef.Pname = ""; |
540 | PDef.Dname = ""; |
||
541 | PDef.Command = ""; |
||
20691 | craig | 542 | m_keyrep = false; |
543 | m__arrowKeyDown = false; |
||
5800 | fschmid | 544 | ClipB = QApplication::clipboard(); |
22067 | jghali | 545 | for (int i=0; i<PAL_MAX ; ++i) |
20691 | craig | 546 | m_palettesStatus[i] = false; |
19853 | craig | 547 | for (int i=0; i<GS_MAX ; ++i) |
20691 | craig | 548 | m_guidesStatus[i] = false; |
17781 | fschmid | 549 | #ifdef HAVE_OSG |
18207 | fschmid | 550 | QStringList supportedExts; |
551 | supportedExts << "osg" << "dxf" << "flt" << "ive" << "geo" << "sta" << "stl" << "logo" << "3ds" << "ac" << "obj"; |
||
552 | QStringList realSupportedExts; |
||
553 | QMap<QString, QString> formats; |
||
554 | osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins(); |
||
22723 | jghali | 555 | for (osgDB::FileNameList::iterator itr = plugins.begin(); itr != plugins.end(); ++itr) |
18207 | fschmid | 556 | { |
557 | osgDB::ReaderWriterInfoList infoList; |
||
558 | if (QString::fromStdString(*itr).contains("qfont")) |
||
559 | continue; |
||
560 | if (osgDB::queryPlugin(*itr, infoList)) |
||
17781 | fschmid | 561 | { |
22509 | jghali | 562 | for (auto rwi_itr = infoList.begin(); rwi_itr != infoList.end(); ++rwi_itr) |
17781 | fschmid | 563 | { |
18207 | fschmid | 564 | osgDB::ReaderWriterInfo& info = *(*rwi_itr); |
565 | osgDB::ReaderWriter::FormatDescriptionMap::iterator fdm_itr; |
||
22723 | jghali | 566 | for (fdm_itr = info.extensions.begin(); fdm_itr != info.extensions.end(); ++fdm_itr) |
17781 | fschmid | 567 | { |
18207 | fschmid | 568 | if (supportedExts.contains(QString::fromStdString(fdm_itr->first))) |
569 | formats.insert("*." + QString::fromStdString(fdm_itr->first) + " *." + QString::fromStdString(fdm_itr->first).toUpper(), QString::fromStdString(fdm_itr->second) + " (*." + QString::fromStdString(fdm_itr->first) + " *." + QString::fromStdString(fdm_itr->first).toUpper() + ")"); |
||
17781 | fschmid | 570 | } |
571 | } |
||
572 | } |
||
18207 | fschmid | 573 | } |
574 | realSupportedExts = formats.keys(); |
||
575 | QString docexts = realSupportedExts.join(" "); |
||
576 | QStringList longList = formats.values(); |
||
577 | QString longDesc = longList.join(";;") + ";;"; |
||
20695 | craig | 578 | m_osgFilterString = tr("All Supported Formats (%1);;%2All Files (*)").arg(docexts).arg(longDesc); |
17781 | fschmid | 579 | #endif |
5800 | fschmid | 580 | } |
581 | |||
10532 | avox | 582 | |
5800 | fschmid | 583 | void ScribusMainWindow::initKeyboardShortcuts() |
584 | { |
||
22723 | jghali | 585 | for (auto it = scrActions.begin(); it!=scrActions.end(); ++it ) |
5800 | fschmid | 586 | { |
22723 | jghali | 587 | if ((ScrAction*)(it.value()) != nullptr) |
5800 | fschmid | 588 | { |
18194 | fschmid | 589 | QString accelerator = it.value()->shortcut().toString(); |
20691 | craig | 590 | m_prefsManager->setKeyEntry(it.key(), it.value()->cleanMenuText(), accelerator,0); |
5800 | fschmid | 591 | } |
592 | //else |
||
13085 | jghali | 593 | // qDebug() << it.key(); |
594 | //qDebug() << QString("|-\n|%1||%2||%3").arg(it.key()).arg(it.value()->cleanMenuText()).arg(QString(it.data()->accel())); |
||
5800 | fschmid | 595 | } |
596 | } |
||
597 | |||
10532 | avox | 598 | |
5800 | fschmid | 599 | void ScribusMainWindow::initPalettes() |
600 | { |
||
601 | //CB TODO hide the publicly available members of some palettes |
||
602 | // these must be filtered too as they take control of the palettes events |
||
10862 | cbradney | 603 | outlinePalette = new OutlinePalette(this); |
5800 | fschmid | 604 | outlinePalette->setMainWindow(this); |
22607 | craig | 605 | connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool))); |
10581 | cbradney | 606 | connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setChecked(bool))); |
16546 | jghali | 607 | |
10862 | cbradney | 608 | propertiesPalette = new PropertiesPalette(this); |
5800 | fschmid | 609 | propertiesPalette->setMainWindow(this); |
22607 | craig | 610 | connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool))); |
10581 | cbradney | 611 | connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setChecked(bool))); |
16546 | jghali | 612 | emit UpdateRequest(reqDefFontListUpdate); |
5800 | fschmid | 613 | propertiesPalette->installEventFilter(this); |
21575 | craig | 614 | |
615 | textPalette = new TextPalette(this); |
||
616 | textPalette->setMainWindow(this); |
||
22607 | craig | 617 | connect( scrActions["toolsText"], SIGNAL(toggled(bool)) , textPalette, SLOT(setPaletteShown(bool))); |
21575 | craig | 618 | connect( textPalette, SIGNAL(paletteShown(bool)), scrActions["toolsText"], SLOT(setChecked(bool))); |
619 | emit UpdateRequest(reqDefFontListUpdate); |
||
620 | textPalette->installEventFilter(this); |
||
5800 | fschmid | 621 | nodePalette = new NodePalette(this); |
622 | nodePalette->installEventFilter(this); |
||
623 | layerPalette = new LayerPalette(this); |
||
624 | guidePalette = new GuideManager(this); |
||
7087 | subik | 625 | charPalette = new CharSelect(this); |
22607 | craig | 626 | connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool))); |
10581 | cbradney | 627 | connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setChecked(bool))); |
5800 | fschmid | 628 | layerPalette->installEventFilter(this); |
629 | layerPalette->Table->installEventFilter(this); |
||
630 | scrapbookPalette = new Biblio(this); |
||
22607 | craig | 631 | connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool))); |
10581 | cbradney | 632 | connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setChecked(bool))); |
11554 | fschmid | 633 | connect( scrapbookPalette, SIGNAL(pasteToActualPage(QString)), this, SLOT(pasteFromScrapbook(QString))); |
18924 | craig | 634 | connect( scrapbookPalette, SIGNAL(scrapbookListChanged()), this, SLOT(rebuildScrapbookMenu())); |
5800 | fschmid | 635 | scrapbookPalette->installEventFilter(this); |
636 | pagePalette = new PagePalette(this); |
||
637 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 638 | connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setChecked(bool))); |
5800 | fschmid | 639 | pagePalette->installEventFilter(this); |
640 | bookmarkPalette = new BookPalette(this); |
||
641 | connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 642 | connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setChecked(bool))); |
5800 | fschmid | 643 | bookmarkPalette->installEventFilter(this); |
19783 | craig | 644 | downloadsPalette = new DownloadsPalette(this); |
645 | connect( scrActions["toolsDownloads"], SIGNAL(toggled(bool)) , downloadsPalette, SLOT(setPaletteShown(bool)) ); |
||
646 | connect( downloadsPalette, SIGNAL(paletteShown(bool)), scrActions["toolsDownloads"], SLOT(setChecked(bool))); |
||
647 | downloadsPalette->installEventFilter(this); |
||
22607 | craig | 648 | connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool,int)) , this, SLOT(setAppModeByToggle(bool,int)) ); |
5800 | fschmid | 649 | docCheckerPalette = new CheckDocument(this, false); |
650 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) ); |
||
651 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , this, SLOT(docCheckToggle(bool)) ); |
||
10581 | cbradney | 652 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setChecked(bool))); |
5800 | fschmid | 653 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool))); |
654 | docCheckerPalette->installEventFilter(this); |
||
655 | docCheckerPalette->hide(); |
||
656 | |||
18194 | fschmid | 657 | alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette"); |
5800 | fschmid | 658 | connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) ); |
10581 | cbradney | 659 | connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setChecked(bool))); |
5800 | fschmid | 660 | connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh())); |
661 | alignDistributePalette->installEventFilter(this); |
||
7087 | subik | 662 | |
15060 | fschmid | 663 | symbolPalette = new SymbolPalette(this); |
664 | symbolPalette->setMainWindow(this); |
||
16029 | fschmid | 665 | connect(scrActions["toolsSymbols"], SIGNAL(toggled(bool)), symbolPalette, SLOT(setPaletteShown(bool))); |
666 | connect(symbolPalette, SIGNAL(paletteShown(bool)), scrActions["toolsSymbols"], SLOT(setChecked(bool))); |
||
667 | connect(symbolPalette, SIGNAL(startEdit(QString)), this, SLOT(editSymbolStart(QString))); |
||
668 | connect(symbolPalette, SIGNAL(endEdit()), this, SLOT(editSymbolEnd())); |
||
17793 | fschmid | 669 | connect(symbolPalette, SIGNAL(objectDropped()), this, SLOT(PutToPatterns())); |
15060 | fschmid | 670 | symbolPalette->installEventFilter(this); |
671 | symbolPalette->hide(); |
||
17405 | fschmid | 672 | |
673 | inlinePalette = new InlinePalette(this); |
||
674 | inlinePalette->setMainWindow(this); |
||
675 | connect(scrActions["toolsInline"], SIGNAL(toggled(bool)), inlinePalette, SLOT(setPaletteShown(bool))); |
||
676 | connect(inlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsInline"], SLOT(setChecked(bool))); |
||
17410 | fschmid | 677 | connect(inlinePalette, SIGNAL(startEdit(int)), this, SLOT(editInlineStart(int))); |
678 | connect(inlinePalette, SIGNAL(endEdit()), this, SLOT(editInlineEnd())); |
||
17804 | fschmid | 679 | connect(inlinePalette, SIGNAL(objectDropped(QString)), this, SLOT(PutToInline(QString))); |
17405 | fschmid | 680 | inlinePalette->installEventFilter(this); |
681 | inlinePalette->hide(); |
||
15060 | fschmid | 682 | |
5800 | fschmid | 683 | undoPalette = new UndoPalette(this, "undoPalette"); |
684 | undoPalette->installEventFilter(this); |
||
20691 | craig | 685 | m_undoManager->registerGui(undoPalette); |
5800 | fschmid | 686 | connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); |
687 | connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); |
||
688 | |||
689 | // initializing style manager here too even it's not strictly a palette |
||
20691 | craig | 690 | m_styleManager = new StyleManager(this, "styleManager"); |
7063 | tsoots | 691 | SMCharacterStyle *tmpCS = new SMCharacterStyle(); |
21374 | jghali | 692 | m_styleManager->addStyle(new SMParagraphStyle(tmpCS)); |
20691 | craig | 693 | m_styleManager->addStyle(tmpCS); |
694 | m_styleManager->addStyle(new SMTableStyle()); |
||
695 | m_styleManager->addStyle(new SMCellStyle()); |
||
696 | m_styleManager->addStyle(new SMLineStyle()); |
||
697 | connect( scrActions["editStyles"], SIGNAL(toggled(bool)), m_styleManager, SLOT(setPaletteShown(bool)) ); |
||
698 | connect( m_styleManager, SIGNAL(paletteShown(bool)), scrActions["editStyles"], SLOT(setChecked(bool))); |
||
699 | m_styleManager->installEventFilter(this); |
||
5800 | fschmid | 700 | |
17826 | craig | 701 | // initializing mark`s manager |
702 | marksManager = new MarksManager(this, "marksManager"); |
||
703 | connect( scrActions["editMarks"], SIGNAL(toggled(bool)), marksManager, SLOT(setPaletteShown(bool)) ); |
||
704 | connect( marksManager, SIGNAL(paletteShown(bool)), scrActions["editMarks"], SLOT(setChecked(bool))); |
||
705 | marksManager->installEventFilter(this); |
||
706 | // initializing notes styles manager |
||
707 | nsEditor = new NotesStylesEditor(this, "notesStylesEditor"); |
||
708 | connect( scrActions["editNotesStyles"], SIGNAL(toggled(bool)), nsEditor, SLOT(setPaletteShown(bool)) ); |
||
709 | connect( nsEditor, SIGNAL(paletteShown(bool)), scrActions["editNotesStyles"], SLOT(setChecked(bool))); |
||
710 | nsEditor->installEventFilter(this); |
||
711 | |||
22607 | craig | 712 | connect(docCheckerPalette, SIGNAL(selectElementByItem(PageItem*,bool)), this, SLOT(selectItemsFromOutlines(PageItem*,bool))); |
713 | connect(docCheckerPalette, SIGNAL(selectElement(PageItem*,bool,int)), this, SLOT(selectItemFromOutlines(PageItem*,bool,int))); |
||
5800 | fschmid | 714 | connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
18888 | craig | 715 | connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(editMasterPagesStart(QString))); |
22607 | craig | 716 | connect(outlinePalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem*,bool))); |
16999 | fschmid | 717 | connect(outlinePalette, SIGNAL(editElementByItem(PageItem *)), this, SLOT(editItemsFromOutlines(PageItem *))); |
5800 | fschmid | 718 | connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
18888 | craig | 719 | connect(outlinePalette, SIGNAL(selectMasterPage(QString)), this, SLOT(editMasterPagesStart(QString))); |
16546 | jghali | 720 | connect(nodePalette, SIGNAL(paletteClosed()), this, SLOT(slotSelect())); |
5800 | fschmid | 721 | connect(nodePalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
722 | connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
||
723 | |||
22396 | jghali | 724 | connect(bookmarkPalette->BView, SIGNAL(markMoved()), this, SLOT(StoreBookmarks())); |
5800 | fschmid | 725 | connect(bookmarkPalette->BView, SIGNAL(changed()), this, SLOT(slotDocCh())); |
22396 | jghali | 726 | connect(bookmarkPalette->BView, SIGNAL(selectElement(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); |
5800 | fschmid | 727 | // guides |
728 | connect(scrActions["pageManageGuides"], SIGNAL(toggled(bool)), guidePalette, SLOT(setPaletteShown(bool))); |
||
10581 | cbradney | 729 | connect(guidePalette, SIGNAL(paletteShown(bool)), scrActions["pageManageGuides"], SLOT(setChecked(bool))); |
7087 | subik | 730 | // char palette |
731 | connect(scrActions["insertGlyph"], SIGNAL(toggled(bool)), charPalette, SLOT(setPaletteShown(bool))); |
||
10581 | cbradney | 732 | connect(charPalette, SIGNAL(paletteShown(bool)), scrActions["insertGlyph"], SLOT(setChecked(bool))); |
5800 | fschmid | 733 | } |
734 | |||
10532 | avox | 735 | |
5800 | fschmid | 736 | void ScribusMainWindow::initScrapbook() |
737 | { |
||
20691 | craig | 738 | QString scrapbookFileO = QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrap13.scs"); |
5800 | fschmid | 739 | QFileInfo scrapbookFileInfoO = QFileInfo(scrapbookFileO); |
740 | if (scrapbookFileInfoO.exists()) |
||
741 | { |
||
21591 | jghali | 742 | scrapbookPalette->readOldContents(scrapbookFileO, ScPaths::scrapbookDir(true) + "main"); |
5800 | fschmid | 743 | QDir d = QDir(); |
20691 | craig | 744 | d.rename(scrapbookFileO, QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrap13.backup")); |
5800 | fschmid | 745 | } |
21591 | jghali | 746 | QString scrapbookTemp = QDir::toNativeSeparators(ScPaths::scrapbookDir(true) + "tmp"); |
5800 | fschmid | 747 | QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp); |
748 | if (scrapbookTempInfo.exists()) |
||
749 | scrapbookPalette->readTempContents(scrapbookTemp); |
||
21591 | jghali | 750 | QString scrapbookFile = QDir::toNativeSeparators(ScPaths::scrapbookDir(true) + "main"); |
5800 | fschmid | 751 | QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile); |
752 | if (scrapbookFileInfo.exists()) |
||
753 | scrapbookPalette->readContents(scrapbookFile); |
||
754 | scrapbookPalette->setScrapbookFileName(scrapbookFile); |
||
15527 | fschmid | 755 | ScCore->fileWatcher->addDir(scrapbookFile, true); |
20691 | craig | 756 | scrapbookPalette->setOpenScrapbooks(m_prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks); |
5800 | fschmid | 757 | rebuildRecentPasteMenu(); |
5806 | fschmid | 758 | connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu())); |
15526 | fschmid | 759 | connect(ScCore->fileWatcher, SIGNAL(dirChanged(QString )), scrapbookPalette, SLOT(reloadLib(QString ))); |
15527 | fschmid | 760 | connect(ScCore->fileWatcher, SIGNAL(dirDeleted(QString )), scrapbookPalette, SLOT(closeOnDel(QString ))); |
5800 | fschmid | 761 | } |
762 | |||
763 | bool ScribusMainWindow::warningVersion(QWidget *parent) |
||
764 | { |
||
765 | bool retval = false; |
||
19605 | jghali | 766 | int t = ScMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" + |
17948 | jghali | 767 | QObject::tr("You are running a development version of Scribus 1.5.x. The document you are working with was created in Scribus 1.2.x. Saving the current file under 1.5.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>", |
19605 | jghali | 768 | QMessageBox::Ok | QMessageBox::Cancel, |
769 | QMessageBox::Cancel, // GUI default |
||
770 | QMessageBox::Ok); // batch default |
||
9422 | fschmid | 771 | if (t == QMessageBox::Ok) |
5800 | fschmid | 772 | retval = true; |
773 | return retval; |
||
774 | } |
||
775 | |||
22076 | jghali | 776 | void ScribusMainWindow::initMdiArea() |
777 | { |
||
778 | mdiArea = new QMdiArea(this); |
||
779 | mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
||
780 | mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
||
781 | if (m_prefsManager->appPrefs.uiPrefs.useTabs) |
||
782 | { |
||
783 | mdiArea->setViewMode(QMdiArea::TabbedView); |
||
784 | mdiArea->setTabsClosable(true); |
||
785 | mdiArea->setDocumentMode(true); |
||
786 | } |
||
787 | else |
||
788 | mdiArea->setViewMode(QMdiArea::SubWindowView); |
||
789 | setCentralWidget(mdiArea); |
||
790 | } |
||
10532 | avox | 791 | |
5800 | fschmid | 792 | void ScribusMainWindow::initMenuBar() |
793 | { |
||
22700 | craig | 794 | m_recentDocsList.clear(); |
12940 | cbradney | 795 | scrMenuMgr->createMenu("File", ActionManager::defaultMenuNameEntryTranslated("File")); |
18533 | craig | 796 | scrMenuMgr->addMenuItemString("fileNew", "File"); |
797 | scrMenuMgr->addMenuItemString("fileNewFromTemplate", "File"); |
||
798 | scrMenuMgr->addMenuItemString("fileOpen", "File"); |
||
799 | scrMenuMgr->addMenuItemString("FileOpenRecent", "File"); |
||
18583 | craig | 800 | scrMenuMgr->createMenu("FileOpenRecent", tr("Open &Recent"), "File", false, true); |
18533 | craig | 801 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
802 | scrMenuMgr->addMenuItemString("fileClose", "File"); |
||
803 | scrMenuMgr->addMenuItemString("fileSave", "File"); |
||
804 | scrMenuMgr->addMenuItemString("fileSaveAs", "File"); |
||
805 | scrMenuMgr->addMenuItemString("fileRevert", "File"); |
||
806 | scrMenuMgr->addMenuItemString("fileCollect", "File"); |
||
807 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
||
10558 | cbradney | 808 | scrMenuMgr->createMenu("FileImport", tr("&Import"), "File"); |
18533 | craig | 809 | scrMenuMgr->addMenuItemString("FileImport", "File"); |
810 | scrMenuMgr->addMenuItemString("fileImportText", "FileImport"); |
||
811 | scrMenuMgr->addMenuItemString("fileImportAppendText", "FileImport"); |
||
812 | scrMenuMgr->addMenuItemString("fileImportImage", "FileImport"); |
||
813 | scrMenuMgr->addMenuItemString("fileImportVector", "FileImport"); |
||
814 | scrMenuMgr->addMenuItemString("FileExport", "File"); |
||
10558 | cbradney | 815 | scrMenuMgr->createMenu("FileExport", tr("&Export"), "File"); |
18533 | craig | 816 | scrMenuMgr->addMenuItemString("fileExportText", "FileExport"); |
817 | scrMenuMgr->addMenuItemString("fileExportAsEPS", "FileExport"); |
||
818 | scrMenuMgr->addMenuItemString("fileExportAsPDF", "FileExport"); |
||
819 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
||
820 | scrMenuMgr->addMenuItemString("fileDocSetup150", "File"); |
||
821 | scrMenuMgr->addMenuItemString("filePreferences150", "File"); |
||
822 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
||
823 | scrMenuMgr->addMenuItemString("filePrint", "File"); |
||
19179 | craig | 824 | if ( ScCore->haveGS() || ScCore->isWinGUI() ) |
825 | scrMenuMgr->addMenuItemString("PrintPreview", "File"); |
||
18533 | craig | 826 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
827 | scrMenuMgr->addMenuItemString("fileQuit", "File"); |
||
5800 | fschmid | 828 | |
6451 | fschmid | 829 | scrMenuMgr->setMenuEnabled("FileImport", false); |
5800 | fschmid | 830 | scrMenuMgr->setMenuEnabled("FileExport", false); |
831 | |||
12940 | cbradney | 832 | scrMenuMgr->createMenu("Edit", ActionManager::defaultMenuNameEntryTranslated("Edit")); |
18533 | craig | 833 | scrMenuMgr->addMenuItemString("editUndoAction", "Edit"); |
834 | scrMenuMgr->addMenuItemString("editRedoAction", "Edit"); |
||
835 | scrMenuMgr->addMenuItemString("editActionMode", "Edit"); |
||
836 | scrMenuMgr->addMenuItemString("SEPARATOR", "Edit"); |
||
837 | scrMenuMgr->addMenuItemString("editCut", "Edit"); |
||
838 | scrMenuMgr->addMenuItemString("editCopy", "Edit"); |
||
839 | scrMenuMgr->addMenuItemString("editPaste", "Edit"); |
||
18583 | craig | 840 | scrMenuMgr->createMenu("EditPasteRecent", tr("Paste Recent"), "Edit",false,true); |
10558 | cbradney | 841 | scrMenuMgr->createMenu("EditContents", tr("Contents"), "Edit"); |
18533 | craig | 842 | scrMenuMgr->addMenuItemString("editCopyContents", "EditContents"); |
843 | scrMenuMgr->addMenuItemString("editPasteContents", "EditContents"); |
||
844 | scrMenuMgr->addMenuItemString("editPasteContentsAbs", "EditContents"); |
||
845 | scrMenuMgr->addMenuItemString("editClearContents", "EditContents"); |
||
19188 | craig | 846 | scrMenuMgr->addMenuItemString("editTruncateContents", "EditTruncateContents"); |
18533 | craig | 847 | scrMenuMgr->addMenuItemString("itemDelete", "Edit"); |
848 | scrMenuMgr->addMenuItemString("SEPARATOR", "Edit"); |
||
849 | scrMenuMgr->addMenuItemString("editSelectAll", "Edit"); |
||
850 | scrMenuMgr->addMenuItemString("editSelectAllOnLayer", "Edit"); |
||
851 | scrMenuMgr->addMenuItemString("editDeselectAll", "Edit"); |
||
852 | scrMenuMgr->addMenuItemString("SEPARATOR", "Edit"); |
||
853 | scrMenuMgr->addMenuItemString("editSearchReplace", "Edit"); |
||
854 | scrMenuMgr->addMenuItemString("toolsEditWithStoryEditor", "Edit"); |
||
855 | scrMenuMgr->addMenuItemString("editEditWithImageEditor", "Edit"); |
||
856 | scrMenuMgr->addMenuItemString("editEditRenderSource", "Edit"); |
||
857 | scrMenuMgr->addMenuItemString("SEPARATOR", "Edit"); |
||
21928 | craig | 858 | scrMenuMgr->addMenuItemString("editColorsAndFills", "Edit"); |
18533 | craig | 859 | scrMenuMgr->addMenuItemString("editReplaceColors", "Edit"); |
860 | scrMenuMgr->addMenuItemString("editStyles", "Edit"); |
||
861 | scrMenuMgr->addMenuItemString("editMarks", "Edit"); |
||
862 | scrMenuMgr->addMenuItemString("editNotesStyles", "Edit"); |
||
863 | scrMenuMgr->addMenuItemString("editMasterPages", "Edit"); |
||
864 | scrMenuMgr->addMenuItemString("editJavascripts", "Edit"); |
||
5827 | fschmid | 865 | scrMenuMgr->setMenuEnabled("EditPasteRecent", false); |
7565 | cbradney | 866 | scrMenuMgr->setMenuEnabled("EditContents", false); |
5800 | fschmid | 867 | |
18756 | craig | 868 | |
5800 | fschmid | 869 | //Item Menu |
12940 | cbradney | 870 | scrMenuMgr->createMenu("Item", ActionManager::defaultMenuNameEntryTranslated("Item")); |
18070 | fschmid | 871 | scrMenuMgr->createMenu("DuplicateTransform", tr("Duplicate/Transform"), "Item"); |
18533 | craig | 872 | scrMenuMgr->addMenuItemString("DuplicateTransform", "Item"); |
873 | scrMenuMgr->addMenuItemString("itemDuplicate", "DuplicateTransform"); |
||
874 | scrMenuMgr->addMenuItemString("itemMulDuplicate", "DuplicateTransform"); |
||
875 | scrMenuMgr->addMenuItemString("itemTransform", "DuplicateTransform"); |
||
18070 | fschmid | 876 | scrMenuMgr->createMenu("Grouping", tr("Grouping"), "Item"); |
18533 | craig | 877 | scrMenuMgr->addMenuItemString("Grouping", "Item"); |
878 | scrMenuMgr->addMenuItemString("itemGroup", "Grouping"); |
||
879 | scrMenuMgr->addMenuItemString("itemUngroup", "Grouping"); |
||
880 | scrMenuMgr->addMenuItemString("itemGroupAdjust", "Grouping"); |
||
18070 | fschmid | 881 | scrMenuMgr->createMenu("Locking", tr("Locking"), "Item"); |
18533 | craig | 882 | scrMenuMgr->addMenuItemString("Locking", "Item"); |
883 | scrMenuMgr->addMenuItemString("itemLock", "Locking"); |
||
884 | scrMenuMgr->addMenuItemString("itemLockSize", "Locking"); |
||
18070 | fschmid | 885 | scrMenuMgr->createMenu("ItemLevel", tr("Level"), "Item"); |
18533 | craig | 886 | scrMenuMgr->addMenuItemString("ItemLevel", "Item"); |
18547 | craig | 887 | scrMenuMgr->addMenuItemString("itemRaise", "ItemLevel"); |
888 | scrMenuMgr->addMenuItemString("itemLower", "ItemLevel"); |
||
889 | scrMenuMgr->addMenuItemString("itemRaiseToTop", "ItemLevel"); |
||
890 | scrMenuMgr->addMenuItemString("itemLowerToBottom", "ItemLevel"); |
||
18583 | craig | 891 | scrMenuMgr->createMenu("ItemLayer", tr("Send to La&yer"), "",false, true); |
18533 | craig | 892 | scrMenuMgr->addMenuItemString("ItemLayer", "Item"); |
18070 | fschmid | 893 | scrMenuMgr->createMenu("SendTo", tr("Send to"), "Item"); |
18533 | craig | 894 | scrMenuMgr->addMenuItemString("SendTo", "Item"); |
18582 | craig | 895 | scrMenuMgr->createMenu("ItemSendToScrapbook", tr("Scrapbook"),"",false,true); |
18539 | craig | 896 | scrMenuMgr->addMenuItemString("ItemSendToScrapbook", "SendTo"); |
18533 | craig | 897 | scrMenuMgr->addMenuItemString("itemSendToPattern", "SendTo"); |
898 | scrMenuMgr->addMenuItemString("itemSendToInline", "SendTo"); |
||
18070 | fschmid | 899 | scrMenuMgr->createMenu("Adjust", tr("Adjust"), "Item"); |
18533 | craig | 900 | scrMenuMgr->addMenuItemString("Adjust", "Item"); |
901 | scrMenuMgr->addMenuItemString("itemAdjustFrameHeightToText", "Adjust"); |
||
902 | scrMenuMgr->addMenuItemString("itemAdjustFrameToImage", "Adjust"); |
||
903 | scrMenuMgr->addMenuItemString("itemAdjustImageToFrame", "Adjust"); |
||
18070 | fschmid | 904 | scrMenuMgr->createMenu("Image", tr("Image"), "Item"); |
18533 | craig | 905 | scrMenuMgr->addMenuItemString("Image", "Item"); |
906 | scrMenuMgr->addMenuItemString("itemUpdateImage", "Image"); |
||
907 | scrMenuMgr->addMenuItemString("styleImageEffects", "Image"); |
||
908 | scrMenuMgr->addMenuItemString("itemExtendedImageProperties", "Image"); |
||
909 | scrMenuMgr->addMenuItemString("itemToggleInlineImage", "Image"); |
||
19253 | craig | 910 | scrMenuMgr->createMenu("ItemPreviewSettings", tr("Preview Settings")); |
18533 | craig | 911 | scrMenuMgr->addMenuItemString("ItemPreviewSettings", "Image"); |
912 | scrMenuMgr->addMenuItemString("itemImageIsVisible", "ItemPreviewSettings"); |
||
913 | scrMenuMgr->addMenuItemString("SEPARATOR", "ItemPreviewSettings"); |
||
19465 | jghali | 914 | scrMenuMgr->addMenuItemString("itemPreviewFull", "ItemPreviewSettings"); |
915 | scrMenuMgr->addMenuItemString("itemPreviewNormal", "ItemPreviewSettings"); |
||
18533 | craig | 916 | scrMenuMgr->addMenuItemString("itemPreviewLow", "ItemPreviewSettings"); |
5800 | fschmid | 917 | scrMenuMgr->createMenu("ItemPDFOptions", tr("&PDF Options")); |
18533 | craig | 918 | scrMenuMgr->addMenuItemString("ItemPDFOptions", "Item"); |
919 | scrMenuMgr->addMenuItemString("itemPDFIsAnnotation", "ItemPDFOptions"); |
||
920 | scrMenuMgr->addMenuItemString("itemPDFIsBookmark", "ItemPDFOptions"); |
||
921 | scrMenuMgr->addMenuItemString("itemPDFAnnotationProps", "ItemPDFOptions"); |
||
922 | scrMenuMgr->addMenuItemString("itemPDFFieldProps", "ItemPDFOptions"); |
||
19436 | jghali | 923 | scrMenuMgr->createMenu("ItemConvertTo", tr("C&onvert to"), "Item"); |
18533 | craig | 924 | scrMenuMgr->addMenuItemString("ItemConvertTo", "Item"); |
18629 | craig | 925 | scrMenuMgr->addMenuItemString("itemConvertToTextFrame", "ItemConvertTo"); |
926 | scrMenuMgr->addMenuItemString("itemConvertToImageFrame", "ItemConvertTo"); |
||
927 | scrMenuMgr->addMenuItemString("itemConvertToPolygon", "ItemConvertTo"); |
||
18533 | craig | 928 | scrMenuMgr->addMenuItemString("itemConvertToBezierCurve", "ItemConvertTo"); |
929 | scrMenuMgr->addMenuItemString("itemConvertToOutlines", "ItemConvertTo"); |
||
930 | scrMenuMgr->addMenuItemString("itemConvertToSymbolFrame", "ItemConvertTo"); |
||
18070 | fschmid | 931 | scrMenuMgr->createMenu("TextLinking", tr("Text Frame Links"), "Item"); |
18533 | craig | 932 | scrMenuMgr->addMenuItemString("TextLinking", "Item"); |
933 | scrMenuMgr->addMenuItemString("toolsLinkTextFrame", "TextLinking"); |
||
934 | scrMenuMgr->addMenuItemString("toolsUnlinkTextFrame", "TextLinking"); |
||
21468 | jghali | 935 | scrMenuMgr->addMenuItemString("toolsUnlinkTextFrameAndCutText", "TextLinking"); |
18070 | fschmid | 936 | scrMenuMgr->createMenu("ItemPathOps", tr("Path Tools"), "Item"); |
18533 | craig | 937 | scrMenuMgr->addMenuItemString("ItemPathOps", "Item"); |
938 | scrMenuMgr->addMenuItemString("itemCombinePolygons", "ItemPathOps"); |
||
939 | scrMenuMgr->addMenuItemString("itemSplitPolygons", "ItemPathOps"); |
||
940 | scrMenuMgr->addMenuItemString("itemAttachTextToPath", "ItemPathOps"); |
||
941 | scrMenuMgr->addMenuItemString("itemDetachTextFromPath", "ItemPathOps"); |
||
15108 | cbradney | 942 | |
5800 | fschmid | 943 | scrActions["itemPrintingEnabled"]->setEnabled(false); |
944 | scrMenuMgr->setMenuEnabled("ItemConvertTo", false); |
||
945 | |||
18070 | fschmid | 946 | scrMenuMgr->createMenu("Weld", tr("Welding"), "Item"); |
18533 | craig | 947 | scrMenuMgr->addMenuItemString("Weld", "Item"); |
18629 | craig | 948 | scrMenuMgr->addMenuItemString("itemWeld", "Weld"); |
18533 | craig | 949 | scrMenuMgr->addMenuItemString("itemsUnWeld", "Weld"); |
950 | scrMenuMgr->addMenuItemString("itemEditWeld", "Weld"); |
||
951 | scrMenuMgr->addMenuItemString("editMark", "Item"); |
||
17826 | craig | 952 | |
5800 | fschmid | 953 | //Insert menu |
12940 | cbradney | 954 | scrMenuMgr->createMenu("Insert", ActionManager::defaultMenuNameEntryTranslated("Insert")); |
18533 | craig | 955 | scrMenuMgr->addMenuItemString("insertFrame", "Insert"); |
956 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
||
957 | scrMenuMgr->addMenuItemString("toolsInsertTextFrame", "Insert"); |
||
958 | scrMenuMgr->addMenuItemString("toolsInsertImageFrame", "Insert"); |
||
959 | scrMenuMgr->addMenuItemString("toolsInsertRenderFrame", "Insert"); |
||
960 | scrMenuMgr->addMenuItemString("toolsInsertTable", "Insert"); |
||
961 | scrMenuMgr->addMenuItemString("toolsInsertShape", "Insert"); |
||
962 | scrMenuMgr->addMenuItemString("toolsInsertPolygon", "Insert"); |
||
963 | scrMenuMgr->addMenuItemString("toolsInsertArc", "Insert"); |
||
964 | scrMenuMgr->addMenuItemString("toolsInsertSpiral", "Insert"); |
||
965 | scrMenuMgr->addMenuItemString("toolsInsertLine", "Insert"); |
||
966 | scrMenuMgr->addMenuItemString("toolsInsertBezier", "Insert"); |
||
967 | scrMenuMgr->addMenuItemString("toolsInsertFreehandLine", "Insert"); |
||
968 | scrMenuMgr->addMenuItemString("toolsInsertCalligraphicLine", "Insert"); |
||
969 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
||
970 | scrMenuMgr->addMenuItemString("stickyTools", "Insert"); |
||
971 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
||
972 | scrMenuMgr->addMenuItemString("insertGlyph", "Insert"); |
||
5800 | fschmid | 973 | |
10558 | cbradney | 974 | scrMenuMgr->createMenu("InsertChar", tr("&Character"), "Insert"); |
18533 | craig | 975 | scrMenuMgr->addMenuItemString("InsertChar", "Insert"); |
976 | scrMenuMgr->addMenuItemString("unicodePageNumber", "InsertChar"); |
||
977 | scrMenuMgr->addMenuItemString("unicodePageCount", "InsertChar"); |
||
978 | scrMenuMgr->addMenuItemString("unicodeSoftHyphen", "InsertChar"); |
||
979 | scrMenuMgr->addMenuItemString("unicodeNonBreakingHyphen", "InsertChar"); |
||
21563 | jghali | 980 | scrMenuMgr->addMenuItemString("unicodeZWJ", "InsertChar"); |
981 | scrMenuMgr->addMenuItemString("unicodeZWNJ", "InsertChar"); |
||
18533 | craig | 982 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertChar"); |
983 | scrMenuMgr->addMenuItemString("unicodeCopyRight", "InsertChar"); |
||
984 | scrMenuMgr->addMenuItemString("unicodeRegdTM", "InsertChar"); |
||
985 | scrMenuMgr->addMenuItemString("unicodeTM", "InsertChar"); |
||
986 | scrMenuMgr->addMenuItemString("unicodeSolidus", "InsertChar"); |
||
987 | scrMenuMgr->addMenuItemString("unicodeBullet", "InsertChar"); |
||
988 | scrMenuMgr->addMenuItemString("unicodeMidpoint", "InsertChar"); |
||
989 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertChar"); |
||
990 | scrMenuMgr->addMenuItemString("unicodeDashEm", "InsertChar"); |
||
991 | scrMenuMgr->addMenuItemString("unicodeDashEn", "InsertChar"); |
||
992 | scrMenuMgr->addMenuItemString("unicodeDashFigure", "InsertChar"); |
||
993 | scrMenuMgr->addMenuItemString("unicodeDashQuotation", "InsertChar"); |
||
5800 | fschmid | 994 | |
10558 | cbradney | 995 | scrMenuMgr->createMenu("InsertQuote", tr("&Quote"), "Insert"); |
18533 | craig | 996 | scrMenuMgr->addMenuItemString("InsertQuote", "Insert"); |
997 | scrMenuMgr->addMenuItemString("unicodeQuoteApostrophe", "InsertQuote"); |
||
998 | scrMenuMgr->addMenuItemString("unicodeQuoteStraight", "InsertQuote"); |
||
999 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1000 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleLeft", "InsertQuote"); |
||
1001 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleRight", "InsertQuote"); |
||
1002 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleLeft", "InsertQuote"); |
||
1003 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleRight", "InsertQuote"); |
||
1004 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1005 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleReversed", "InsertQuote"); |
||
1006 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleReversed", "InsertQuote"); |
||
1007 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1008 | scrMenuMgr->addMenuItemString("unicodeQuoteLowSingleComma", "InsertQuote"); |
||
1009 | scrMenuMgr->addMenuItemString("unicodeQuoteLowDoubleComma", "InsertQuote"); |
||
1010 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1011 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleLeftGuillemet", "InsertQuote"); |
||
1012 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleRightGuillemet", "InsertQuote"); |
||
1013 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleLeftGuillemet", "InsertQuote"); |
||
1014 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleRightGuillemet", "InsertQuote"); |
||
1015 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1016 | scrMenuMgr->addMenuItemString("unicodeQuoteCJKSingleLeft", "InsertQuote"); |
||
1017 | scrMenuMgr->addMenuItemString("unicodeQuoteCJKSingleRight", "InsertQuote"); |
||
1018 | scrMenuMgr->addMenuItemString("unicodeQuoteCJKDoubleLeft", "InsertQuote"); |
||
1019 | scrMenuMgr->addMenuItemString("unicodeQuoteCJKDoubleRight", "InsertQuote"); |
||
5800 | fschmid | 1020 | |
21058 | craig | 1021 | scrMenuMgr->createMenu("InsertSpace", tr("S&paces && Breaks"), "Insert"); |
18533 | craig | 1022 | scrMenuMgr->addMenuItemString("InsertSpace", "Insert"); |
1023 | scrMenuMgr->addMenuItemString("unicodeNonBreakingSpace", "InsertSpace"); |
||
1024 | scrMenuMgr->addMenuItemString("unicodeSpaceEN", "InsertSpace"); |
||
1025 | scrMenuMgr->addMenuItemString("unicodeSpaceEM", "InsertSpace"); |
||
1026 | scrMenuMgr->addMenuItemString("unicodeSpaceThin", "InsertSpace"); |
||
1027 | scrMenuMgr->addMenuItemString("unicodeSpaceThick", "InsertSpace"); |
||
1028 | scrMenuMgr->addMenuItemString("unicodeSpaceMid", "InsertSpace"); |
||
1029 | scrMenuMgr->addMenuItemString("unicodeSpaceHair", "InsertSpace"); |
||
1030 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertSpace"); |
||
22995 | craig | 1031 | scrMenuMgr->addMenuItemString("unicodeZerowidthSpace", "InsertSpace"); |
18533 | craig | 1032 | scrMenuMgr->addMenuItemString("unicodeNewLine", "InsertSpace"); |
22995 | craig | 1033 | scrMenuMgr->addMenuItemString("unicodeColumnBreak", "InsertSpace"); |
18533 | craig | 1034 | scrMenuMgr->addMenuItemString("unicodeFrameBreak", "InsertSpace"); |
5800 | fschmid | 1035 | |
10558 | cbradney | 1036 | scrMenuMgr->createMenu("InsertLigature", tr("Liga&ture"), "Insert"); |
18533 | craig | 1037 | scrMenuMgr->addMenuItemString("InsertLigature", "Insert"); |
1038 | scrMenuMgr->addMenuItemString("unicodeLigature_ff", "InsertLigature"); |
||
1039 | scrMenuMgr->addMenuItemString("unicodeLigature_fi", "InsertLigature"); |
||
1040 | scrMenuMgr->addMenuItemString("unicodeLigature_fl", "InsertLigature"); |
||
1041 | scrMenuMgr->addMenuItemString("unicodeLigature_ffi", "InsertLigature"); |
||
1042 | scrMenuMgr->addMenuItemString("unicodeLigature_ffl", "InsertLigature"); |
||
1043 | scrMenuMgr->addMenuItemString("unicodeLigature_ft", "InsertLigature"); |
||
1044 | scrMenuMgr->addMenuItemString("unicodeLigature_st", "InsertLigature"); |
||
5800 | fschmid | 1045 | |
18533 | craig | 1046 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
1047 | scrMenuMgr->addMenuItemString("insertSampleText", "Insert"); |
||
1048 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
||
17826 | craig | 1049 | scrMenuMgr->createMenu("InsertMark", tr("Marks"), "Insert"); |
18533 | craig | 1050 | scrMenuMgr->addMenuItemString("InsertMark", "Insert"); |
1051 | scrMenuMgr->addMenuItemString("insertMarkAnchor", "InsertMark"); |
||
21460 | jghali | 1052 | scrMenuMgr->addMenuItemString("insertMarkNote", "InsertMark"); |
1053 | scrMenuMgr->addMenuItemString("insertMarkItem", "InsertMark"); |
||
18914 | craig | 1054 | scrMenuMgr->addMenuItemString("insertMark2Mark", "InsertMark"); |
18533 | craig | 1055 | scrMenuMgr->addMenuItemString("insertMarkVariableText", "InsertMark"); |
5800 | fschmid | 1056 | |
1057 | //Page menu |
||
12940 | cbradney | 1058 | scrMenuMgr->createMenu("Page", ActionManager::defaultMenuNameEntryTranslated("Page")); |
18533 | craig | 1059 | scrMenuMgr->addMenuItemString("pageInsert", "Page"); |
1060 | scrMenuMgr->addMenuItemString("pageImport", "Page"); |
||
1061 | scrMenuMgr->addMenuItemString("pageDelete", "Page"); |
||
1062 | scrMenuMgr->addMenuItemString("pageCopy", "Page"); |
||
1063 | scrMenuMgr->addMenuItemString("pageMove", "Page"); |
||
1064 | scrMenuMgr->addMenuItemString("SEPARATOR", "Page"); |
||
1065 | scrMenuMgr->addMenuItemString("pageApplyMasterPage", "Page"); |
||
1066 | scrMenuMgr->addMenuItemString("pageCopyToMasterPage", "Page"); |
||
1067 | scrMenuMgr->addMenuItemString("pageManageGuides", "Page"); |
||
19907 | craig | 1068 | scrMenuMgr->addMenuItemString("pageManageProperties", "Page"); |
18533 | craig | 1069 | scrMenuMgr->addMenuItemString("SEPARATOR", "Page"); |
1070 | scrMenuMgr->addMenuItemString("viewSnapToGrid", "Page"); |
||
1071 | scrMenuMgr->addMenuItemString("viewSnapToGuides", "Page"); |
||
1072 | scrMenuMgr->addMenuItemString("viewSnapToElements", "Page"); |
||
5800 | fschmid | 1073 | |
1074 | //View menu |
||
12940 | cbradney | 1075 | scrMenuMgr->createMenu("View", ActionManager::defaultMenuNameEntryTranslated("View")); |
18249 | craig | 1076 | scrMenuMgr->createMenu("ViewZoom", tr("Zoom"), "View"); |
18533 | craig | 1077 | scrMenuMgr->addMenuItemString("ViewZoom", "View"); |
1078 | scrMenuMgr->addMenuItemString("viewFitInWindow", "ViewZoom"); |
||
1079 | scrMenuMgr->addMenuItemString("viewFitWidth", "ViewZoom"); |
||
1080 | scrMenuMgr->addMenuItemString("viewFit50", "ViewZoom"); |
||
1081 | scrMenuMgr->addMenuItemString("viewFit75", "ViewZoom"); |
||
1082 | scrMenuMgr->addMenuItemString("viewFit100", "ViewZoom"); |
||
1083 | scrMenuMgr->addMenuItemString("viewFit200", "ViewZoom"); |
||
1084 | scrMenuMgr->addMenuItemString("viewFit400", "ViewZoom"); |
||
18249 | craig | 1085 | scrMenuMgr->createMenu("ViewPreview", tr("Preview"), "View"); |
18533 | craig | 1086 | scrMenuMgr->addMenuItemString("ViewPreview", "View"); |
1087 | scrMenuMgr->addMenuItemString("viewPreviewMode", "ViewPreview"); |
||
20252 | craig | 1088 | scrMenuMgr->createMenu("ViewMeasuring", tr("Measurement"), "View"); |
18533 | craig | 1089 | scrMenuMgr->addMenuItemString("ViewMeasuring", "View"); |
1090 | scrMenuMgr->addMenuItemString("viewShowRulers", "ViewMeasuring"); |
||
1091 | scrMenuMgr->addMenuItemString("viewRulerMode", "ViewMeasuring"); |
||
1092 | scrMenuMgr->addMenuItemString("showMouseCoordinates", "ViewMeasuring"); |
||
18249 | craig | 1093 | scrMenuMgr->createMenu("ViewTextFrames", tr("Text Frames"), "View"); |
18533 | craig | 1094 | scrMenuMgr->addMenuItemString("ViewTextFrames", "View"); |
1095 | scrMenuMgr->addMenuItemString("viewShowBaseline", "ViewTextFrames"); |
||
1096 | scrMenuMgr->addMenuItemString("viewShowColumnBorders", "ViewTextFrames"); |
||
1097 | scrMenuMgr->addMenuItemString("viewShowTextChain", "ViewTextFrames"); |
||
1098 | scrMenuMgr->addMenuItemString("viewShowTextControls", "ViewTextFrames"); |
||
18249 | craig | 1099 | scrMenuMgr->createMenu("ViewImageFrames", tr("Image Frames"), "View"); |
18533 | craig | 1100 | scrMenuMgr->addMenuItemString("ViewImageFrames", "View"); |
1101 | scrMenuMgr->addMenuItemString("viewShowImages", "ViewImageFrames"); |
||
18249 | craig | 1102 | scrMenuMgr->createMenu("ViewDocument", tr("Document"), "View"); |
18533 | craig | 1103 | scrMenuMgr->addMenuItemString("ViewDocument", "View"); |
1104 | scrMenuMgr->addMenuItemString("viewShowMargins", "ViewDocument"); |
||
1105 | scrMenuMgr->addMenuItemString("viewShowBleeds", "ViewDocument"); |
||
1106 | scrMenuMgr->addMenuItemString("viewShowFrames", "ViewDocument"); |
||
1107 | scrMenuMgr->addMenuItemString("viewShowLayerMarkers", "ViewDocument"); |
||
18249 | craig | 1108 | scrMenuMgr->createMenu("ViewGrids", tr("Grids and Guides"), "View"); |
18533 | craig | 1109 | scrMenuMgr->addMenuItemString("ViewGrids", "View"); |
18545 | craig | 1110 | scrMenuMgr->addMenuItemString("viewShowGrid", "ViewGrids"); |
1111 | scrMenuMgr->addMenuItemString("viewShowGuides", "ViewGrids"); |
||
5800 | fschmid | 1112 | |
1113 | //CB If this is viewNewView imeplemented, it should be on the windows menu |
||
1114 | // scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View"); |
||
1115 | |||
18070 | fschmid | 1116 | // Table menu. |
1117 | scrMenuMgr->createMenu("ItemTable", ActionManager::defaultMenuNameEntryTranslated("Table")); |
||
18533 | craig | 1118 | scrMenuMgr->addMenuItemString("tableInsertRows", "ItemTable"); |
1119 | scrMenuMgr->addMenuItemString("tableInsertColumns", "ItemTable"); |
||
1120 | scrMenuMgr->addMenuItemString("tableDeleteRows", "ItemTable"); |
||
1121 | scrMenuMgr->addMenuItemString("tableDeleteColumns", "ItemTable"); |
||
1122 | scrMenuMgr->addMenuItemString("SEPARATOR", "ItemTable"); |
||
1123 | scrMenuMgr->addMenuItemString("tableMergeCells", "ItemTable"); |
||
1124 | scrMenuMgr->addMenuItemString("tableSplitCells", "ItemTable"); |
||
1125 | scrMenuMgr->addMenuItemString("SEPARATOR", "ItemTable"); |
||
1126 | scrMenuMgr->addMenuItemString("tableSetRowHeights", "ItemTable"); |
||
1127 | scrMenuMgr->addMenuItemString("tableSetColumnWidths", "ItemTable"); |
||
1128 | scrMenuMgr->addMenuItemString("tableDistributeRowsEvenly", "ItemTable"); |
||
1129 | scrMenuMgr->addMenuItemString("tableDistributeColumnsEvenly", "ItemTable"); |
||
1130 | scrMenuMgr->addMenuItemString("SEPARATOR", "ItemTable"); |
||
1131 | scrMenuMgr->addMenuItemString("tableAdjustFrameToTable", "ItemTable"); |
||
1132 | scrMenuMgr->addMenuItemString("tableAdjustTableToFrame", "ItemTable"); |
||
5800 | fschmid | 1133 | |
1134 | //Extra menu |
||
12940 | cbradney | 1135 | scrMenuMgr->createMenu("Extras", ActionManager::defaultMenuNameEntryTranslated("Extras")); |
18533 | craig | 1136 | scrMenuMgr->addMenuItemString("extrasHyphenateText", "Extras"); |
1137 | scrMenuMgr->addMenuItemString("extrasDeHyphenateText", "Extras"); |
||
1138 | scrMenuMgr->addMenuItemString("extrasGenerateTableOfContents", "Extras"); |
||
18586 | craig | 1139 | scrMenuMgr->addMenuItemString("itemUpdateMarks", "Extras"); |
1140 | scrMenuMgr->addMenuItemString("SEPARATOR", "Extras"); |
||
1141 | scrMenuMgr->addMenuItemString("extrasManageImages", "Extras"); |
||
1142 | scrMenuMgr->addMenuItemString("SEPARATOR", "Extras"); |
||
18533 | craig | 1143 | scrMenuMgr->addMenuItemString("extrasUpdateDocument", "Extras"); |
20998 | fschmid | 1144 | // Disabled for release as it does nothing useful |
1145 | // scrMenuMgr->addMenuItemString("extrasTestQTQuick2_1", "Extras"); |
||
5800 | fschmid | 1146 | |
1147 | //Window menu |
||
15117 | cbradney | 1148 | scrMenuMgr->createMenu("Windows", ActionManager::defaultMenuNameEntryTranslated("Windows"), QString::null, true); |
5800 | fschmid | 1149 | |
1150 | //Help menu |
||
12940 | cbradney | 1151 | scrMenuMgr->createMenu("Help", ActionManager::defaultMenuNameEntryTranslated("Help")); |
18533 | craig | 1152 | scrMenuMgr->addMenuItemString("helpManual", "Help"); |
20510 | craig | 1153 | scrMenuMgr->addMenuItemString("helpChat", "Help"); |
18533 | craig | 1154 | scrMenuMgr->addMenuItemString("SEPARATOR", "Help"); |
1155 | scrMenuMgr->addMenuItemString("helpTooltips", "Help"); |
||
1156 | scrMenuMgr->addMenuItemString("SEPARATOR", "Help"); |
||
1157 | scrMenuMgr->addMenuItemString("helpOnlineWWW", "Help"); |
||
1158 | scrMenuMgr->addMenuItemString("helpOnlineDocs", "Help"); |
||
1159 | scrMenuMgr->addMenuItemString("helpOnlineWiki", "Help"); |
||
1160 | scrMenuMgr->addMenuItemString("HelpOnlineTutorials", "Help"); |
||
1161 | scrMenuMgr->addMenuItemString("helpOnlineTutorial1", "Help"); |
||
1162 | scrMenuMgr->addMenuItemString("SEPARATOR", "Help"); |
||
1163 | scrMenuMgr->addMenuItemString("helpCheckUpdates", "Help"); |
||
1164 | scrMenuMgr->addMenuItemString("SEPARATOR", "Help"); |
||
1165 | scrMenuMgr->addMenuItemString("helpAboutScribus", "Help"); |
||
1166 | scrMenuMgr->addMenuItemString("helpAboutPlugins", "Help"); |
||
1167 | scrMenuMgr->addMenuItemString("helpAboutQt", "Help"); |
||
18548 | craig | 1168 | } |
10953 | subik | 1169 | |
18548 | craig | 1170 | void ScribusMainWindow::createMenuBar() |
1171 | { |
||
18533 | craig | 1172 | scrMenuMgr->addMenuStringToMenuBar("File"); |
22900 | jghali | 1173 | scrMenuMgr->addMenuItemStringsToMenuBar("File", scrActions); |
18533 | craig | 1174 | scrMenuMgr->addMenuStringToMenuBar("Edit"); |
22900 | jghali | 1175 | scrMenuMgr->addMenuItemStringsToMenuBar("Edit", scrActions); |
18533 | craig | 1176 | scrMenuMgr->addMenuStringToMenuBar("Item"); |
22900 | jghali | 1177 | scrMenuMgr->addMenuItemStringsToMenuBar("Item", scrActions); |
18533 | craig | 1178 | scrMenuMgr->addMenuStringToMenuBar("Insert"); |
22900 | jghali | 1179 | scrMenuMgr->addMenuItemStringsToMenuBar("Insert", scrActions); |
18533 | craig | 1180 | scrMenuMgr->addMenuStringToMenuBar("Page"); |
22900 | jghali | 1181 | scrMenuMgr->addMenuItemStringsToMenuBar("Page", scrActions); |
18533 | craig | 1182 | scrMenuMgr->addMenuStringToMenuBar("ItemTable"); |
22900 | jghali | 1183 | scrMenuMgr->addMenuItemStringsToMenuBar("ItemTable", scrActions); |
18533 | craig | 1184 | scrMenuMgr->addMenuStringToMenuBar("Extras"); |
22900 | jghali | 1185 | scrMenuMgr->addMenuItemStringsToMenuBar("Extras", scrActions); |
18533 | craig | 1186 | scrMenuMgr->addMenuStringToMenuBar("View"); |
22900 | jghali | 1187 | scrMenuMgr->addMenuItemStringsToMenuBar("View", scrActions); |
18583 | craig | 1188 | scrMenuMgr->addMenuStringToMenuBar("Windows", true); |
18533 | craig | 1189 | addDefaultWindowMenuItems(); |
10564 | fschmid | 1190 | menuBar()->addSeparator(); |
18533 | craig | 1191 | scrMenuMgr->addMenuStringToMenuBar("Help"); |
22900 | jghali | 1192 | scrMenuMgr->addMenuItemStringsToMenuBar("Help", scrActions); |
18557 | craig | 1193 | connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow())); |
1194 | connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
||
1195 | |||
5800 | fschmid | 1196 | } |
1197 | |||
10532 | avox | 1198 | |
5800 | fschmid | 1199 | void ScribusMainWindow::addDefaultWindowMenuItems() |
1200 | { |
||
1201 | scrMenuMgr->clearMenu("Windows"); |
||
18533 | craig | 1202 | scrMenuMgr->addMenuItemString("windowsCascade", "Windows"); |
1203 | scrMenuMgr->addMenuItemString("windowsTile", "Windows"); |
||
1204 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
||
1205 | scrMenuMgr->addMenuItemString("toolsProperties", "Windows"); |
||
21575 | craig | 1206 | scrMenuMgr->addMenuItemString("toolsText", "Windows"); |
18533 | craig | 1207 | scrMenuMgr->addMenuItemString("toolsActionHistory", "Windows"); |
1208 | scrMenuMgr->addMenuItemString("toolsAlignDistribute", "Windows"); |
||
1209 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
||
1210 | scrMenuMgr->addMenuItemString("toolsOutline", "Windows"); |
||
1211 | scrMenuMgr->addMenuItemString("toolsPages", "Windows"); |
||
1212 | scrMenuMgr->addMenuItemString("toolsLayers", "Windows"); |
||
1213 | scrMenuMgr->addMenuItemString("toolsBookmarks", "Windows"); |
||
20039 | craig | 1214 | // scrMenuMgr->addMenuItemString("toolsDownloads", "Windows"); |
19821 | craig | 1215 | scrMenuMgr->addMenuItemString("toolsResources", "Windows"); |
18533 | craig | 1216 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
1217 | scrMenuMgr->addMenuItemString("toolsScrapbook", "Windows"); |
||
1218 | scrMenuMgr->addMenuItemString("toolsSymbols", "Windows"); |
||
1219 | scrMenuMgr->addMenuItemString("toolsInline", "Windows"); |
||
1220 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
||
1221 | scrMenuMgr->addMenuItemString("toolsMeasurements", "Windows"); |
||
1222 | scrMenuMgr->addMenuItemString("toolsPreflightVerifier", "Windows"); |
||
1223 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
||
1224 | scrMenuMgr->addMenuItemString("toolsToolbarTools", "Windows"); |
||
1225 | scrMenuMgr->addMenuItemString("toolsToolbarPDF", "Windows"); |
||
19009 | craig | 1226 | scrMenuMgr->addMenuItemString("toolsToolbarView", "Windows"); |
19962 | fschmid | 1227 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
22900 | jghali | 1228 | scrMenuMgr->addMenuItemStringsToMenuBar("Windows", scrActions); |
5800 | fschmid | 1229 | } |
1230 | |||
1231 | |||
1232 | void ScribusMainWindow::initStatusBar() |
||
1233 | { |
||
18972 | craig | 1234 | QFont fo = QFont(font()); |
1235 | int posi = fo.pointSize() - (ScCore->isWinGUI() ? 1 : 2); |
||
1236 | fo.setPointSize(posi); |
||
1237 | unitSwitcher = new QComboBox( this ); |
||
19954 | craig | 1238 | unitSwitcher->setObjectName("unitSwitcher"); |
18972 | craig | 1239 | unitSwitcher->setFocusPolicy(Qt::NoFocus); |
1240 | unitSwitcher->setFont(fo); |
||
1241 | int maxUindex = unitGetMaxIndex() - 2; |
||
1242 | for (int i = 0; i <= maxUindex; ++i) |
||
1243 | unitSwitcher->addItem(unitGetStrFromIndex(i)); |
||
19954 | craig | 1244 | |
1245 | |||
1246 | QWidget* zoomWidget = new QWidget( statusBar() ); |
||
1247 | QHBoxLayout* zoomLayout = new QHBoxLayout( zoomWidget ); |
||
1248 | zoomLayout->setMargin(0); |
||
1249 | zoomLayout->setSpacing(1); |
||
1250 | |||
1251 | zoomSpinBox = new ScrSpinBox( 1, 32000, zoomWidget, 6 ); |
||
18972 | craig | 1252 | zoomSpinBox->setFont(fo); |
1253 | zoomSpinBox->setValue( 100 ); |
||
1254 | zoomSpinBox->setSingleStep(10); |
||
1255 | zoomSpinBox->setFocusPolicy(Qt::ClickFocus); |
||
1256 | zoomSpinBox->setSuffix( tr( " %" ) ); |
||
1257 | layerMenu = new QComboBox( this ); |
||
19954 | craig | 1258 | layerMenu->setObjectName("layerMenu"); |
18972 | craig | 1259 | layerMenu->setEditable(false); |
1260 | layerMenu->setFont(fo); |
||
1261 | layerMenu->setFocusPolicy(Qt::NoFocus); |
||
1262 | layerMenu->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
||
1263 | |||
1264 | pageSelector = new PageSelector(this, 1); |
||
19954 | craig | 1265 | pageSelector->setObjectName("pageSelector"); |
18972 | craig | 1266 | pageSelector->setFont(fo); |
1267 | pageSelector->setFocusPolicy(Qt::ClickFocus); |
||
1268 | |||
19954 | craig | 1269 | zoomDefaultToolbarButton = new QPushButton(zoomWidget); |
18972 | craig | 1270 | zoomDefaultToolbarButton->setFocusPolicy(Qt::NoFocus); |
1271 | zoomDefaultToolbarButton->setDefault( false ); |
||
1272 | zoomDefaultToolbarButton->setAutoDefault( false ); |
||
19954 | craig | 1273 | zoomOutToolbarButton = new QPushButton(zoomWidget); |
18972 | craig | 1274 | zoomOutToolbarButton->setFocusPolicy(Qt::NoFocus); |
1275 | zoomOutToolbarButton->setDefault( false ); |
||
1276 | zoomOutToolbarButton->setAutoDefault( false ); |
||
19954 | craig | 1277 | zoomInToolbarButton = new QPushButton(zoomWidget); |
18972 | craig | 1278 | zoomInToolbarButton->setFocusPolicy(Qt::NoFocus); |
1279 | zoomInToolbarButton->setDefault( false ); |
||
1280 | zoomInToolbarButton->setAutoDefault( false ); |
||
19954 | craig | 1281 | |
20196 | craig | 1282 | zoomDefaultToolbarButton->setIcon(IconManager::instance()->loadIcon("16/zoom-original.png")); |
1283 | zoomOutToolbarButton->setIcon(IconManager::instance()->loadIcon("16/zoom-out.png")); |
||
1284 | zoomInToolbarButton->setIcon(IconManager::instance()->loadIcon("16/zoom-in.png")); |
||
18972 | craig | 1285 | |
1286 | |||
19954 | craig | 1287 | zoomLayout->addWidget( zoomSpinBox ); |
1288 | zoomLayout->addWidget( zoomOutToolbarButton ); |
||
1289 | zoomLayout->addWidget( zoomDefaultToolbarButton ); |
||
1290 | zoomLayout->addWidget( zoomInToolbarButton ); |
||
1291 | |||
20691 | craig | 1292 | m_mainWindowStatusLabel = new QLabel( " ", statusBar()); |
1293 | m_mainWindowStatusLabel->setFont(fo); |
||
9953 | cbradney | 1294 | mainWindowProgressBar = new QProgressBar(statusBar()); |
1295 | mainWindowProgressBar->setAlignment(Qt::AlignHCenter); |
||
5800 | fschmid | 1296 | mainWindowProgressBar->setFixedWidth( 100 ); |
1297 | mainWindowProgressBar->reset(); |
||
18972 | craig | 1298 | mainWindowXPosLabel = new QLabel( tr("X:"), statusBar()); |
18978 | craig | 1299 | mainWindowXPosLabel->setFont(fo); |
18972 | craig | 1300 | mainWindowYPosLabel = new QLabel( tr("Y:"), statusBar()); |
18978 | craig | 1301 | mainWindowYPosLabel->setFont(fo); |
19954 | craig | 1302 | mainWindowXPosDataLabel = new QLabel( "", statusBar()); |
18978 | craig | 1303 | mainWindowXPosDataLabel->setFont(fo); |
19954 | craig | 1304 | mainWindowYPosDataLabel = new QLabel( "", statusBar()); |
18978 | craig | 1305 | mainWindowYPosDataLabel->setFont(fo); |
19954 | craig | 1306 | mainWindowXPosDataLabel->setMinimumWidth(mainWindowXPosDataLabel->fontMetrics().width("99999.999")); |
1307 | mainWindowYPosDataLabel->setMinimumWidth(mainWindowYPosDataLabel->fontMetrics().width("99999.999")); |
||
18972 | craig | 1308 | statusBarLanguageChange(); |
1309 | |||
19956 | craig | 1310 | layerMenu->setObjectName("layerMenu"); |
1311 | unitSwitcher->setObjectName("unitSwitcher"); |
||
1312 | zoomDefaultToolbarButton->setObjectName("zoomDefaultToolbarButton"); |
||
1313 | zoomInToolbarButton->setObjectName("zoomInToolbarButton"); |
||
1314 | zoomOutToolbarButton->setObjectName("zoomOutToolbarButton"); |
||
1315 | zoomSpinBox->setObjectName("zoomSpinBox"); |
||
1316 | |||
19009 | craig | 1317 | statusBar()->setFont(fo); |
20691 | craig | 1318 | statusBar()->addPermanentWidget(m_mainWindowStatusLabel, 5); |
19009 | craig | 1319 | QLabel *s=new QLabel(""); |
1320 | QLabel *s2=new QLabel(""); |
||
19954 | craig | 1321 | QLabel *s3=new QLabel(""); |
19009 | craig | 1322 | statusBar()->addPermanentWidget(s,1); |
19954 | craig | 1323 | statusBar()->addPermanentWidget(s2,1); |
1324 | statusBar()->addPermanentWidget(zoomWidget,0); |
||
1325 | statusBar()->addPermanentWidget(pageSelector,0); |
||
19009 | craig | 1326 | statusBar()->addPermanentWidget(layerMenu,1); |
19954 | craig | 1327 | statusBar()->addPermanentWidget(s3,3); |
10564 | fschmid | 1328 | statusBar()->addPermanentWidget(mainWindowXPosLabel, 0); |
19954 | craig | 1329 | statusBar()->addPermanentWidget(mainWindowXPosDataLabel, 0); |
10564 | fschmid | 1330 | statusBar()->addPermanentWidget(mainWindowYPosLabel, 0); |
19954 | craig | 1331 | statusBar()->addPermanentWidget(mainWindowYPosDataLabel, 0); |
1332 | |||
19009 | craig | 1333 | statusBar()->addPermanentWidget(unitSwitcher,0); |
1334 | statusBar()->addPermanentWidget(mainWindowProgressBar, 0); |
||
15675 | fschmid | 1335 | connect(statusBar(), SIGNAL(messageChanged(const QString &)), this, SLOT(setTempStatusBarText(const QString &))); |
18972 | craig | 1336 | |
5800 | fschmid | 1337 | } |
1338 | |||
10532 | avox | 1339 | |
5800 | fschmid | 1340 | void ScribusMainWindow::setStatusBarMousePosition(double xp, double yp) |
1341 | { |
||
21373 | craig | 1342 | if (!HaveDoc) |
1343 | { |
||
1344 | mainWindowXPosDataLabel->clear(); |
||
1345 | mainWindowYPosDataLabel->clear(); |
||
1346 | return; |
||
1347 | } |
||
18065 | fschmid | 1348 | if (doc->Pages->count() == 0) |
1349 | return; |
||
5800 | fschmid | 1350 | double xn = xp; |
1351 | double yn = yp; |
||
14932 | cbradney | 1352 | if (doc->guidesPrefs().rulerMode) |
5800 | fschmid | 1353 | { |
1354 | xn -= doc->currentPage()->xOffset(); |
||
1355 | yn -= doc->currentPage()->yOffset(); |
||
1356 | } |
||
1357 | xn -= doc->rulerXoffset; |
||
1358 | yn -= doc->rulerYoffset; |
||
19009 | craig | 1359 | mainWindowXPosDataLabel->setText(value2String(xn, doc->unitIndex(), true, false)); |
1360 | mainWindowYPosDataLabel->setText(value2String(yn, doc->unitIndex(), true, false)); |
||
5800 | fschmid | 1361 | } |
1362 | |||
15465 | avox | 1363 | void ScribusMainWindow::setStatusBarTextPosition(double base, double xp) |
1364 | { |
||
18065 | fschmid | 1365 | if (doc->Pages->count() == 0) |
1366 | return; |
||
15465 | avox | 1367 | mainWindowXPosDataLabel->setText(base + xp >= 0? value2String(xp, doc->unitIndex(), true, true): QString("-")); |
1368 | mainWindowYPosDataLabel->setText("-"); |
||
1369 | } |
||
10532 | avox | 1370 | |
19386 | craig | 1371 | void ScribusMainWindow::setStatusBarTextSelectedItemInfo() |
1372 | { |
||
22268 | craig | 1373 | const int docSelectionCount = doc->m_Selection->count(); |
19386 | craig | 1374 | if (docSelectionCount == 0) |
19581 | craig | 1375 | { |
19386 | craig | 1376 | setStatusBarInfoText(""); |
19581 | craig | 1377 | return; |
1378 | } |
||
1379 | QString widthTxt = value2String(doc->m_Selection->width(), doc->unitIndex(), true, true); |
||
1380 | QString heightTxt = value2String(doc->m_Selection->height(), doc->unitIndex(), true, true); |
||
1381 | if (docSelectionCount == 1) |
||
19386 | craig | 1382 | { |
1383 | QString whatSel = tr("Unknown"); |
||
1384 | switch (doc->m_Selection->itemAt(0)->itemType()) |
||
1385 | { |
||
1386 | case 2: |
||
1387 | whatSel = CommonStrings::itemType_ImageFrame; |
||
1388 | break; |
||
1389 | case 4: |
||
1390 | whatSel = CommonStrings::itemType_TextFrame; |
||
1391 | break; |
||
1392 | case 5: |
||
1393 | whatSel = CommonStrings::itemType_Line; |
||
1394 | break; |
||
1395 | case 6: |
||
1396 | whatSel = CommonStrings::itemType_Polygon; |
||
1397 | break; |
||
1398 | case 7: |
||
1399 | whatSel = CommonStrings::itemType_Polyline; |
||
1400 | break; |
||
1401 | case 8: |
||
1402 | whatSel = CommonStrings::itemType_PathText; |
||
1403 | break; |
||
1404 | case 9: |
||
1405 | whatSel = CommonStrings::itemType_LatexFrame; |
||
1406 | break; |
||
1407 | case 11: |
||
1408 | whatSel = CommonStrings::itemType_Symbol; |
||
1409 | break; |
||
1410 | case 12: |
||
1411 | whatSel = CommonStrings::itemType_Group; |
||
1412 | break; |
||
1413 | case 13: |
||
1414 | whatSel = CommonStrings::itemType_RegularPolygon; |
||
1415 | break; |
||
1416 | case 14: |
||
1417 | whatSel = CommonStrings::itemType_Arc; |
||
1418 | break; |
||
1419 | case 15: |
||
1420 | whatSel = CommonStrings::itemType_Spiral; |
||
1421 | break; |
||
1422 | case 16: |
||
1423 | whatSel = CommonStrings::itemType_Table; |
||
1424 | break; |
||
1425 | default: |
||
1426 | whatSel = "Unknown"; |
||
1427 | break; |
||
1428 | } |
||
1429 | QString txtBody = tr("%1 selected").arg(whatSel) + " : " + tr("Size"); |
||
21934 | craig | 1430 | setStatusBarInfoText( QString("%1 = %3 x %4").arg(txtBody, widthTxt, heightTxt)); |
19386 | craig | 1431 | } |
1432 | else |
||
1433 | { |
||
1434 | setStatusBarInfoText( tr("%1 Objects selected, Selection Size = %2 x %3").arg(docSelectionCount).arg(widthTxt).arg(heightTxt)); |
||
1435 | } |
||
1436 | } |
||
1437 | |||
15675 | fschmid | 1438 | void ScribusMainWindow::setTempStatusBarText(const QString &text) |
1439 | { |
||
20691 | craig | 1440 | if (m_mainWindowStatusLabel) |
15675 | fschmid | 1441 | { |
1442 | if (text.isEmpty()) |
||
20691 | craig | 1443 | m_mainWindowStatusLabel->setText(m_statusLabelText); |
15675 | fschmid | 1444 | else |
20691 | craig | 1445 | m_mainWindowStatusLabel->setText(text); |
15675 | fschmid | 1446 | } |
1447 | } |
||
15465 | avox | 1448 | |
22635 | craig | 1449 | void ScribusMainWindow::setStatusBarInfoText(const QString & newText) |
5800 | fschmid | 1450 | { |
20691 | craig | 1451 | if (m_mainWindowStatusLabel) |
1452 | m_mainWindowStatusLabel->setText(newText); |
||
1453 | m_statusLabelText = newText; |
||
5800 | fschmid | 1454 | } |
1455 | |||
10532 | avox | 1456 | |
21575 | craig | 1457 | //AV to be replaced with Selection::update and listener in textPalette |
5800 | fschmid | 1458 | void ScribusMainWindow::setTBvals(PageItem *currItem) |
1459 | { |
||
17826 | craig | 1460 | scrActions["editMark"]->setEnabled(false); |
18794 | jghali | 1461 | |
1462 | PageItem* item = currItem; |
||
1463 | bool inEditMode = (doc->appMode == modeEdit); |
||
1464 | if (doc->appMode == modeEditTable) |
||
5800 | fschmid | 1465 | { |
18794 | jghali | 1466 | if (currItem->isTable()) |
1467 | item = currItem->asTable()->activeCell().textFrame(); |
||
1468 | inEditMode = item->isTextFrame(); |
||
1469 | } |
||
1470 | if (!item || item->itemText.length() <= 0) |
||
1471 | return; |
||
1472 | |||
22004 | jghali | 1473 | const ParagraphStyle& currPStyle(inEditMode ? item->currentStyle() : item->itemText.defaultStyle()); |
18794 | jghali | 1474 | setAlignmentValue(currPStyle.alignment()); |
22228 | jghali | 1475 | |
1476 | // Assignment operator does not perform style context assignment |
||
1477 | // Do it in this case, otherwise we might get some crashes if previous |
||
1478 | // text object was deleted or things like that |
||
1479 | const ParagraphStyle& curStyle = item->currentStyle(); |
||
1480 | doc->currentStyle.setContext(curStyle.context()); |
||
1481 | doc->currentStyle = curStyle; |
||
21132 | jghali | 1482 | if (doc->appMode == modeEdit || doc->appMode == modeEditTable) |
1483 | item->currentTextProps(doc->currentStyle); |
||
1484 | else |
||
1485 | doc->currentStyle.charStyle().setStyle(item->currentCharStyle()); |
||
18794 | jghali | 1486 | emit TextStyle(doc->currentStyle); |
1487 | // to go: (av) |
||
21575 | craig | 1488 | textPalette->textPal->updateStyle(doc->currentStyle); |
18794 | jghali | 1489 | //check if mark in cursor place and enable editMark action |
1490 | if (doc->appMode == modeEdit && item->itemText.cursorPosition() < item->itemText.length()) |
||
1491 | { |
||
18920 | craig | 1492 | if (item->itemText.hasMark(item->itemText.cursorPosition())) |
17826 | craig | 1493 | { |
18920 | craig | 1494 | Mark* mark = item->itemText.mark(item->itemText.cursorPosition()); |
18794 | jghali | 1495 | scrActions["editMark"]->setEnabled(true); |
22516 | craig | 1496 | if ((mark->isType(MARKNoteMasterType) || mark->isType(MARKNoteFrameType)) && (mark->getNotePtr() != nullptr)) |
18920 | craig | 1497 | nsEditor->setNotesStyle(mark->getNotePtr()->notesStyle()); |
17826 | craig | 1498 | } |
18794 | jghali | 1499 | else |
1500 | scrActions["editMark"]->setEnabled(false); |
||
5800 | fschmid | 1501 | } |
1502 | } |
||
1503 | |||
1504 | //Special keys assigned to actions are stolen by the action and not passed to |
||
1505 | //keyPressEvent so process them here. |
||
19100 | craig | 1506 | void ScribusMainWindow::specialActionKeyEvent(int unicodevalue) |
5800 | fschmid | 1507 | { |
19581 | craig | 1508 | if (!HaveDoc) |
1509 | return; |
||
22268 | craig | 1510 | if (doc->m_Selection->count() != 1) |
1511 | return; |
||
22893 | jghali | 1512 | if ((doc->appMode != modeEdit) && (doc->appMode != modeEditTable)) |
1513 | return; |
||
1514 | |||
22268 | craig | 1515 | PageItem* selItem = doc->m_Selection->itemAt(0); |
22893 | jghali | 1516 | if (!selItem->isTextFrame() && !selItem->isTable()) |
1517 | return; |
||
1518 | |||
1519 | PageItem_TextFrame *currItem; |
||
1520 | if (doc->appMode == modeEditTable) |
||
1521 | currItem = selItem->asTable()->activeCell().textFrame(); |
||
1522 | else |
||
1523 | currItem = selItem->asTextFrame(); |
||
1524 | if (currItem == nullptr) |
||
1525 | return; |
||
1526 | |||
1527 | if (unicodevalue!=-1) |
||
5800 | fschmid | 1528 | { |
22893 | jghali | 1529 | UndoTransaction activeTransaction; |
1530 | if (currItem->HasSel) |
||
5800 | fschmid | 1531 | { |
22893 | jghali | 1532 | if (UndoManager::undoEnabled()) |
1533 | activeTransaction = m_undoManager->beginTransaction(Um::Selection, Um::IGroup, Um::ReplaceText, "", Um::IDelete); |
||
1534 | currItem->deleteSelectedTextFromFrame(); |
||
1535 | } |
||
1536 | if (UndoManager::undoEnabled()) |
||
1537 | { |
||
1538 | SimpleState *ss = dynamic_cast<SimpleState*>(m_undoManager->getLastUndo()); |
||
1539 | if (ss && ss->get("ETEA") == "insert_frametext") |
||
1540 | ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(QChar(unicodevalue))); |
||
22894 | jghali | 1541 | else |
1542 | { |
||
22893 | jghali | 1543 | ss = new SimpleState(Um::InsertText,"",Um::ICreate); |
1544 | ss->set("INSERT_FRAMETEXT"); |
||
1545 | ss->set("ETEA", QString("insert_frametext")); |
||
1546 | ss->set("TEXT_STR", QString(QChar(unicodevalue))); |
||
1547 | ss->set("START", currItem->itemText.cursorPosition()); |
||
1548 | UndoObject * undoTarget = currItem; |
||
1549 | if (currItem->isNoteFrame()) |
||
5800 | fschmid | 1550 | { |
22893 | jghali | 1551 | undoTarget = doc; |
1552 | ss->set("noteframeName", currItem->getUName()); |
||
22268 | craig | 1553 | } |
22893 | jghali | 1554 | m_undoManager->action(undoTarget, ss); |
22268 | craig | 1555 | } |
22893 | jghali | 1556 | } |
1557 | currItem->itemText.insertChars(QString(QChar(unicodevalue)), true); |
||
1558 | if (activeTransaction) |
||
1559 | activeTransaction.commit(); |
||
1560 | } |
||
22894 | jghali | 1561 | else if (unicodevalue == SpecialChars::SHYPHEN.unicode()) //ignore the char as we use an attribute if the text item, for now. |
22893 | jghali | 1562 | { |
1563 | // this code is currently dead since unicodeSoftHyphen |
||
1564 | // doesn't have unicodevalue == -1 any more |
||
1565 | if (currItem->itemText.cursorPosition() <= 1) |
||
1566 | return; |
||
1567 | #if 0 |
||
1568 | StyleFlag fl = currItem->itemText.item(qMax(currItem->CPos-1,0))->effects(); |
||
1569 | fl |= ScStyle_HyphenationPossible; |
||
1570 | currItem->itemText.item(qMax(currItem->CPos-1,0))->setEffects(fl); |
||
1571 | #else |
||
1572 | if (UndoManager::undoEnabled()) |
||
1573 | { |
||
1574 | SimpleState *ss = dynamic_cast<SimpleState*>(m_undoManager->getLastUndo()); |
||
1575 | if (ss && ss->get("ETEA") == "insert_frametext") |
||
1576 | ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(SpecialChars::SHYPHEN)); |
||
1577 | else |
||
22268 | craig | 1578 | { |
22893 | jghali | 1579 | ss = new SimpleState(Um::InsertText,"", Um::ICreate); |
1580 | ss->set("INSERT_FRAMETEXT"); |
||
1581 | ss->set("ETEA", QString("insert_frametext")); |
||
1582 | ss->set("TEXT_STR", QString(SpecialChars::SHYPHEN)); |
||
1583 | ss->set("START", currItem->itemText.cursorPosition()); |
||
1584 | UndoObject * undoTarget = currItem; |
||
1585 | if (currItem->isNoteFrame()) |
||
22268 | craig | 1586 | { |
22893 | jghali | 1587 | undoTarget = doc; |
1588 | ss->set("noteframeName", currItem->getUName()); |
||
5800 | fschmid | 1589 | } |
22893 | jghali | 1590 | m_undoManager->action(undoTarget, ss); |
5800 | fschmid | 1591 | } |
1592 | } |
||
22893 | jghali | 1593 | currItem->itemText.insertChars(QString(SpecialChars::SHYPHEN), true); |
1594 | #endif |
||
5800 | fschmid | 1595 | } |
22893 | jghali | 1596 | if (doc->appMode == modeEditTable) |
1597 | selItem->asTable()->update(); |
||
1598 | else |
||
1599 | currItem->update(); |
||
5800 | fschmid | 1600 | } |
1601 | |||
1602 | bool ScribusMainWindow::eventFilter( QObject* /*o*/, QEvent *e ) |
||
1603 | { |
||
1604 | bool retVal; |
||
9562 | fschmid | 1605 | if (e->type() == QEvent::ToolTip) |
20691 | craig | 1606 | return (!m_prefsManager->appPrefs.displayPrefs.showToolTips); |
19581 | craig | 1607 | |
11960 | subik | 1608 | if ( e->type() == QEvent::KeyPress ) |
11893 | cbradney | 1609 | { |
22289 | craig | 1610 | QKeyEvent *k = dynamic_cast<QKeyEvent *>(e); |
22313 | craig | 1611 | if (!k) |
1612 | return false; |
||
5800 | fschmid | 1613 | int keyMod=0; |
10390 | cbradney | 1614 | if (k->modifiers() & Qt::ShiftModifier) |
8523 | cbradney | 1615 | keyMod |= Qt::SHIFT; |
10390 | cbradney | 1616 | if (k->modifiers() & Qt::ControlModifier) |
8523 | cbradney | 1617 | keyMod |= Qt::CTRL; |
10390 | cbradney | 1618 | if (k->modifiers() & Qt::AltModifier) |
8523 | cbradney | 1619 | keyMod |= Qt::ALT; |
5800 | fschmid | 1620 | |
1621 | QKeySequence currKeySeq = QKeySequence(k->key() | keyMod); |
||
18194 | fschmid | 1622 | if (QString(currKeySeq.toString()).isNull()) |
1623 | return false; |
||
5800 | fschmid | 1624 | retVal=true; |
1625 | //Palette actions |
||
19304 | craig | 1626 | if (actionManager->compareKeySeqToShortcut(currKeySeq, "specialToggleAllPalettes")) |
8613 | cbradney | 1627 | scrActions["specialToggleAllPalettes"]->activate(QAction::Trigger); |
5800 | fschmid | 1628 | else |
19304 | craig | 1629 | if (actionManager->compareKeySeqToShortcut(currKeySeq, "specialToggleAllGuides")) |
15302 | cbradney | 1630 | scrActions["specialToggleAllGuides"]->activate(QAction::Trigger); |
1631 | else |
||
18920 | craig | 1632 | retVal=false; |
5800 | fschmid | 1633 | } |
1634 | else |
||
1635 | retVal=false; |
||
1636 | //Return false to pass event to object |
||
1637 | return retVal; |
||
1638 | } |
||
1639 | |||
10532 | avox | 1640 | |
16546 | jghali | 1641 | void ScribusMainWindow::inputMethodEvent ( QInputMethodEvent * event ) |
1642 | { |
||
17761 | jghali | 1643 | //qDebug() << "IMEmw" << event->commitString() << event->preeditString() << "attributes:" << event->attributes().count(); |
16546 | jghali | 1644 | } |
1645 | |||
1646 | QVariant ScribusMainWindow::inputMethodQuery ( Qt::InputMethodQuery query ) const |
||
1647 | { |
||
17761 | jghali | 1648 | //qDebug() << "IMQmw" << query; |
16546 | jghali | 1649 | return QVariant(); |
1650 | } |
||
1651 | |||
10532 | avox | 1652 | //AV -> CanvasMode |
5800 | fschmid | 1653 | void ScribusMainWindow::keyPressEvent(QKeyEvent *k) |
1654 | { |
||
13950 | fschmid | 1655 | QList<QMdiSubWindow *> windows; |
22516 | craig | 1656 | QMdiSubWindow* w = nullptr; |
5800 | fschmid | 1657 | int kk = k->key(); |
7435 | fschmid | 1658 | if (HaveDoc) |
1659 | { |
||
8523 | cbradney | 1660 | if ((doc->appMode == modeMagnifier) && (kk == Qt::Key_Shift)) |
7435 | fschmid | 1661 | { |
21740 | craig | 1662 | view->setCursor(IconManager::instance()->loadCursor("lupezm.png")); |
7435 | fschmid | 1663 | return; |
1664 | } |
||
1665 | } |
||
20691 | craig | 1666 | if (m_keyrep) |
5800 | fschmid | 1667 | return; |
20691 | craig | 1668 | m_keyrep = true; |
10390 | cbradney | 1669 | int keyMod=0; |
1670 | if (k->modifiers() & Qt::ShiftModifier) |
||
1671 | keyMod |= Qt::SHIFT; |
||
1672 | if (k->modifiers() & Qt::ControlModifier) |
||
1673 | keyMod |= Qt::CTRL; |
||
1674 | if (k->modifiers() & Qt::AltModifier) |
||
1675 | keyMod |= Qt::ALT; |
||
5800 | fschmid | 1676 | //User presses escape and we have a doc open, and we have an item selected |
8523 | cbradney | 1677 | if ((kk == Qt::Key_Escape) && (HaveDoc)) |
5800 | fschmid | 1678 | { |
20691 | craig | 1679 | m_keyrep = false; |
5800 | fschmid | 1680 | PageItem *currItem; |
18871 | craig | 1681 | if (!doc->m_Selection->isEmpty()) |
5800 | fschmid | 1682 | { |
1683 | currItem = doc->m_Selection->itemAt(0); |
||
1684 | switch (doc->appMode) |
||
1685 | { |
||
1686 | case modeNormal: |
||
10532 | avox | 1687 | case modeEditClip: |
5800 | fschmid | 1688 | currItem->Sizing = false; |
1689 | if (doc->SubMode != -1) |
||
1690 | { |
||
1691 | view->Deselect(false); |
||
16943 | fschmid | 1692 | doc->Items->removeOne(currItem); |
5800 | fschmid | 1693 | } |
5967 | fschmid | 1694 | else |
1695 | view->Deselect(false); |
||
11576 | avox | 1696 | view->cancelGroupTransaction(); |
5800 | fschmid | 1697 | break; |
7436 | fschmid | 1698 | case modeEdit: |
11576 | avox | 1699 | view->cancelGroupTransaction(); |
7436 | fschmid | 1700 | break; |
17094 | jghali | 1701 | case modeCopyProperties: |
1702 | case modeEditGradientVectors: |
||
1703 | case modeEditMeshGradient: |
||
5800 | fschmid | 1704 | case modeLinkFrames: |
1705 | case modeUnlinkFrames: |
||
1706 | case modeRotation: |
||
1707 | view->Deselect(false); |
||
17094 | jghali | 1708 | case modeEditWeldPoint: |
12022 | cbradney | 1709 | case modeEyeDropper: |
12971 | jghali | 1710 | case modeImportObject: |
17735 | craig | 1711 | case modeImportImage: |
5800 | fschmid | 1712 | case modePanning: |
11490 | avox | 1713 | view->requestMode(modeNormal); |
5800 | fschmid | 1714 | break; |
1715 | case modeDrawBezierLine: |
||
1716 | break; |
||
1717 | default: |
||
11704 | fschmid | 1718 | if (currItem->Sizing) |
1719 | { |
||
1720 | view->Deselect(false); |
||
16943 | fschmid | 1721 | doc->Items->removeOne(currItem); |
11704 | fschmid | 1722 | } |
5800 | fschmid | 1723 | break; |
1724 | } |
||
1725 | } |
||
1726 | doc->DragP = false; |
||
1727 | doc->leaveDrag = false; |
||
10532 | avox | 1728 | view->stopAllDrags(); |
5800 | fschmid | 1729 | doc->SubMode = -1; |
22516 | craig | 1730 | doc->ElemToLink = nullptr; |
5800 | fschmid | 1731 | slotSelect(); |
18871 | craig | 1732 | if (doc->m_Selection->isEmpty()) |
19288 | jghali | 1733 | HaveNewSel(); |
20691 | craig | 1734 | m_prefsManager->appPrefs.uiPrefs.stickyTools = false; |
13955 | cbradney | 1735 | scrActions["stickyTools"]->setChecked(false); |
5800 | fschmid | 1736 | return; |
1737 | } |
||
10390 | cbradney | 1738 | Qt::KeyboardModifiers buttonModifiers = k->modifiers(); |
5800 | fschmid | 1739 | /**If we have a doc and we are not changing the page or zoom level in the status bar */ |
18972 | craig | 1740 | if ((HaveDoc) && (!zoomSpinBox->hasFocus()) && (!pageSelector->hasFocus())) |
5800 | fschmid | 1741 | { |
11146 | cbradney | 1742 | //Show our context menu |
19304 | craig | 1743 | if (actionManager->compareKeySeqToShortcut(kk, buttonModifiers, "viewShowContextMenu")) |
11146 | cbradney | 1744 | { |
22516 | craig | 1745 | ContextMenu* cmen=nullptr; |
18871 | craig | 1746 | if (doc->m_Selection->isEmpty()) |
11146 | cbradney | 1747 | { |
1748 | //CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPos()); |
||
1749 | QPoint p(QCursor::pos() - mapToGlobal(QPoint(0,0))); |
||
1750 | FPoint fp(p.x() / view->scale() + doc->minCanvasCoordinate.x(), |
||
11960 | subik | 1751 | p.y() / view->scale() + doc->minCanvasCoordinate.y()); |
11146 | cbradney | 1752 | cmen = new ContextMenu(this, doc, fp.x(), fp.y()); |
1753 | } |
||
1754 | else |
||
1755 | cmen = new ContextMenu(*(doc->m_Selection), this, doc); |
||
1756 | if (cmen) |
||
1757 | { |
||
1758 | setUndoMode(true); |
||
1759 | cmen->exec(QCursor::pos()); |
||
1760 | setUndoMode(false); |
||
1761 | } |
||
1762 | delete cmen; |
||
1763 | } |
||
11960 | subik | 1764 | |
1765 | |||
5800 | fschmid | 1766 | /** |
1767 | * With no item selected we can: |
||
1768 | * - With space, get into panning mode (modePanning) |
||
1769 | * - With PageUp, scroll up |
||
1770 | * - With PageDown, scroll down |
||
1771 | * - With Tab, change active document windowActivated |
||
1772 | */ |
||
1773 | |||
18871 | craig | 1774 | if ((doc->appMode != modeEdit) && (doc->m_Selection->isEmpty())) |
5800 | fschmid | 1775 | { |
6284 | fschmid | 1776 | int pg; |
20691 | craig | 1777 | int wheelVal = m_prefsManager->mouseWheelJump(); |
10390 | cbradney | 1778 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
8970 | fschmid | 1779 | wheelVal = qMax(qRound(wheelVal / 10.0), 1); |
5800 | fschmid | 1780 | switch (kk) |
1781 | { |
||
8523 | cbradney | 1782 | case Qt::Key_Space: |
20691 | craig | 1783 | m_keyrep = false; |
5800 | fschmid | 1784 | if (doc->appMode == modePanning) |
10532 | avox | 1785 | view->requestMode(modeNormal); |
5800 | fschmid | 1786 | else |
10532 | avox | 1787 | view->requestMode(modePanning); |
5800 | fschmid | 1788 | return; |
1789 | break; |
||
10564 | fschmid | 1790 | case Qt::Key_PageUp: |
17410 | fschmid | 1791 | if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode()) |
20691 | craig | 1792 | view->scrollBy(0, -m_prefsManager->mouseWheelJump()); |
6284 | fschmid | 1793 | else |
1794 | { |
||
1795 | pg = doc->currentPageNumber(); |
||
10390 | cbradney | 1796 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6284 | fschmid | 1797 | pg--; |
1798 | else |
||
15407 | craig | 1799 | pg -= doc->pageSets()[doc->pagePositioning()].Columns; |
6284 | fschmid | 1800 | if (pg > -1) |
1801 | view->GotoPage(pg); |
||
1802 | } |
||
20691 | craig | 1803 | m_keyrep = false; |
5800 | fschmid | 1804 | return; |
1805 | break; |
||
10564 | fschmid | 1806 | case Qt::Key_PageDown: |
17410 | fschmid | 1807 | if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode()) |
20691 | craig | 1808 | view->scrollBy(0, m_prefsManager->mouseWheelJump()); |
6284 | fschmid | 1809 | else |
1810 | { |
||
1811 | pg = doc->currentPageNumber(); |
||
10390 | cbradney | 1812 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6284 | fschmid | 1813 | pg++; |
1814 | else |
||
15407 | craig | 1815 | pg += doc->pageSets()[doc->pagePositioning()].Columns; |
7328 | fschmid | 1816 | if (pg < static_cast<int>(doc->Pages->count())) |
6284 | fschmid | 1817 | view->GotoPage(pg); |
1818 | } |
||
20691 | craig | 1819 | m_keyrep = false; |
5800 | fschmid | 1820 | return; |
1821 | break; |
||
8970 | fschmid | 1822 | case Qt::Key_Left: |
1823 | view->scrollBy(-wheelVal, 0); |
||
20691 | craig | 1824 | m_keyrep = false; |
8970 | fschmid | 1825 | return; |
1826 | break; |
||
1827 | case Qt::Key_Right: |
||
1828 | view->scrollBy(wheelVal, 0); |
||
20691 | craig | 1829 | m_keyrep = false; |
8970 | fschmid | 1830 | return; |
1831 | break; |
||
1832 | case Qt::Key_Up: |
||
1833 | view->scrollBy(0, -wheelVal); |
||
20691 | craig | 1834 | m_keyrep = false; |
8970 | fschmid | 1835 | return; |
1836 | break; |
||
1837 | case Qt::Key_Down: |
||
1838 | view->scrollBy(0, wheelVal); |
||
20691 | craig | 1839 | m_keyrep = false; |
8970 | fschmid | 1840 | return; |
1841 | break; |
||
8523 | cbradney | 1842 | case Qt::Key_Tab: |
14034 | jghali | 1843 | if (buttonModifiers == Qt::ControlModifier) |
5800 | fschmid | 1844 | { |
20691 | craig | 1845 | m_keyrep = false; |
14034 | jghali | 1846 | windows = mdiArea->subWindowList(); |
1847 | if (windows.count() > 1) |
||
5800 | fschmid | 1848 | { |
14034 | jghali | 1849 | for (int i = 0; i < static_cast<int>(windows.count()); ++i) |
5800 | fschmid | 1850 | { |
14034 | jghali | 1851 | if (mdiArea->activeSubWindow() == windows.at(i)) |
1852 | { |
||
1853 | if (i == static_cast<int>(windows.count()-1)) |
||
1854 | w = windows.at(0); |
||
1855 | else |
||
1856 | w = windows.at(i+1); |
||
1857 | break; |
||
1858 | } |
||
5800 | fschmid | 1859 | } |
14034 | jghali | 1860 | outlinePalette->buildReopenVals(); |
1861 | docCheckerPalette->clearErrorList(); |
||
1862 | if ( w ) |
||
1863 | w->showNormal(); |
||
1864 | newActWin(w); |
||
5800 | fschmid | 1865 | } |
14034 | jghali | 1866 | return; |
5800 | fschmid | 1867 | } |
1868 | break; |
||
1869 | } |
||
1870 | } |
||
1871 | } |
||
22724 | jghali | 1872 | switch (kk) |
5800 | fschmid | 1873 | { |
8523 | cbradney | 1874 | case Qt::Key_Left: |
1875 | case Qt::Key_Right: |
||
1876 | case Qt::Key_Up: |
||
1877 | case Qt::Key_Down: |
||
20691 | craig | 1878 | m__arrowKeyDown = true; |
5800 | fschmid | 1879 | } |
20691 | craig | 1880 | m_keyrep = false; |
5800 | fschmid | 1881 | } |
1882 | |||
1883 | void ScribusMainWindow::keyReleaseEvent(QKeyEvent *k) |
||
1884 | { |
||
10390 | cbradney | 1885 | //Exit out of panning mode if Control is release while the right mouse button is pressed |
1886 | if (HaveDoc) |
||
5800 | fschmid | 1887 | { |
10390 | cbradney | 1888 | if ((doc->appMode == modePanning) && (k->key() == Qt::Key_Control) && (QApplication::mouseButtons() & Qt::RightButton)) |
10532 | avox | 1889 | view->requestMode(modeNormal); |
22268 | craig | 1890 | |
7435 | fschmid | 1891 | if (doc->appMode == modeMagnifier) |
21740 | craig | 1892 | view->setCursor(IconManager::instance()->loadCursor("lupez.png")); |
7435 | fschmid | 1893 | } |
20691 | craig | 1894 | if (k->isAutoRepeat() || !m__arrowKeyDown) |
5800 | fschmid | 1895 | return; |
22724 | jghali | 1896 | switch (k->key()) |
5800 | fschmid | 1897 | { |
8523 | cbradney | 1898 | case Qt::Key_Left: |
1899 | case Qt::Key_Right: |
||
1900 | case Qt::Key_Up: |
||
1901 | case Qt::Key_Down: |
||
20691 | craig | 1902 | m__arrowKeyDown = false; |
18972 | craig | 1903 | if ((HaveDoc) && (!zoomSpinBox->hasFocus()) && (!pageSelector->hasFocus())) |
5800 | fschmid | 1904 | { |
10390 | cbradney | 1905 | int docSelectionCount=doc->m_Selection->count(); |
10532 | avox | 1906 | if ((docSelectionCount != 0) && (doc->appMode == modeEditClip) && (doc->nodeEdit.hasNodeSelected())) |
9735 | fschmid | 1907 | { |
1908 | PageItem *currItem = doc->m_Selection->itemAt(0); |
||
1909 | double xposOrig = currItem->xPos(); |
||
1910 | double yposOrig = currItem->yPos(); |
||
20694 | craig | 1911 | doc->adjustItemSize(currItem); |
19946 | craig | 1912 | if (!doc->nodeEdit.isContourLine()) |
9735 | fschmid | 1913 | currItem->ContourLine.translate(xposOrig - currItem->xPos(),yposOrig - currItem->yPos()); |
10532 | avox | 1914 | currItem->update(); |
9735 | fschmid | 1915 | } |
10390 | cbradney | 1916 | for (int i = 0; i < docSelectionCount; ++i) |
5800 | fschmid | 1917 | doc->m_Selection->itemAt(i)->checkChanges(true); |
1918 | if (docSelectionCount > 1 && view->groupTransactionStarted()) |
||
11576 | avox | 1919 | view->endGroupTransaction(); |
5800 | fschmid | 1920 | } |
1921 | break; |
||
1922 | } |
||
1923 | } |
||
1924 | |||
10859 | cbradney | 1925 | void ScribusMainWindow::changeEvent(QEvent *e) |
1926 | { |
||
1927 | if (e->type() == QEvent::LanguageChange) |
||
1928 | languageChange(); |
||
10903 | cbradney | 1929 | else |
1930 | QWidget::changeEvent(e); |
||
10859 | cbradney | 1931 | } |
1932 | |||
5800 | fschmid | 1933 | void ScribusMainWindow::closeEvent(QCloseEvent *ce) |
1934 | { |
||
13487 | cbradney | 1935 | //Do not quit if Preferences or new doc window is open |
14658 | cbradney | 1936 | PreferencesDialog *prefsDialog = findChild<PreferencesDialog *>(QString::fromLocal8Bit("PreferencesDialog")); |
13487 | cbradney | 1937 | NewDoc *newDocWin = findChild<NewDoc *>(QString::fromLocal8Bit("NewDocumentWindow")); |
22516 | craig | 1938 | if (prefsDialog!=nullptr || newDocWin!=nullptr) |
13478 | cbradney | 1939 | { |
1940 | ce->ignore(); |
||
1941 | return; |
||
1942 | } |
||
13959 | jghali | 1943 | QList<QMdiSubWindow *> windows = mdiArea->subWindowList(); |
5800 | fschmid | 1944 | ScribusWin* tw; |
13 |