Rev 22396 | Rev 22453 | 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> |
119 | Franz | 93 | #include <signal.h> |
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 | |
2536 | cbradney | 293 | extern ScribusQApp* ScQApp; |
2634 | cbradney | 294 | extern bool emergencyActivated; |
3 | paul | 295 | |
10532 | avox | 296 | |
4026 | craig | 297 | ScribusMainWindow::ScribusMainWindow() |
2161 | cbradney | 298 | { |
5781 | cbradney | 299 | actionManager=0; |
19495 | craig | 300 | appModeHelper=0; |
5781 | cbradney | 301 | scrMenuMgr=0; |
20691 | craig | 302 | m_prefsManager=0; |
303 | m_formatsManager=0; |
||
19821 | craig | 304 | resourceManager=0; |
10311 | cbradney | 305 | UrlLauncher::instance(); |
20691 | craig | 306 | m_mainWindowStatusLabel=0; |
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 |
22204 | jghali | 313 | m_doc = 0; |
314 | m_tocGenerator = 0; |
||
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); |
||
339 | m_doc->setGUI(false, this, 0); |
||
355 | Franz | 340 | CurrStED = NULL; |
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); |
13959 | jghali | 393 | connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(newActWin(QMdiSubWindow *))); |
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 | |
15946 | jghali | 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 | { |
||
18646 | jghali | 466 | if (actionManager) |
467 | delete actionManager; |
||
19495 | craig | 468 | if (appModeHelper) |
469 | delete appModeHelper; |
||
22204 | jghali | 470 | if (m_doc) |
471 | delete m_doc; |
||
472 | if (m_tocGenerator) |
||
473 | delete m_tocGenerator; |
||
5800 | fschmid | 474 | } |
475 | |||
11040 | fschmid | 476 | void ScribusMainWindow::addScToolBar(ScToolBar *tb, QString name) |
477 | { |
||
478 | if (!scrToolBars.contains(name)) |
||
479 | scrToolBars.insert(name, tb); |
||
480 | addToolBar(tb); |
||
481 | } |
||
5800 | fschmid | 482 | |
483 | void ScribusMainWindow::initToolBars() |
||
484 | { |
||
10976 | cbradney | 485 | fileToolBar = new FileToolBar(this); |
486 | editToolBar = new EditToolBar(this); |
||
5800 | fschmid | 487 | UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget"); |
20691 | craig | 488 | m_undoManager->registerGui(uWidget); |
10976 | cbradney | 489 | modeToolBar = new ModeToolBar(this); |
5800 | fschmid | 490 | pdfToolBar = new PDFToolBar(this); |
19009 | craig | 491 | viewToolBar = new ViewToolBar(this); |
10953 | subik | 492 | |
15260 | cbradney | 493 | addScToolBar(fileToolBar, fileToolBar->objectName()); |
494 | addScToolBar(editToolBar, editToolBar->objectName()); |
||
495 | addScToolBar(modeToolBar, modeToolBar->objectName()); |
||
496 | addScToolBar(pdfToolBar, pdfToolBar->objectName()); |
||
19009 | craig | 497 | addScToolBar(viewToolBar, viewToolBar->objectName()); |
10976 | cbradney | 498 | connect(modeToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarTools"], SLOT(setChecked(bool))); |
10734 | jghali | 499 | connect(scrActions["toolsToolbarPDF"], SIGNAL(toggled(bool)), pdfToolBar, SLOT(setVisible(bool))); |
10969 | subik | 500 | connect(pdfToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarPDF"], SLOT(setChecked(bool))); |
10976 | cbradney | 501 | connect(scrActions["toolsToolbarTools"], SIGNAL(toggled(bool)), modeToolBar, SLOT(setVisible(bool)) ); |
19009 | craig | 502 | connect(viewToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarView"], SLOT(setChecked(bool))); |
503 | connect(scrActions["toolsToolbarView"], SIGNAL(toggled(bool)), viewToolBar, SLOT(setVisible(bool)) ); |
||
5800 | fschmid | 504 | } |
505 | |||
20196 | craig | 506 | void ScribusMainWindow::setStyleSheet() |
507 | { |
||
508 | QByteArray stylesheet; |
||
509 | if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet)) |
||
510 | { |
||
511 | QString downArrow(IconManager::instance()->pathForIcon("16/go-down.png")); |
||
512 | QByteArray da; |
||
513 | da.append(downArrow); |
||
514 | stylesheet.replace("___downArrow___", da); |
||
515 | QString toolbararrow(IconManager::instance()->pathForIcon("stylesheet/down_arrow.png")); |
||
516 | QByteArray tba; |
||
517 | tba.append(toolbararrow); |
||
518 | stylesheet.replace("___tb_menu_arrow___", tba); |
||
519 | } |
||
10532 | avox | 520 | |
20196 | craig | 521 | layerMenu->setStyleSheet(stylesheet); |
522 | unitSwitcher->setStyleSheet(stylesheet); |
||
523 | zoomDefaultToolbarButton->setStyleSheet(stylesheet); |
||
524 | zoomInToolbarButton->setStyleSheet(stylesheet); |
||
525 | zoomOutToolbarButton->setStyleSheet(stylesheet); |
||
526 | zoomSpinBox->setStyleSheet(stylesheet); |
||
527 | |||
528 | fileToolBar->setStyleSheet(stylesheet); |
||
529 | editToolBar->setStyleSheet(stylesheet); |
||
530 | modeToolBar->setStyleSheet(stylesheet); |
||
531 | pdfToolBar->setStyleSheet(stylesheet); |
||
532 | viewToolBar->setStyleSheet(stylesheet); |
||
533 | } |
||
534 | |||
535 | |||
5800 | fschmid | 536 | void ScribusMainWindow::initDefaultValues() |
537 | { |
||
538 | HaveDoc = false; |
||
539 | view = NULL; |
||
540 | doc = NULL; |
||
20691 | craig | 541 | m_DocNr = 1; |
542 | m_PrinterUsed = false; |
||
5800 | fschmid | 543 | PDef.Pname = ""; |
544 | PDef.Dname = ""; |
||
545 | PDef.Command = ""; |
||
20691 | craig | 546 | m_keyrep = false; |
547 | m__arrowKeyDown = false; |
||
5800 | fschmid | 548 | ClipB = QApplication::clipboard(); |
22067 | jghali | 549 | for (int i=0; i<PAL_MAX ; ++i) |
20691 | craig | 550 | m_palettesStatus[i] = false; |
19853 | craig | 551 | for (int i=0; i<GS_MAX ; ++i) |
20691 | craig | 552 | m_guidesStatus[i] = false; |
17781 | fschmid | 553 | #ifdef HAVE_OSG |
18207 | fschmid | 554 | QStringList supportedExts; |
555 | supportedExts << "osg" << "dxf" << "flt" << "ive" << "geo" << "sta" << "stl" << "logo" << "3ds" << "ac" << "obj"; |
||
556 | QStringList realSupportedExts; |
||
557 | QMap<QString, QString> formats; |
||
558 | osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins(); |
||
559 | for(osgDB::FileNameList::iterator itr = plugins.begin(); itr != plugins.end(); ++itr) |
||
560 | { |
||
561 | osgDB::ReaderWriterInfoList infoList; |
||
562 | if (QString::fromStdString(*itr).contains("qfont")) |
||
563 | continue; |
||
564 | if (osgDB::queryPlugin(*itr, infoList)) |
||
17781 | fschmid | 565 | { |
18207 | fschmid | 566 | for(osgDB::ReaderWriterInfoList::iterator rwi_itr = infoList.begin(); rwi_itr != infoList.end(); ++rwi_itr) |
17781 | fschmid | 567 | { |
18207 | fschmid | 568 | osgDB::ReaderWriterInfo& info = *(*rwi_itr); |
569 | osgDB::ReaderWriter::FormatDescriptionMap::iterator fdm_itr; |
||
570 | for(fdm_itr = info.extensions.begin(); fdm_itr != info.extensions.end(); ++fdm_itr) |
||
17781 | fschmid | 571 | { |
18207 | fschmid | 572 | if (supportedExts.contains(QString::fromStdString(fdm_itr->first))) |
573 | 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 | 574 | } |
575 | } |
||
576 | } |
||
18207 | fschmid | 577 | } |
578 | realSupportedExts = formats.keys(); |
||
579 | QString docexts = realSupportedExts.join(" "); |
||
580 | QStringList longList = formats.values(); |
||
581 | QString longDesc = longList.join(";;") + ";;"; |
||
20695 | craig | 582 | m_osgFilterString = tr("All Supported Formats (%1);;%2All Files (*)").arg(docexts).arg(longDesc); |
17781 | fschmid | 583 | #endif |
5800 | fschmid | 584 | } |
585 | |||
10532 | avox | 586 | |
5800 | fschmid | 587 | void ScribusMainWindow::initKeyboardShortcuts() |
588 | { |
||
8501 | cbradney | 589 | for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrActions.begin(); it!=scrActions.end(); ++it ) |
5800 | fschmid | 590 | { |
10516 | cbradney | 591 | if ((ScrAction*)(it.value())!=NULL) |
5800 | fschmid | 592 | { |
18194 | fschmid | 593 | QString accelerator = it.value()->shortcut().toString(); |
20691 | craig | 594 | m_prefsManager->setKeyEntry(it.key(), it.value()->cleanMenuText(), accelerator,0); |
5800 | fschmid | 595 | } |
596 | //else |
||
13085 | jghali | 597 | // qDebug() << it.key(); |
598 | //qDebug() << QString("|-\n|%1||%2||%3").arg(it.key()).arg(it.value()->cleanMenuText()).arg(QString(it.data()->accel())); |
||
5800 | fschmid | 599 | } |
600 | } |
||
601 | |||
10532 | avox | 602 | |
5800 | fschmid | 603 | void ScribusMainWindow::initPalettes() |
604 | { |
||
605 | //CB TODO hide the publicly available members of some palettes |
||
606 | // these must be filtered too as they take control of the palettes events |
||
10862 | cbradney | 607 | outlinePalette = new OutlinePalette(this); |
5800 | fschmid | 608 | outlinePalette->setMainWindow(this); |
609 | connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 610 | connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setChecked(bool))); |
16546 | jghali | 611 | |
10862 | cbradney | 612 | propertiesPalette = new PropertiesPalette(this); |
5800 | fschmid | 613 | propertiesPalette->setMainWindow(this); |
614 | connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 615 | connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setChecked(bool))); |
16546 | jghali | 616 | emit UpdateRequest(reqDefFontListUpdate); |
5800 | fschmid | 617 | propertiesPalette->installEventFilter(this); |
21575 | craig | 618 | |
619 | textPalette = new TextPalette(this); |
||
620 | textPalette->setMainWindow(this); |
||
621 | connect( scrActions["toolsText"], SIGNAL(toggled(bool)) , textPalette, SLOT(setPaletteShown(bool)) ); |
||
622 | connect( textPalette, SIGNAL(paletteShown(bool)), scrActions["toolsText"], SLOT(setChecked(bool))); |
||
623 | emit UpdateRequest(reqDefFontListUpdate); |
||
624 | textPalette->installEventFilter(this); |
||
5800 | fschmid | 625 | nodePalette = new NodePalette(this); |
626 | nodePalette->installEventFilter(this); |
||
627 | layerPalette = new LayerPalette(this); |
||
628 | guidePalette = new GuideManager(this); |
||
7087 | subik | 629 | charPalette = new CharSelect(this); |
5800 | fschmid | 630 | connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) ); |
10581 | cbradney | 631 | connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setChecked(bool))); |
5800 | fschmid | 632 | layerPalette->installEventFilter(this); |
633 | layerPalette->Table->installEventFilter(this); |
||
634 | scrapbookPalette = new Biblio(this); |
||
635 | connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 636 | connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setChecked(bool))); |
11554 | fschmid | 637 | connect( scrapbookPalette, SIGNAL(pasteToActualPage(QString)), this, SLOT(pasteFromScrapbook(QString))); |
18924 | craig | 638 | connect( scrapbookPalette, SIGNAL(scrapbookListChanged()), this, SLOT(rebuildScrapbookMenu())); |
5800 | fschmid | 639 | scrapbookPalette->installEventFilter(this); |
640 | pagePalette = new PagePalette(this); |
||
641 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 642 | connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setChecked(bool))); |
5800 | fschmid | 643 | pagePalette->installEventFilter(this); |
644 | bookmarkPalette = new BookPalette(this); |
||
645 | connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 646 | connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setChecked(bool))); |
5800 | fschmid | 647 | bookmarkPalette->installEventFilter(this); |
19783 | craig | 648 | downloadsPalette = new DownloadsPalette(this); |
649 | connect( scrActions["toolsDownloads"], SIGNAL(toggled(bool)) , downloadsPalette, SLOT(setPaletteShown(bool)) ); |
||
650 | connect( downloadsPalette, SIGNAL(paletteShown(bool)), scrActions["toolsDownloads"], SLOT(setChecked(bool))); |
||
651 | downloadsPalette->installEventFilter(this); |
||
5800 | fschmid | 652 | connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool, int)) , this, SLOT(setAppModeByToggle(bool, int)) ); |
653 | docCheckerPalette = new CheckDocument(this, false); |
||
654 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) ); |
||
655 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , this, SLOT(docCheckToggle(bool)) ); |
||
10581 | cbradney | 656 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setChecked(bool))); |
5800 | fschmid | 657 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool))); |
658 | docCheckerPalette->installEventFilter(this); |
||
659 | docCheckerPalette->hide(); |
||
660 | |||
18194 | fschmid | 661 | alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette"); |
5800 | fschmid | 662 | connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) ); |
10581 | cbradney | 663 | connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setChecked(bool))); |
5800 | fschmid | 664 | connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh())); |
665 | alignDistributePalette->installEventFilter(this); |
||
7087 | subik | 666 | |
15060 | fschmid | 667 | symbolPalette = new SymbolPalette(this); |
668 | symbolPalette->setMainWindow(this); |
||
16029 | fschmid | 669 | connect(scrActions["toolsSymbols"], SIGNAL(toggled(bool)), symbolPalette, SLOT(setPaletteShown(bool))); |
670 | connect(symbolPalette, SIGNAL(paletteShown(bool)), scrActions["toolsSymbols"], SLOT(setChecked(bool))); |
||
671 | connect(symbolPalette, SIGNAL(startEdit(QString)), this, SLOT(editSymbolStart(QString))); |
||
672 | connect(symbolPalette, SIGNAL(endEdit()), this, SLOT(editSymbolEnd())); |
||
17793 | fschmid | 673 | connect(symbolPalette, SIGNAL(objectDropped()), this, SLOT(PutToPatterns())); |
15060 | fschmid | 674 | symbolPalette->installEventFilter(this); |
675 | symbolPalette->hide(); |
||
17405 | fschmid | 676 | |
677 | inlinePalette = new InlinePalette(this); |
||
678 | inlinePalette->setMainWindow(this); |
||
679 | connect(scrActions["toolsInline"], SIGNAL(toggled(bool)), inlinePalette, SLOT(setPaletteShown(bool))); |
||
680 | connect(inlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsInline"], SLOT(setChecked(bool))); |
||
17410 | fschmid | 681 | connect(inlinePalette, SIGNAL(startEdit(int)), this, SLOT(editInlineStart(int))); |
682 | connect(inlinePalette, SIGNAL(endEdit()), this, SLOT(editInlineEnd())); |
||
17804 | fschmid | 683 | connect(inlinePalette, SIGNAL(objectDropped(QString)), this, SLOT(PutToInline(QString))); |
17405 | fschmid | 684 | inlinePalette->installEventFilter(this); |
685 | inlinePalette->hide(); |
||
15060 | fschmid | 686 | |
5800 | fschmid | 687 | undoPalette = new UndoPalette(this, "undoPalette"); |
688 | undoPalette->installEventFilter(this); |
||
20691 | craig | 689 | m_undoManager->registerGui(undoPalette); |
5800 | fschmid | 690 | connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); |
691 | connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); |
||
692 | |||
693 | // initializing style manager here too even it's not strictly a palette |
||
20691 | craig | 694 | m_styleManager = new StyleManager(this, "styleManager"); |
7063 | tsoots | 695 | SMCharacterStyle *tmpCS = new SMCharacterStyle(); |
21374 | jghali | 696 | m_styleManager->addStyle(new SMParagraphStyle(tmpCS)); |
20691 | craig | 697 | m_styleManager->addStyle(tmpCS); |
698 | m_styleManager->addStyle(new SMTableStyle()); |
||
699 | m_styleManager->addStyle(new SMCellStyle()); |
||
700 | m_styleManager->addStyle(new SMLineStyle()); |
||
701 | connect( scrActions["editStyles"], SIGNAL(toggled(bool)), m_styleManager, SLOT(setPaletteShown(bool)) ); |
||
702 | connect( m_styleManager, SIGNAL(paletteShown(bool)), scrActions["editStyles"], SLOT(setChecked(bool))); |
||
703 | m_styleManager->installEventFilter(this); |
||
5800 | fschmid | 704 | |
17826 | craig | 705 | // initializing mark`s manager |
706 | marksManager = new MarksManager(this, "marksManager"); |
||
707 | connect( scrActions["editMarks"], SIGNAL(toggled(bool)), marksManager, SLOT(setPaletteShown(bool)) ); |
||
708 | connect( marksManager, SIGNAL(paletteShown(bool)), scrActions["editMarks"], SLOT(setChecked(bool))); |
||
709 | marksManager->installEventFilter(this); |
||
710 | // initializing notes styles manager |
||
711 | nsEditor = new NotesStylesEditor(this, "notesStylesEditor"); |
||
712 | connect( scrActions["editNotesStyles"], SIGNAL(toggled(bool)), nsEditor, SLOT(setPaletteShown(bool)) ); |
||
713 | connect( nsEditor, SIGNAL(paletteShown(bool)), scrActions["editNotesStyles"], SLOT(setChecked(bool))); |
||
714 | nsEditor->installEventFilter(this); |
||
715 | |||
16122 | fschmid | 716 | connect(docCheckerPalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); |
17013 | fschmid | 717 | connect(docCheckerPalette, SIGNAL(selectElement(PageItem *, bool, int)), this, SLOT(selectItemFromOutlines(PageItem *, bool, int))); |
5800 | fschmid | 718 | connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
18888 | craig | 719 | connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(editMasterPagesStart(QString))); |
16122 | fschmid | 720 | connect(outlinePalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); |
16999 | fschmid | 721 | connect(outlinePalette, SIGNAL(editElementByItem(PageItem *)), this, SLOT(editItemsFromOutlines(PageItem *))); |
5800 | fschmid | 722 | connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
18888 | craig | 723 | connect(outlinePalette, SIGNAL(selectMasterPage(QString)), this, SLOT(editMasterPagesStart(QString))); |
16546 | jghali | 724 | connect(nodePalette, SIGNAL(paletteClosed()), this, SLOT(slotSelect())); |
5800 | fschmid | 725 | connect(nodePalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
726 | connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
||
727 | |||
22396 | jghali | 728 | connect(bookmarkPalette->BView, SIGNAL(markMoved()), this, SLOT(StoreBookmarks())); |
5800 | fschmid | 729 | connect(bookmarkPalette->BView, SIGNAL(changed()), this, SLOT(slotDocCh())); |
22396 | jghali | 730 | connect(bookmarkPalette->BView, SIGNAL(selectElement(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); |
5800 | fschmid | 731 | // guides |
732 | connect(scrActions["pageManageGuides"], SIGNAL(toggled(bool)), guidePalette, SLOT(setPaletteShown(bool))); |
||
10581 | cbradney | 733 | connect(guidePalette, SIGNAL(paletteShown(bool)), scrActions["pageManageGuides"], SLOT(setChecked(bool))); |
7087 | subik | 734 | // char palette |
735 | connect(scrActions["insertGlyph"], SIGNAL(toggled(bool)), charPalette, SLOT(setPaletteShown(bool))); |
||
10581 | cbradney | 736 | connect(charPalette, SIGNAL(paletteShown(bool)), scrActions["insertGlyph"], SLOT(setChecked(bool))); |
5800 | fschmid | 737 | } |
738 | |||
10532 | avox | 739 | |
5800 | fschmid | 740 | void ScribusMainWindow::initScrapbook() |
741 | { |
||
20691 | craig | 742 | QString scrapbookFileO = QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrap13.scs"); |
5800 | fschmid | 743 | QFileInfo scrapbookFileInfoO = QFileInfo(scrapbookFileO); |
744 | if (scrapbookFileInfoO.exists()) |
||
745 | { |
||
21591 | jghali | 746 | scrapbookPalette->readOldContents(scrapbookFileO, ScPaths::scrapbookDir(true) + "main"); |
5800 | fschmid | 747 | QDir d = QDir(); |
20691 | craig | 748 | d.rename(scrapbookFileO, QDir::toNativeSeparators(m_prefsManager->preferencesLocation()+"/scrap13.backup")); |
5800 | fschmid | 749 | } |
21591 | jghali | 750 | QString scrapbookTemp = QDir::toNativeSeparators(ScPaths::scrapbookDir(true) + "tmp"); |
5800 | fschmid | 751 | QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp); |
752 | if (scrapbookTempInfo.exists()) |
||
753 | scrapbookPalette->readTempContents(scrapbookTemp); |
||
21591 | jghali | 754 | QString scrapbookFile = QDir::toNativeSeparators(ScPaths::scrapbookDir(true) + "main"); |
5800 | fschmid | 755 | QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile); |
756 | if (scrapbookFileInfo.exists()) |
||
757 | scrapbookPalette->readContents(scrapbookFile); |
||
758 | scrapbookPalette->setScrapbookFileName(scrapbookFile); |
||
15527 | fschmid | 759 | ScCore->fileWatcher->addDir(scrapbookFile, true); |
20691 | craig | 760 | scrapbookPalette->setOpenScrapbooks(m_prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks); |
5800 | fschmid | 761 | rebuildRecentPasteMenu(); |
5806 | fschmid | 762 | connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu())); |
15526 | fschmid | 763 | connect(ScCore->fileWatcher, SIGNAL(dirChanged(QString )), scrapbookPalette, SLOT(reloadLib(QString ))); |
15527 | fschmid | 764 | connect(ScCore->fileWatcher, SIGNAL(dirDeleted(QString )), scrapbookPalette, SLOT(closeOnDel(QString ))); |
5800 | fschmid | 765 | } |
766 | |||
10532 | avox | 767 | |
5800 | fschmid | 768 | bool ScribusMainWindow::warningVersion(QWidget *parent) |
769 | { |
||
770 | bool retval = false; |
||
19605 | jghali | 771 | int t = ScMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" + |
17948 | jghali | 772 | 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 | 773 | QMessageBox::Ok | QMessageBox::Cancel, |
774 | QMessageBox::Cancel, // GUI default |
||
775 | QMessageBox::Ok); // batch default |
||
9422 | fschmid | 776 | if (t == QMessageBox::Ok) |
5800 | fschmid | 777 | retval = true; |
778 | return retval; |
||
779 | } |
||
780 | |||
22076 | jghali | 781 | void ScribusMainWindow::initMdiArea() |
782 | { |
||
783 | mdiArea = new QMdiArea(this); |
||
784 | mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
||
785 | mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
||
786 | if (m_prefsManager->appPrefs.uiPrefs.useTabs) |
||
787 | { |
||
788 | mdiArea->setViewMode(QMdiArea::TabbedView); |
||
789 | mdiArea->setTabsClosable(true); |
||
790 | mdiArea->setDocumentMode(true); |
||
791 | } |
||
792 | else |
||
793 | mdiArea->setViewMode(QMdiArea::SubWindowView); |
||
794 | setCentralWidget(mdiArea); |
||
795 | } |
||
10532 | avox | 796 | |
5800 | fschmid | 797 | void ScribusMainWindow::initMenuBar() |
798 | { |
||
799 | RecentDocs.clear(); |
||
12940 | cbradney | 800 | scrMenuMgr->createMenu("File", ActionManager::defaultMenuNameEntryTranslated("File")); |
18533 | craig | 801 | scrMenuMgr->addMenuItemString("fileNew", "File"); |
802 | scrMenuMgr->addMenuItemString("fileNewFromTemplate", "File"); |
||
803 | scrMenuMgr->addMenuItemString("fileOpen", "File"); |
||
804 | scrMenuMgr->addMenuItemString("FileOpenRecent", "File"); |
||
18583 | craig | 805 | scrMenuMgr->createMenu("FileOpenRecent", tr("Open &Recent"), "File", false, true); |
18533 | craig | 806 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
807 | scrMenuMgr->addMenuItemString("fileClose", "File"); |
||
808 | scrMenuMgr->addMenuItemString("fileSave", "File"); |
||
809 | scrMenuMgr->addMenuItemString("fileSaveAs", "File"); |
||
810 | scrMenuMgr->addMenuItemString("fileRevert", "File"); |
||
811 | scrMenuMgr->addMenuItemString("fileCollect", "File"); |
||
812 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
||
10558 | cbradney | 813 | scrMenuMgr->createMenu("FileImport", tr("&Import"), "File"); |
18533 | craig | 814 | scrMenuMgr->addMenuItemString("FileImport", "File"); |
815 | scrMenuMgr->addMenuItemString("fileImportText", "FileImport"); |
||
816 | scrMenuMgr->addMenuItemString("fileImportAppendText", "FileImport"); |
||
817 | scrMenuMgr->addMenuItemString("fileImportImage", "FileImport"); |
||
818 | scrMenuMgr->addMenuItemString("fileImportVector", "FileImport"); |
||
819 | scrMenuMgr->addMenuItemString("FileExport", "File"); |
||
10558 | cbradney | 820 | scrMenuMgr->createMenu("FileExport", tr("&Export"), "File"); |
18533 | craig | 821 | scrMenuMgr->addMenuItemString("fileExportText", "FileExport"); |
822 | scrMenuMgr->addMenuItemString("fileExportAsEPS", "FileExport"); |
||
823 | scrMenuMgr->addMenuItemString("fileExportAsPDF", "FileExport"); |
||
824 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
||
825 | scrMenuMgr->addMenuItemString("fileDocSetup150", "File"); |
||
826 | scrMenuMgr->addMenuItemString("filePreferences150", "File"); |
||
827 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
||
828 | scrMenuMgr->addMenuItemString("filePrint", "File"); |
||
19179 | craig | 829 | if ( ScCore->haveGS() || ScCore->isWinGUI() ) |
830 | scrMenuMgr->addMenuItemString("PrintPreview", "File"); |
||
18533 | craig | 831 | scrMenuMgr->addMenuItemString("SEPARATOR", "File"); |
832 | scrMenuMgr->addMenuItemString("fileQuit", "File"); |
||
5800 | fschmid | 833 | |
6451 | fschmid | 834 | scrMenuMgr->setMenuEnabled("FileImport", false); |
5800 | fschmid | 835 | scrMenuMgr->setMenuEnabled("FileExport", false); |
836 | |||
12940 | cbradney | 837 | scrMenuMgr->createMenu("Edit", ActionManager::defaultMenuNameEntryTranslated("Edit")); |
18533 | craig | 838 | scrMenuMgr->addMenuItemString("editUndoAction", "Edit"); |
839 | scrMenuMgr->addMenuItemString("editRedoAction", "Edit"); |
||
840 | scrMenuMgr->addMenuItemString("editActionMode", "Edit"); |
||
841 | scrMenuMgr->addMenuItemString("SEPARATOR", "Edit"); |
||
842 | scrMenuMgr->addMenuItemString("editCut", "Edit"); |
||
843 | scrMenuMgr->addMenuItemString("editCopy", "Edit"); |
||
844 | scrMenuMgr->addMenuItemString("editPaste", "Edit"); |
||
18583 | craig | 845 | scrMenuMgr->createMenu("EditPasteRecent", tr("Paste Recent"), "Edit",false,true); |
10558 | cbradney | 846 | scrMenuMgr->createMenu("EditContents", tr("Contents"), "Edit"); |
18533 | craig | 847 | scrMenuMgr->addMenuItemString("editCopyContents", "EditContents"); |
848 | scrMenuMgr->addMenuItemString("editPasteContents", "EditContents"); |
||
849 | scrMenuMgr->addMenuItemString("editPasteContentsAbs", "EditContents"); |
||
850 | scrMenuMgr->addMenuItemString("editClearContents", "EditContents"); |
||
19188 | craig | 851 | scrMenuMgr->addMenuItemString("editTruncateContents", "EditTruncateContents"); |
18533 | craig | 852 | scrMenuMgr->addMenuItemString("itemDelete", "Edit"); |
853 | scrMenuMgr->addMenuItemString("SEPARATOR", "Edit"); |
||
854 | scrMenuMgr->addMenuItemString("editSelectAll", "Edit"); |
||
855 | scrMenuMgr->addMenuItemString("editSelectAllOnLayer", "Edit"); |
||
856 | scrMenuMgr->addMenuItemString("editDeselectAll", "Edit"); |
||
857 | scrMenuMgr->addMenuItemString("SEPARATOR", "Edit"); |
||
858 | scrMenuMgr->addMenuItemString("editSearchReplace", "Edit"); |
||
859 | scrMenuMgr->addMenuItemString("toolsEditWithStoryEditor", "Edit"); |
||
860 | scrMenuMgr->addMenuItemString("editEditWithImageEditor", "Edit"); |
||
861 | scrMenuMgr->addMenuItemString("editEditRenderSource", "Edit"); |
||
862 | scrMenuMgr->addMenuItemString("SEPARATOR", "Edit"); |
||
21928 | craig | 863 | scrMenuMgr->addMenuItemString("editColorsAndFills", "Edit"); |
18533 | craig | 864 | scrMenuMgr->addMenuItemString("editReplaceColors", "Edit"); |
865 | scrMenuMgr->addMenuItemString("editStyles", "Edit"); |
||
866 | scrMenuMgr->addMenuItemString("editMarks", "Edit"); |
||
867 | scrMenuMgr->addMenuItemString("editNotesStyles", "Edit"); |
||
868 | scrMenuMgr->addMenuItemString("editMasterPages", "Edit"); |
||
869 | scrMenuMgr->addMenuItemString("editJavascripts", "Edit"); |
||
5827 | fschmid | 870 | scrMenuMgr->setMenuEnabled("EditPasteRecent", false); |
7565 | cbradney | 871 | scrMenuMgr->setMenuEnabled("EditContents", false); |
5800 | fschmid | 872 | |
18756 | craig | 873 | |
5800 | fschmid | 874 | //Item Menu |
12940 | cbradney | 875 | scrMenuMgr->createMenu("Item", ActionManager::defaultMenuNameEntryTranslated("Item")); |
18070 | fschmid | 876 | scrMenuMgr->createMenu("DuplicateTransform", tr("Duplicate/Transform"), "Item"); |
18533 | craig | 877 | scrMenuMgr->addMenuItemString("DuplicateTransform", "Item"); |
878 | scrMenuMgr->addMenuItemString("itemDuplicate", "DuplicateTransform"); |
||
879 | scrMenuMgr->addMenuItemString("itemMulDuplicate", "DuplicateTransform"); |
||
880 | scrMenuMgr->addMenuItemString("itemTransform", "DuplicateTransform"); |
||
18070 | fschmid | 881 | scrMenuMgr->createMenu("Grouping", tr("Grouping"), "Item"); |
18533 | craig | 882 | scrMenuMgr->addMenuItemString("Grouping", "Item"); |
883 | scrMenuMgr->addMenuItemString("itemGroup", "Grouping"); |
||
884 | scrMenuMgr->addMenuItemString("itemUngroup", "Grouping"); |
||
885 | scrMenuMgr->addMenuItemString("itemGroupAdjust", "Grouping"); |
||
18070 | fschmid | 886 | scrMenuMgr->createMenu("Locking", tr("Locking"), "Item"); |
18533 | craig | 887 | scrMenuMgr->addMenuItemString("Locking", "Item"); |
888 | scrMenuMgr->addMenuItemString("itemLock", "Locking"); |
||
889 | scrMenuMgr->addMenuItemString("itemLockSize", "Locking"); |
||
18070 | fschmid | 890 | scrMenuMgr->createMenu("ItemLevel", tr("Level"), "Item"); |
18533 | craig | 891 | scrMenuMgr->addMenuItemString("ItemLevel", "Item"); |
18547 | craig | 892 | scrMenuMgr->addMenuItemString("itemRaise", "ItemLevel"); |
893 | scrMenuMgr->addMenuItemString("itemLower", "ItemLevel"); |
||
894 | scrMenuMgr->addMenuItemString("itemRaiseToTop", "ItemLevel"); |
||
895 | scrMenuMgr->addMenuItemString("itemLowerToBottom", "ItemLevel"); |
||
18583 | craig | 896 | scrMenuMgr->createMenu("ItemLayer", tr("Send to La&yer"), "",false, true); |
18533 | craig | 897 | scrMenuMgr->addMenuItemString("ItemLayer", "Item"); |
18070 | fschmid | 898 | scrMenuMgr->createMenu("SendTo", tr("Send to"), "Item"); |
18533 | craig | 899 | scrMenuMgr->addMenuItemString("SendTo", "Item"); |
18582 | craig | 900 | scrMenuMgr->createMenu("ItemSendToScrapbook", tr("Scrapbook"),"",false,true); |
18539 | craig | 901 | scrMenuMgr->addMenuItemString("ItemSendToScrapbook", "SendTo"); |
18533 | craig | 902 | scrMenuMgr->addMenuItemString("itemSendToPattern", "SendTo"); |
903 | scrMenuMgr->addMenuItemString("itemSendToInline", "SendTo"); |
||
18070 | fschmid | 904 | scrMenuMgr->createMenu("Adjust", tr("Adjust"), "Item"); |
18533 | craig | 905 | scrMenuMgr->addMenuItemString("Adjust", "Item"); |
906 | scrMenuMgr->addMenuItemString("itemAdjustFrameHeightToText", "Adjust"); |
||
907 | scrMenuMgr->addMenuItemString("itemAdjustFrameToImage", "Adjust"); |
||
908 | scrMenuMgr->addMenuItemString("itemAdjustImageToFrame", "Adjust"); |
||
18070 | fschmid | 909 | scrMenuMgr->createMenu("Image", tr("Image"), "Item"); |
18533 | craig | 910 | scrMenuMgr->addMenuItemString("Image", "Item"); |
911 | scrMenuMgr->addMenuItemString("itemUpdateImage", "Image"); |
||
912 | scrMenuMgr->addMenuItemString("styleImageEffects", "Image"); |
||
913 | scrMenuMgr->addMenuItemString("itemExtendedImageProperties", "Image"); |
||
914 | scrMenuMgr->addMenuItemString("itemToggleInlineImage", "Image"); |
||
19253 | craig | 915 | scrMenuMgr->createMenu("ItemPreviewSettings", tr("Preview Settings")); |
18533 | craig | 916 | scrMenuMgr->addMenuItemString("ItemPreviewSettings", "Image"); |
917 | scrMenuMgr->addMenuItemString("itemImageIsVisible", "ItemPreviewSettings"); |
||
918 | scrMenuMgr->addMenuItemString("SEPARATOR", "ItemPreviewSettings"); |
||
19465 | jghali | 919 | scrMenuMgr->addMenuItemString("itemPreviewFull", "ItemPreviewSettings"); |
920 | scrMenuMgr->addMenuItemString("itemPreviewNormal", "ItemPreviewSettings"); |
||
18533 | craig | 921 | scrMenuMgr->addMenuItemString("itemPreviewLow", "ItemPreviewSettings"); |
5800 | fschmid | 922 | scrMenuMgr->createMenu("ItemPDFOptions", tr("&PDF Options")); |
18533 | craig | 923 | scrMenuMgr->addMenuItemString("ItemPDFOptions", "Item"); |
924 | scrMenuMgr->addMenuItemString("itemPDFIsAnnotation", "ItemPDFOptions"); |
||
925 | scrMenuMgr->addMenuItemString("itemPDFIsBookmark", "ItemPDFOptions"); |
||
926 | scrMenuMgr->addMenuItemString("itemPDFAnnotationProps", "ItemPDFOptions"); |
||
927 | scrMenuMgr->addMenuItemString("itemPDFFieldProps", "ItemPDFOptions"); |
||
19436 | jghali | 928 | scrMenuMgr->createMenu("ItemConvertTo", tr("C&onvert to"), "Item"); |
18533 | craig | 929 | scrMenuMgr->addMenuItemString("ItemConvertTo", "Item"); |
18629 | craig | 930 | scrMenuMgr->addMenuItemString("itemConvertToTextFrame", "ItemConvertTo"); |
931 | scrMenuMgr->addMenuItemString("itemConvertToImageFrame", "ItemConvertTo"); |
||
932 | scrMenuMgr->addMenuItemString("itemConvertToPolygon", "ItemConvertTo"); |
||
18533 | craig | 933 | scrMenuMgr->addMenuItemString("itemConvertToBezierCurve", "ItemConvertTo"); |
934 | scrMenuMgr->addMenuItemString("itemConvertToOutlines", "ItemConvertTo"); |
||
935 | scrMenuMgr->addMenuItemString("itemConvertToSymbolFrame", "ItemConvertTo"); |
||
18070 | fschmid | 936 | scrMenuMgr->createMenu("TextLinking", tr("Text Frame Links"), "Item"); |
18533 | craig | 937 | scrMenuMgr->addMenuItemString("TextLinking", "Item"); |
938 | scrMenuMgr->addMenuItemString("toolsLinkTextFrame", "TextLinking"); |
||
939 | scrMenuMgr->addMenuItemString("toolsUnlinkTextFrame", "TextLinking"); |
||
21468 | jghali | 940 | scrMenuMgr->addMenuItemString("toolsUnlinkTextFrameAndCutText", "TextLinking"); |
18070 | fschmid | 941 | scrMenuMgr->createMenu("ItemPathOps", tr("Path Tools"), "Item"); |
18533 | craig | 942 | scrMenuMgr->addMenuItemString("ItemPathOps", "Item"); |
943 | scrMenuMgr->addMenuItemString("itemCombinePolygons", "ItemPathOps"); |
||
944 | scrMenuMgr->addMenuItemString("itemSplitPolygons", "ItemPathOps"); |
||
945 | scrMenuMgr->addMenuItemString("itemAttachTextToPath", "ItemPathOps"); |
||
946 | scrMenuMgr->addMenuItemString("itemDetachTextFromPath", "ItemPathOps"); |
||
15108 | cbradney | 947 | |
5800 | fschmid | 948 | scrActions["itemPrintingEnabled"]->setEnabled(false); |
949 | scrMenuMgr->setMenuEnabled("ItemConvertTo", false); |
||
950 | |||
18070 | fschmid | 951 | scrMenuMgr->createMenu("Weld", tr("Welding"), "Item"); |
18533 | craig | 952 | scrMenuMgr->addMenuItemString("Weld", "Item"); |
18629 | craig | 953 | scrMenuMgr->addMenuItemString("itemWeld", "Weld"); |
18533 | craig | 954 | scrMenuMgr->addMenuItemString("itemsUnWeld", "Weld"); |
955 | scrMenuMgr->addMenuItemString("itemEditWeld", "Weld"); |
||
956 | scrMenuMgr->addMenuItemString("editMark", "Item"); |
||
17826 | craig | 957 | |
5800 | fschmid | 958 | //Insert menu |
12940 | cbradney | 959 | scrMenuMgr->createMenu("Insert", ActionManager::defaultMenuNameEntryTranslated("Insert")); |
18533 | craig | 960 | scrMenuMgr->addMenuItemString("insertFrame", "Insert"); |
961 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
||
962 | scrMenuMgr->addMenuItemString("toolsInsertTextFrame", "Insert"); |
||
963 | scrMenuMgr->addMenuItemString("toolsInsertImageFrame", "Insert"); |
||
964 | scrMenuMgr->addMenuItemString("toolsInsertRenderFrame", "Insert"); |
||
965 | scrMenuMgr->addMenuItemString("toolsInsertTable", "Insert"); |
||
966 | scrMenuMgr->addMenuItemString("toolsInsertShape", "Insert"); |
||
967 | scrMenuMgr->addMenuItemString("toolsInsertPolygon", "Insert"); |
||
968 | scrMenuMgr->addMenuItemString("toolsInsertArc", "Insert"); |
||
969 | scrMenuMgr->addMenuItemString("toolsInsertSpiral", "Insert"); |
||
970 | scrMenuMgr->addMenuItemString("toolsInsertLine", "Insert"); |
||
971 | scrMenuMgr->addMenuItemString("toolsInsertBezier", "Insert"); |
||
972 | scrMenuMgr->addMenuItemString("toolsInsertFreehandLine", "Insert"); |
||
973 | scrMenuMgr->addMenuItemString("toolsInsertCalligraphicLine", "Insert"); |
||
974 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
||
975 | scrMenuMgr->addMenuItemString("stickyTools", "Insert"); |
||
976 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
||
977 | scrMenuMgr->addMenuItemString("insertGlyph", "Insert"); |
||
5800 | fschmid | 978 | |
10558 | cbradney | 979 | scrMenuMgr->createMenu("InsertChar", tr("&Character"), "Insert"); |
18533 | craig | 980 | scrMenuMgr->addMenuItemString("InsertChar", "Insert"); |
981 | scrMenuMgr->addMenuItemString("unicodePageNumber", "InsertChar"); |
||
982 | scrMenuMgr->addMenuItemString("unicodePageCount", "InsertChar"); |
||
983 | scrMenuMgr->addMenuItemString("unicodeSoftHyphen", "InsertChar"); |
||
984 | scrMenuMgr->addMenuItemString("unicodeNonBreakingHyphen", "InsertChar"); |
||
21563 | jghali | 985 | scrMenuMgr->addMenuItemString("unicodeZWJ", "InsertChar"); |
986 | scrMenuMgr->addMenuItemString("unicodeZWNJ", "InsertChar"); |
||
18533 | craig | 987 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertChar"); |
988 | scrMenuMgr->addMenuItemString("unicodeCopyRight", "InsertChar"); |
||
989 | scrMenuMgr->addMenuItemString("unicodeRegdTM", "InsertChar"); |
||
990 | scrMenuMgr->addMenuItemString("unicodeTM", "InsertChar"); |
||
991 | scrMenuMgr->addMenuItemString("unicodeSolidus", "InsertChar"); |
||
992 | scrMenuMgr->addMenuItemString("unicodeBullet", "InsertChar"); |
||
993 | scrMenuMgr->addMenuItemString("unicodeMidpoint", "InsertChar"); |
||
994 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertChar"); |
||
995 | scrMenuMgr->addMenuItemString("unicodeDashEm", "InsertChar"); |
||
996 | scrMenuMgr->addMenuItemString("unicodeDashEn", "InsertChar"); |
||
997 | scrMenuMgr->addMenuItemString("unicodeDashFigure", "InsertChar"); |
||
998 | scrMenuMgr->addMenuItemString("unicodeDashQuotation", "InsertChar"); |
||
5800 | fschmid | 999 | |
10558 | cbradney | 1000 | scrMenuMgr->createMenu("InsertQuote", tr("&Quote"), "Insert"); |
18533 | craig | 1001 | scrMenuMgr->addMenuItemString("InsertQuote", "Insert"); |
1002 | scrMenuMgr->addMenuItemString("unicodeQuoteApostrophe", "InsertQuote"); |
||
1003 | scrMenuMgr->addMenuItemString("unicodeQuoteStraight", "InsertQuote"); |
||
1004 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1005 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleLeft", "InsertQuote"); |
||
1006 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleRight", "InsertQuote"); |
||
1007 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleLeft", "InsertQuote"); |
||
1008 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleRight", "InsertQuote"); |
||
1009 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1010 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleReversed", "InsertQuote"); |
||
1011 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleReversed", "InsertQuote"); |
||
1012 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1013 | scrMenuMgr->addMenuItemString("unicodeQuoteLowSingleComma", "InsertQuote"); |
||
1014 | scrMenuMgr->addMenuItemString("unicodeQuoteLowDoubleComma", "InsertQuote"); |
||
1015 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1016 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleLeftGuillemet", "InsertQuote"); |
||
1017 | scrMenuMgr->addMenuItemString("unicodeQuoteSingleRightGuillemet", "InsertQuote"); |
||
1018 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleLeftGuillemet", "InsertQuote"); |
||
1019 | scrMenuMgr->addMenuItemString("unicodeQuoteDoubleRightGuillemet", "InsertQuote"); |
||
1020 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertQuote"); |
||
1021 | scrMenuMgr->addMenuItemString("unicodeQuoteCJKSingleLeft", "InsertQuote"); |
||
1022 | scrMenuMgr->addMenuItemString("unicodeQuoteCJKSingleRight", "InsertQuote"); |
||
1023 | scrMenuMgr->addMenuItemString("unicodeQuoteCJKDoubleLeft", "InsertQuote"); |
||
1024 | scrMenuMgr->addMenuItemString("unicodeQuoteCJKDoubleRight", "InsertQuote"); |
||
5800 | fschmid | 1025 | |
21058 | craig | 1026 | scrMenuMgr->createMenu("InsertSpace", tr("S&paces && Breaks"), "Insert"); |
18533 | craig | 1027 | scrMenuMgr->addMenuItemString("InsertSpace", "Insert"); |
1028 | scrMenuMgr->addMenuItemString("unicodeNonBreakingSpace", "InsertSpace"); |
||
1029 | scrMenuMgr->addMenuItemString("unicodeSpaceEN", "InsertSpace"); |
||
1030 | scrMenuMgr->addMenuItemString("unicodeSpaceEM", "InsertSpace"); |
||
1031 | scrMenuMgr->addMenuItemString("unicodeSpaceThin", "InsertSpace"); |
||
1032 | scrMenuMgr->addMenuItemString("unicodeSpaceThick", "InsertSpace"); |
||
1033 | scrMenuMgr->addMenuItemString("unicodeSpaceMid", "InsertSpace"); |
||
1034 | scrMenuMgr->addMenuItemString("unicodeSpaceHair", "InsertSpace"); |
||
1035 | scrMenuMgr->addMenuItemString("SEPARATOR", "InsertSpace"); |
||
1036 | scrMenuMgr->addMenuItemString("unicodeNewLine", "InsertSpace"); |
||
1037 | scrMenuMgr->addMenuItemString("unicodeFrameBreak", "InsertSpace"); |
||
1038 | scrMenuMgr->addMenuItemString("unicodeColumnBreak", "InsertSpace"); |
||
1039 | scrMenuMgr->addMenuItemString("unicodeZerowidthSpace", "InsertSpace"); |
||
5800 | fschmid | 1040 | |
10558 | cbradney | 1041 | scrMenuMgr->createMenu("InsertLigature", tr("Liga&ture"), "Insert"); |
18533 | craig | 1042 | scrMenuMgr->addMenuItemString("InsertLigature", "Insert"); |
1043 | scrMenuMgr->addMenuItemString("unicodeLigature_ff", "InsertLigature"); |
||
1044 | scrMenuMgr->addMenuItemString("unicodeLigature_fi", "InsertLigature"); |
||
1045 | scrMenuMgr->addMenuItemString("unicodeLigature_fl", "InsertLigature"); |
||
1046 | scrMenuMgr->addMenuItemString("unicodeLigature_ffi", "InsertLigature"); |
||
1047 | scrMenuMgr->addMenuItemString("unicodeLigature_ffl", "InsertLigature"); |
||
1048 | scrMenuMgr->addMenuItemString("unicodeLigature_ft", "InsertLigature"); |
||
1049 | scrMenuMgr->addMenuItemString("unicodeLigature_st", "InsertLigature"); |
||
5800 | fschmid | 1050 | |
18533 | craig | 1051 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
1052 | scrMenuMgr->addMenuItemString("insertSampleText", "Insert"); |
||
1053 | scrMenuMgr->addMenuItemString("SEPARATOR", "Insert"); |
||
17826 | craig | 1054 | scrMenuMgr->createMenu("InsertMark", tr("Marks"), "Insert"); |
18533 | craig | 1055 | scrMenuMgr->addMenuItemString("InsertMark", "Insert"); |
1056 | scrMenuMgr->addMenuItemString("insertMarkAnchor", "InsertMark"); |
||
21460 | jghali | 1057 | scrMenuMgr->addMenuItemString("insertMarkNote", "InsertMark"); |
1058 | scrMenuMgr->addMenuItemString("insertMarkItem", "InsertMark"); |
||
18914 | craig | 1059 | scrMenuMgr->addMenuItemString("insertMark2Mark", "InsertMark"); |
18533 | craig | 1060 | scrMenuMgr->addMenuItemString("insertMarkVariableText", "InsertMark"); |
5800 | fschmid | 1061 | |
1062 | //Page menu |
||
12940 | cbradney | 1063 | scrMenuMgr->createMenu("Page", ActionManager::defaultMenuNameEntryTranslated("Page")); |
18533 | craig | 1064 | scrMenuMgr->addMenuItemString("pageInsert", "Page"); |
1065 | scrMenuMgr->addMenuItemString("pageImport", "Page"); |
||
1066 | scrMenuMgr->addMenuItemString("pageDelete", "Page"); |
||
1067 | scrMenuMgr->addMenuItemString("pageCopy", "Page"); |
||
1068 | scrMenuMgr->addMenuItemString("pageMove", "Page"); |
||
1069 | scrMenuMgr->addMenuItemString("SEPARATOR", "Page"); |
||
1070 | scrMenuMgr->addMenuItemString("pageApplyMasterPage", "Page"); |
||
1071 | scrMenuMgr->addMenuItemString("pageCopyToMasterPage", "Page"); |
||
1072 | scrMenuMgr->addMenuItemString("pageManageGuides", "Page"); |
||
19907 | craig | 1073 | scrMenuMgr->addMenuItemString("pageManageProperties", "Page"); |
18533 | craig | 1074 | scrMenuMgr->addMenuItemString("SEPARATOR", "Page"); |
1075 | scrMenuMgr->addMenuItemString("viewSnapToGrid", "Page"); |
||
1076 | scrMenuMgr->addMenuItemString("viewSnapToGuides", "Page"); |
||
1077 | scrMenuMgr->addMenuItemString("viewSnapToElements", "Page"); |
||
5800 | fschmid | 1078 | |
1079 | //View menu |
||
12940 | cbradney | 1080 | scrMenuMgr->createMenu("View", ActionManager::defaultMenuNameEntryTranslated("View")); |
18249 | craig | 1081 | scrMenuMgr->createMenu("ViewZoom", tr("Zoom"), "View"); |
18533 | craig | 1082 | scrMenuMgr->addMenuItemString("ViewZoom", "View"); |
1083 | scrMenuMgr->addMenuItemString("viewFitInWindow", "ViewZoom"); |
||
1084 | scrMenuMgr->addMenuItemString("viewFitWidth", "ViewZoom"); |
||
1085 | scrMenuMgr->addMenuItemString("viewFit50", "ViewZoom"); |
||
1086 | scrMenuMgr->addMenuItemString("viewFit75", "ViewZoom"); |
||
1087 | scrMenuMgr->addMenuItemString("viewFit100", "ViewZoom"); |
||
1088 | scrMenuMgr->addMenuItemString("viewFit200", "ViewZoom"); |
||
1089 | scrMenuMgr->addMenuItemString("viewFit400", "ViewZoom"); |
||
18249 | craig | 1090 | scrMenuMgr->createMenu("ViewPreview", tr("Preview"), "View"); |
18533 | craig | 1091 | scrMenuMgr->addMenuItemString("ViewPreview", "View"); |
1092 | scrMenuMgr->addMenuItemString("viewPreviewMode", "ViewPreview"); |
||
20252 | craig | 1093 | scrMenuMgr->createMenu("ViewMeasuring", tr("Measurement"), "View"); |
18533 | craig | 1094 | scrMenuMgr->addMenuItemString("ViewMeasuring", "View"); |
1095 | scrMenuMgr->addMenuItemString("viewShowRulers", "ViewMeasuring"); |
||
1096 | scrMenuMgr->addMenuItemString("viewRulerMode", "ViewMeasuring"); |
||
1097 | scrMenuMgr->addMenuItemString("showMouseCoordinates", "ViewMeasuring"); |
||
18249 | craig | 1098 | scrMenuMgr->createMenu("ViewTextFrames", tr("Text Frames"), "View"); |
18533 | craig | 1099 | scrMenuMgr->addMenuItemString("ViewTextFrames", "View"); |
1100 | scrMenuMgr->addMenuItemString("viewShowBaseline", "ViewTextFrames"); |
||
1101 | scrMenuMgr->addMenuItemString("viewShowColumnBorders", "ViewTextFrames"); |
||
1102 | scrMenuMgr->addMenuItemString("viewShowTextChain", "ViewTextFrames"); |
||
1103 | scrMenuMgr->addMenuItemString("viewShowTextControls", "ViewTextFrames"); |
||
18249 | craig | 1104 | scrMenuMgr->createMenu("ViewImageFrames", tr("Image Frames"), "View"); |
18533 | craig | 1105 | scrMenuMgr->addMenuItemString("ViewImageFrames", "View"); |
1106 | scrMenuMgr->addMenuItemString("viewShowImages", "ViewImageFrames"); |
||
18249 | craig | 1107 | scrMenuMgr->createMenu("ViewDocument", tr("Document"), "View"); |
18533 | craig | 1108 | scrMenuMgr->addMenuItemString("ViewDocument", "View"); |
1109 | scrMenuMgr->addMenuItemString("viewShowMargins", "ViewDocument"); |
||
1110 | scrMenuMgr->addMenuItemString("viewShowBleeds", "ViewDocument"); |
||
1111 | scrMenuMgr->addMenuItemString("viewShowFrames", "ViewDocument"); |
||
1112 | scrMenuMgr->addMenuItemString("viewShowLayerMarkers", "ViewDocument"); |
||
18249 | craig | 1113 | scrMenuMgr->createMenu("ViewGrids", tr("Grids and Guides"), "View"); |
18533 | craig | 1114 | scrMenuMgr->addMenuItemString("ViewGrids", "View"); |
18545 | craig | 1115 | scrMenuMgr->addMenuItemString("viewShowGrid", "ViewGrids"); |
1116 | scrMenuMgr->addMenuItemString("viewShowGuides", "ViewGrids"); |
||
5800 | fschmid | 1117 | |
1118 | //CB If this is viewNewView imeplemented, it should be on the windows menu |
||
1119 | // scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View"); |
||
1120 | |||
18070 | fschmid | 1121 | // Table menu. |
1122 | scrMenuMgr->createMenu("ItemTable", ActionManager::defaultMenuNameEntryTranslated("Table")); |
||
18533 | craig | 1123 | scrMenuMgr->addMenuItemString("tableInsertRows", "ItemTable"); |
1124 | scrMenuMgr->addMenuItemString("tableInsertColumns", "ItemTable"); |
||
1125 | scrMenuMgr->addMenuItemString("tableDeleteRows", "ItemTable"); |
||
1126 | scrMenuMgr->addMenuItemString("tableDeleteColumns", "ItemTable"); |
||
1127 | scrMenuMgr->addMenuItemString("SEPARATOR", "ItemTable"); |
||
1128 | scrMenuMgr->addMenuItemString("tableMergeCells", "ItemTable"); |
||
1129 | scrMenuMgr->addMenuItemString("tableSplitCells", "ItemTable"); |
||
1130 | scrMenuMgr->addMenuItemString("SEPARATOR", "ItemTable"); |
||
1131 | scrMenuMgr->addMenuItemString("tableSetRowHeights", "ItemTable"); |
||
1132 | scrMenuMgr->addMenuItemString("tableSetColumnWidths", "ItemTable"); |
||
1133 | scrMenuMgr->addMenuItemString("tableDistributeRowsEvenly", "ItemTable"); |
||
1134 | scrMenuMgr->addMenuItemString("tableDistributeColumnsEvenly", "ItemTable"); |
||
1135 | scrMenuMgr->addMenuItemString("SEPARATOR", "ItemTable"); |
||
1136 | scrMenuMgr->addMenuItemString("tableAdjustFrameToTable", "ItemTable"); |
||
1137 | scrMenuMgr->addMenuItemString("tableAdjustTableToFrame", "ItemTable"); |
||
5800 | fschmid | 1138 | |
1139 | //Extra menu |
||
12940 | cbradney | 1140 | scrMenuMgr->createMenu("Extras", ActionManager::defaultMenuNameEntryTranslated("Extras")); |
18533 | craig | 1141 | scrMenuMgr->addMenuItemString("extrasHyphenateText", "Extras"); |
1142 | scrMenuMgr->addMenuItemString("extrasDeHyphenateText", "Extras"); |
||
1143 | scrMenuMgr->addMenuItemString("extrasGenerateTableOfContents", "Extras"); |
||
18586 | craig | 1144 | scrMenuMgr->addMenuItemString("itemUpdateMarks", "Extras"); |
1145 | scrMenuMgr->addMenuItemString("SEPARATOR", "Extras"); |
||
1146 | scrMenuMgr->addMenuItemString("extrasManageImages", "Extras"); |
||
1147 | scrMenuMgr->addMenuItemString("SEPARATOR", "Extras"); |
||
18533 | craig | 1148 | scrMenuMgr->addMenuItemString("extrasUpdateDocument", "Extras"); |
20998 | fschmid | 1149 | // Disabled for release as it does nothing useful |
1150 | // scrMenuMgr->addMenuItemString("extrasTestQTQuick2_1", "Extras"); |
||
5800 | fschmid | 1151 | |
1152 | //Window menu |
||
15117 | cbradney | 1153 | scrMenuMgr->createMenu("Windows", ActionManager::defaultMenuNameEntryTranslated("Windows"), QString::null, true); |
5800 | fschmid | 1154 | |
1155 | //Help menu |
||
12940 | cbradney | 1156 | scrMenuMgr->createMenu("Help", ActionManager::defaultMenuNameEntryTranslated("Help")); |
18533 | craig | 1157 | scrMenuMgr->addMenuItemString("helpManual", "Help"); |
20510 | craig | 1158 | scrMenuMgr->addMenuItemString("helpChat", "Help"); |
18533 | craig | 1159 | scrMenuMgr->addMenuItemString("SEPARATOR", "Help"); |
1160 | scrMenuMgr->addMenuItemString("helpTooltips", "Help"); |
||
1161 | scrMenuMgr->addMenuItemString("SEPARATOR", "Help"); |
||
1162 | scrMenuMgr->addMenuItemString("helpOnlineWWW", "Help"); |
||
1163 | scrMenuMgr->addMenuItemString("helpOnlineDocs", "Help"); |
||
1164 | scrMenuMgr->addMenuItemString("helpOnlineWiki", "Help"); |
||
1165 | scrMenuMgr->addMenuItemString("HelpOnlineTutorials", "Help"); |
||
1166 | scrMenuMgr->addMenuItemString("helpOnlineTutorial1", "Help"); |
||
1167 | scrMenuMgr->addMenuItemString("SEPARATOR", "Help"); |
||
1168 | scrMenuMgr->addMenuItemString("helpCheckUpdates", "Help"); |
||
1169 | scrMenuMgr->addMenuItemString("SEPARATOR", "Help"); |
||
1170 | scrMenuMgr->addMenuItemString("helpAboutScribus", "Help"); |
||
1171 | scrMenuMgr->addMenuItemString("helpAboutPlugins", "Help"); |
||
1172 | scrMenuMgr->addMenuItemString("helpAboutQt", "Help"); |
||
18548 | craig | 1173 | } |
10953 | subik | 1174 | |
18548 | craig | 1175 | void ScribusMainWindow::createMenuBar() |
1176 | { |
||
18533 | craig | 1177 | scrMenuMgr->addMenuStringToMenuBar("File"); |
1178 | scrMenuMgr->addMenuItemStringstoMenuBar("File", scrActions); |
||
1179 | scrMenuMgr->addMenuStringToMenuBar("Edit"); |
||
1180 | scrMenuMgr->addMenuItemStringstoMenuBar("Edit", scrActions); |
||
1181 | scrMenuMgr->addMenuStringToMenuBar("Item"); |
||
1182 | scrMenuMgr->addMenuItemStringstoMenuBar("Item", scrActions); |
||
1183 | scrMenuMgr->addMenuStringToMenuBar("Insert"); |
||
1184 | scrMenuMgr->addMenuItemStringstoMenuBar("Insert", scrActions); |
||
1185 | scrMenuMgr->addMenuStringToMenuBar("Page"); |
||
1186 | scrMenuMgr->addMenuItemStringstoMenuBar("Page", scrActions); |
||
1187 | scrMenuMgr->addMenuStringToMenuBar("ItemTable"); |
||
1188 | scrMenuMgr->addMenuItemStringstoMenuBar("ItemTable", scrActions); |
||
1189 | scrMenuMgr->addMenuStringToMenuBar("Extras"); |
||
1190 | scrMenuMgr->addMenuItemStringstoMenuBar("Extras", scrActions); |
||
1191 | scrMenuMgr->addMenuStringToMenuBar("View"); |
||
1192 | scrMenuMgr->addMenuItemStringstoMenuBar("View", scrActions); |
||
18583 | craig | 1193 | scrMenuMgr->addMenuStringToMenuBar("Windows", true); |
18533 | craig | 1194 | addDefaultWindowMenuItems(); |
10564 | fschmid | 1195 | menuBar()->addSeparator(); |
18533 | craig | 1196 | scrMenuMgr->addMenuStringToMenuBar("Help"); |
1197 | scrMenuMgr->addMenuItemStringstoMenuBar("Help", scrActions); |
||
18557 | craig | 1198 | connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow())); |
1199 | connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
||
1200 | |||
5800 | fschmid | 1201 | } |
1202 | |||
10532 | avox | 1203 | |
5800 | fschmid | 1204 | void ScribusMainWindow::addDefaultWindowMenuItems() |
1205 | { |
||
1206 | scrMenuMgr->clearMenu("Windows"); |
||
18533 | craig | 1207 | scrMenuMgr->addMenuItemString("windowsCascade", "Windows"); |
1208 | scrMenuMgr->addMenuItemString("windowsTile", "Windows"); |
||
1209 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
||
1210 | scrMenuMgr->addMenuItemString("toolsProperties", "Windows"); |
||
21575 | craig | 1211 | scrMenuMgr->addMenuItemString("toolsText", "Windows"); |
18533 | craig | 1212 | scrMenuMgr->addMenuItemString("toolsActionHistory", "Windows"); |
1213 | scrMenuMgr->addMenuItemString("toolsAlignDistribute", "Windows"); |
||
1214 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
||
1215 | scrMenuMgr->addMenuItemString("toolsOutline", "Windows"); |
||
1216 | scrMenuMgr->addMenuItemString("toolsPages", "Windows"); |
||
1217 | scrMenuMgr->addMenuItemString("toolsLayers", "Windows"); |
||
1218 | scrMenuMgr->addMenuItemString("toolsBookmarks", "Windows"); |
||
20039 | craig | 1219 | // scrMenuMgr->addMenuItemString("toolsDownloads", "Windows"); |
19821 | craig | 1220 | scrMenuMgr->addMenuItemString("toolsResources", "Windows"); |
18533 | craig | 1221 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
1222 | scrMenuMgr->addMenuItemString("toolsScrapbook", "Windows"); |
||
1223 | scrMenuMgr->addMenuItemString("toolsSymbols", "Windows"); |
||
1224 | scrMenuMgr->addMenuItemString("toolsInline", "Windows"); |
||
1225 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
||
1226 | scrMenuMgr->addMenuItemString("toolsMeasurements", "Windows"); |
||
1227 | scrMenuMgr->addMenuItemString("toolsPreflightVerifier", "Windows"); |
||
1228 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
||
1229 | scrMenuMgr->addMenuItemString("toolsToolbarTools", "Windows"); |
||
1230 | scrMenuMgr->addMenuItemString("toolsToolbarPDF", "Windows"); |
||
19009 | craig | 1231 | scrMenuMgr->addMenuItemString("toolsToolbarView", "Windows"); |
19962 | fschmid | 1232 | scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); |
18533 | craig | 1233 | scrMenuMgr->addMenuItemStringstoMenuBar("Windows", scrActions); |
5800 | fschmid | 1234 | } |
1235 | |||
1236 | |||
1237 | void ScribusMainWindow::initStatusBar() |
||
1238 | { |
||
18972 | craig | 1239 | QFont fo = QFont(font()); |
1240 | int posi = fo.pointSize() - (ScCore->isWinGUI() ? 1 : 2); |
||
1241 | fo.setPointSize(posi); |
||
1242 | unitSwitcher = new QComboBox( this ); |
||
19954 | craig | 1243 | unitSwitcher->setObjectName("unitSwitcher"); |
18972 | craig | 1244 | unitSwitcher->setFocusPolicy(Qt::NoFocus); |
1245 | unitSwitcher->setFont(fo); |
||
1246 | int maxUindex = unitGetMaxIndex() - 2; |
||
1247 | for (int i = 0; i <= maxUindex; ++i) |
||
1248 | unitSwitcher->addItem(unitGetStrFromIndex(i)); |
||
19954 | craig | 1249 | |
1250 | |||
1251 | QWidget* zoomWidget = new QWidget( statusBar() ); |
||
1252 | QHBoxLayout* zoomLayout = new QHBoxLayout( zoomWidget ); |
||
1253 | zoomLayout->setMargin(0); |
||
1254 | zoomLayout->setSpacing(1); |
||
1255 | |||
1256 | zoomSpinBox = new ScrSpinBox( 1, 32000, zoomWidget, 6 ); |
||
18972 | craig | 1257 | zoomSpinBox->setTabAdvance(false); |
1258 | zoomSpinBox->setFont(fo); |
||
1259 | zoomSpinBox->setValue( 100 ); |
||
1260 | zoomSpinBox->setSingleStep(10); |
||
1261 | zoomSpinBox->setFocusPolicy(Qt::ClickFocus); |
||
1262 | zoomSpinBox->setSuffix( tr( " %" ) ); |
||
1263 | layerMenu = new QComboBox( this ); |
||
19954 | craig | 1264 | layerMenu->setObjectName("layerMenu"); |
18972 | craig | 1265 | layerMenu->setEditable(false); |
1266 | layerMenu->setFont(fo); |
||
1267 | layerMenu->setFocusPolicy(Qt::NoFocus); |
||
1268 | layerMenu->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
||
1269 | |||
1270 | pageSelector = new PageSelector(this, 1); |
||
19954 | craig | 1271 | pageSelector->setObjectName("pageSelector"); |
18972 | craig | 1272 | pageSelector->setFont(fo); |
1273 | pageSelector->setFocusPolicy(Qt::ClickFocus); |
||
1274 | |||
19954 | craig | 1275 | zoomDefaultToolbarButton = new QPushButton(zoomWidget); |
18972 | craig | 1276 | zoomDefaultToolbarButton->setFocusPolicy(Qt::NoFocus); |
1277 | zoomDefaultToolbarButton->setDefault( false ); |
||
1278 | zoomDefaultToolbarButton->setAutoDefault( false ); |
||
19954 | craig | 1279 | zoomOutToolbarButton = new QPushButton(zoomWidget); |
18972 | craig | 1280 | zoomOutToolbarButton->setFocusPolicy(Qt::NoFocus); |
1281 | zoomOutToolbarButton->setDefault( false ); |
||
1282 | zoomOutToolbarButton->setAutoDefault( false ); |
||
19954 | craig | 1283 | zoomInToolbarButton = new QPushButton(zoomWidget); |
18972 | craig | 1284 | zoomInToolbarButton->setFocusPolicy(Qt::NoFocus); |
1285 | zoomInToolbarButton->setDefault( false ); |
||
1286 | zoomInToolbarButton->setAutoDefault( false ); |
||
19954 | craig | 1287 | |
20196 | craig | 1288 | zoomDefaultToolbarButton->setIcon(IconManager::instance()->loadIcon("16/zoom-original.png")); |
1289 | zoomOutToolbarButton->setIcon(IconManager::instance()->loadIcon("16/zoom-out.png")); |
||
1290 | zoomInToolbarButton->setIcon(IconManager::instance()->loadIcon("16/zoom-in.png")); |
||
18972 | craig | 1291 | |
1292 | |||
19954 | craig | 1293 | zoomLayout->addWidget( zoomSpinBox ); |
1294 | zoomLayout->addWidget( zoomOutToolbarButton ); |
||
1295 | zoomLayout->addWidget( zoomDefaultToolbarButton ); |
||
1296 | zoomLayout->addWidget( zoomInToolbarButton ); |
||
1297 | |||
20691 | craig | 1298 | m_mainWindowStatusLabel = new QLabel( " ", statusBar()); |
1299 | m_mainWindowStatusLabel->setFont(fo); |
||
9953 | cbradney | 1300 | mainWindowProgressBar = new QProgressBar(statusBar()); |
1301 | mainWindowProgressBar->setAlignment(Qt::AlignHCenter); |
||
5800 | fschmid | 1302 | mainWindowProgressBar->setFixedWidth( 100 ); |
1303 | mainWindowProgressBar->reset(); |
||
18972 | craig | 1304 | mainWindowXPosLabel = new QLabel( tr("X:"), statusBar()); |
18978 | craig | 1305 | mainWindowXPosLabel->setFont(fo); |
18972 | craig | 1306 | mainWindowYPosLabel = new QLabel( tr("Y:"), statusBar()); |
18978 | craig | 1307 | mainWindowYPosLabel->setFont(fo); |
19954 | craig | 1308 | mainWindowXPosDataLabel = new QLabel( "", statusBar()); |
18978 | craig | 1309 | mainWindowXPosDataLabel->setFont(fo); |
19954 | craig | 1310 | mainWindowYPosDataLabel = new QLabel( "", statusBar()); |
18978 | craig | 1311 | mainWindowYPosDataLabel->setFont(fo); |
19954 | craig | 1312 | mainWindowXPosDataLabel->setMinimumWidth(mainWindowXPosDataLabel->fontMetrics().width("99999.999")); |
1313 | mainWindowYPosDataLabel->setMinimumWidth(mainWindowYPosDataLabel->fontMetrics().width("99999.999")); |
||
18972 | craig | 1314 | statusBarLanguageChange(); |
1315 | |||
19956 | craig | 1316 | layerMenu->setObjectName("layerMenu"); |
1317 | unitSwitcher->setObjectName("unitSwitcher"); |
||
1318 | zoomDefaultToolbarButton->setObjectName("zoomDefaultToolbarButton"); |
||
1319 | zoomInToolbarButton->setObjectName("zoomInToolbarButton"); |
||
1320 | zoomOutToolbarButton->setObjectName("zoomOutToolbarButton"); |
||
1321 | zoomSpinBox->setObjectName("zoomSpinBox"); |
||
1322 | |||
19009 | craig | 1323 | statusBar()->setFont(fo); |
20691 | craig | 1324 | statusBar()->addPermanentWidget(m_mainWindowStatusLabel, 5); |
19009 | craig | 1325 | QLabel *s=new QLabel(""); |
1326 | QLabel *s2=new QLabel(""); |
||
19954 | craig | 1327 | QLabel *s3=new QLabel(""); |
19009 | craig | 1328 | statusBar()->addPermanentWidget(s,1); |
19954 | craig | 1329 | statusBar()->addPermanentWidget(s2,1); |
1330 | statusBar()->addPermanentWidget(zoomWidget,0); |
||
1331 | statusBar()->addPermanentWidget(pageSelector,0); |
||
19009 | craig | 1332 | statusBar()->addPermanentWidget(layerMenu,1); |
19954 | craig | 1333 | statusBar()->addPermanentWidget(s3,3); |
10564 | fschmid | 1334 | statusBar()->addPermanentWidget(mainWindowXPosLabel, 0); |
19954 | craig | 1335 | statusBar()->addPermanentWidget(mainWindowXPosDataLabel, 0); |
10564 | fschmid | 1336 | statusBar()->addPermanentWidget(mainWindowYPosLabel, 0); |
19954 | craig | 1337 | statusBar()->addPermanentWidget(mainWindowYPosDataLabel, 0); |
1338 | |||
19009 | craig | 1339 | statusBar()->addPermanentWidget(unitSwitcher,0); |
1340 | statusBar()->addPermanentWidget(mainWindowProgressBar, 0); |
||
15675 | fschmid | 1341 | connect(statusBar(), SIGNAL(messageChanged(const QString &)), this, SLOT(setTempStatusBarText(const QString &))); |
18972 | craig | 1342 | |
5800 | fschmid | 1343 | } |
1344 | |||
10532 | avox | 1345 | |
5800 | fschmid | 1346 | void ScribusMainWindow::setStatusBarMousePosition(double xp, double yp) |
1347 | { |
||
21373 | craig | 1348 | if (!HaveDoc) |
1349 | { |
||
1350 | mainWindowXPosDataLabel->clear(); |
||
1351 | mainWindowYPosDataLabel->clear(); |
||
1352 | return; |
||
1353 | } |
||
18065 | fschmid | 1354 | if (doc->Pages->count() == 0) |
1355 | return; |
||
5800 | fschmid | 1356 | double xn = xp; |
1357 | double yn = yp; |
||
14932 | cbradney | 1358 | if (doc->guidesPrefs().rulerMode) |
5800 | fschmid | 1359 | { |
1360 | xn -= doc->currentPage()->xOffset(); |
||
1361 | yn -= doc->currentPage()->yOffset(); |
||
1362 | } |
||
1363 | xn -= doc->rulerXoffset; |
||
1364 | yn -= doc->rulerYoffset; |
||
19009 | craig | 1365 | mainWindowXPosDataLabel->setText(value2String(xn, doc->unitIndex(), true, false)); |
1366 | mainWindowYPosDataLabel->setText(value2String(yn, doc->unitIndex(), true, false)); |
||
5800 | fschmid | 1367 | } |
1368 | |||
15465 | avox | 1369 | void ScribusMainWindow::setStatusBarTextPosition(double base, double xp) |
1370 | { |
||
18065 | fschmid | 1371 | if (doc->Pages->count() == 0) |
1372 | return; |
||
15465 | avox | 1373 | mainWindowXPosDataLabel->setText(base + xp >= 0? value2String(xp, doc->unitIndex(), true, true): QString("-")); |
1374 | mainWindowYPosDataLabel->setText("-"); |
||
1375 | } |
||
10532 | avox | 1376 | |
19386 | craig | 1377 | void ScribusMainWindow::setStatusBarTextSelectedItemInfo() |
1378 | { |
||
22268 | craig | 1379 | const int docSelectionCount = doc->m_Selection->count(); |
19386 | craig | 1380 | if (docSelectionCount == 0) |
19581 | craig | 1381 | { |
19386 | craig | 1382 | setStatusBarInfoText(""); |
19581 | craig | 1383 | return; |
1384 | } |
||
1385 | QString widthTxt = value2String(doc->m_Selection->width(), doc->unitIndex(), true, true); |
||
1386 | QString heightTxt = value2String(doc->m_Selection->height(), doc->unitIndex(), true, true); |
||
1387 | if (docSelectionCount == 1) |
||
19386 | craig | 1388 | { |
1389 | QString whatSel = tr("Unknown"); |
||
1390 | switch (doc->m_Selection->itemAt(0)->itemType()) |
||
1391 | { |
||
1392 | case 2: |
||
1393 | whatSel = CommonStrings::itemType_ImageFrame; |
||
1394 | break; |
||
1395 | case 4: |
||
1396 | whatSel = CommonStrings::itemType_TextFrame; |
||
1397 | break; |
||
1398 | case 5: |
||
1399 | whatSel = CommonStrings::itemType_Line; |
||
1400 | break; |
||
1401 | case 6: |
||
1402 | whatSel = CommonStrings::itemType_Polygon; |
||
1403 | break; |
||
1404 | case 7: |
||
1405 | whatSel = CommonStrings::itemType_Polyline; |
||
1406 | break; |
||
1407 | case 8: |
||
1408 | whatSel = CommonStrings::itemType_PathText; |
||
1409 | break; |
||
1410 | case 9: |
||
1411 | whatSel = CommonStrings::itemType_LatexFrame; |
||
1412 | break; |
||
1413 | case 11: |
||
1414 | whatSel = CommonStrings::itemType_Symbol; |
||
1415 | break; |
||
1416 | case 12: |
||
1417 | whatSel = CommonStrings::itemType_Group; |
||
1418 | break; |
||
1419 | case 13: |
||
1420 | whatSel = CommonStrings::itemType_RegularPolygon; |
||
1421 | break; |
||
1422 | case 14: |
||
1423 | whatSel = CommonStrings::itemType_Arc; |
||
1424 | break; |
||
1425 | case 15: |
||
1426 | whatSel = CommonStrings::itemType_Spiral; |
||
1427 | break; |
||
1428 | case 16: |
||
1429 | whatSel = CommonStrings::itemType_Table; |
||
1430 | break; |
||
1431 | default: |
||
1432 | whatSel = "Unknown"; |
||
1433 | break; |
||
1434 | } |
||
1435 | QString txtBody = tr("%1 selected").arg(whatSel) + " : " + tr("Size"); |
||
21934 | craig | 1436 | setStatusBarInfoText( QString("%1 = %3 x %4").arg(txtBody, widthTxt, heightTxt)); |
19386 | craig | 1437 | } |
1438 | else |
||
1439 | { |
||
1440 | setStatusBarInfoText( tr("%1 Objects selected, Selection Size = %2 x %3").arg(docSelectionCount).arg(widthTxt).arg(heightTxt)); |
||
1441 | } |
||
1442 | } |
||
1443 | |||
15675 | fschmid | 1444 | void ScribusMainWindow::setTempStatusBarText(const QString &text) |
1445 | { |
||
20691 | craig | 1446 | if (m_mainWindowStatusLabel) |
15675 | fschmid | 1447 | { |
1448 | if (text.isEmpty()) |
||
20691 | craig | 1449 | m_mainWindowStatusLabel->setText(m_statusLabelText); |
15675 | fschmid | 1450 | else |
20691 | craig | 1451 | m_mainWindowStatusLabel->setText(text); |
15675 | fschmid | 1452 | } |
1453 | } |
||
15465 | avox | 1454 | |
5800 | fschmid | 1455 | void ScribusMainWindow::setStatusBarInfoText(QString newText) |
1456 | { |
||
20691 | craig | 1457 | if (m_mainWindowStatusLabel) |
1458 | m_mainWindowStatusLabel->setText(newText); |
||
1459 | m_statusLabelText = newText; |
||
5800 | fschmid | 1460 | } |
1461 | |||
10532 | avox | 1462 | |
21575 | craig | 1463 | //AV to be replaced with Selection::update and listener in textPalette |
5800 | fschmid | 1464 | void ScribusMainWindow::setTBvals(PageItem *currItem) |
1465 | { |
||
17826 | craig | 1466 | scrActions["editMark"]->setEnabled(false); |
18794 | jghali | 1467 | |
1468 | PageItem* item = currItem; |
||
1469 | bool inEditMode = (doc->appMode == modeEdit); |
||
1470 | if (doc->appMode == modeEditTable) |
||
5800 | fschmid | 1471 | { |
18794 | jghali | 1472 | if (currItem->isTable()) |
1473 | item = currItem->asTable()->activeCell().textFrame(); |
||
1474 | inEditMode = item->isTextFrame(); |
||
1475 | } |
||
1476 | if (!item || item->itemText.length() <= 0) |
||
1477 | return; |
||
1478 | |||
22004 | jghali | 1479 | const ParagraphStyle& currPStyle(inEditMode ? item->currentStyle() : item->itemText.defaultStyle()); |
18794 | jghali | 1480 | setAlignmentValue(currPStyle.alignment()); |
22228 | jghali | 1481 | |
1482 | // Assignment operator does not perform style context assignment |
||
1483 | // Do it in this case, otherwise we might get some crashes if previous |
||
1484 | // text object was deleted or things like that |
||
1485 | const ParagraphStyle& curStyle = item->currentStyle(); |
||
1486 | doc->currentStyle.setContext(curStyle.context()); |
||
1487 | doc->currentStyle = curStyle; |
||
21132 | jghali | 1488 | if (doc->appMode == modeEdit || doc->appMode == modeEditTable) |
1489 | item->currentTextProps(doc->currentStyle); |
||
1490 | else |
||
1491 | doc->currentStyle.charStyle().setStyle(item->currentCharStyle()); |
||
18794 | jghali | 1492 | emit TextStyle(doc->currentStyle); |
1493 | // to go: (av) |
||
21575 | craig | 1494 | textPalette->textPal->updateStyle(doc->currentStyle); |
18794 | jghali | 1495 | //check if mark in cursor place and enable editMark action |
1496 | if (doc->appMode == modeEdit && item->itemText.cursorPosition() < item->itemText.length()) |
||
1497 | { |
||
18920 | craig | 1498 | if (item->itemText.hasMark(item->itemText.cursorPosition())) |
17826 | craig | 1499 | { |
18920 | craig | 1500 | Mark* mark = item->itemText.mark(item->itemText.cursorPosition()); |
18794 | jghali | 1501 | scrActions["editMark"]->setEnabled(true); |
18920 | craig | 1502 | if ((mark->isType(MARKNoteMasterType) || mark->isType(MARKNoteFrameType)) && (mark->getNotePtr() != NULL)) |
1503 | nsEditor->setNotesStyle(mark->getNotePtr()->notesStyle()); |
||
17826 | craig | 1504 | } |
18794 | jghali | 1505 | else |
1506 | scrActions["editMark"]->setEnabled(false); |
||
5800 | fschmid | 1507 | } |
1508 | } |
||
1509 | |||
1510 | //Special keys assigned to actions are stolen by the action and not passed to |
||
1511 | //keyPressEvent so process them here. |
||
19100 | craig | 1512 | void ScribusMainWindow::specialActionKeyEvent(int unicodevalue) |
5800 | fschmid | 1513 | { |
19581 | craig | 1514 | if (!HaveDoc) |
1515 | return; |
||
22268 | craig | 1516 | if (doc->m_Selection->count() != 1) |
1517 | return; |
||
1518 | PageItem* selItem = doc->m_Selection->itemAt(0); |
||
1519 | if (((doc->appMode == modeEdit) || (doc->appMode == modeEditTable)) && (selItem->isTextFrame() || selItem->isTable())) |
||
5800 | fschmid | 1520 | { |
22268 | craig | 1521 | PageItem_TextFrame *currItem; |
1522 | if (doc->appMode == modeEditTable) |
||
1523 | currItem = selItem->asTable()->activeCell().textFrame(); |
||
1524 | else |
||
1525 | currItem = selItem->asTextFrame(); |
||
1526 | if (currItem!=NULL) |
||
5800 | fschmid | 1527 | { |
22268 | craig | 1528 | if (unicodevalue!=-1) |
5800 | fschmid | 1529 | { |
22268 | craig | 1530 | UndoTransaction activeTransaction; |
1531 | if (currItem->HasSel){ |
||
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()) |
||
5800 | fschmid | 1537 | { |
22268 | craig | 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))); |
||
1541 | else { |
||
1542 | ss = new SimpleState(Um::InsertText,"",Um::ICreate); |
||
1543 | ss->set("INSERT_FRAMETEXT"); |
||
1544 | ss->set("ETEA", QString("insert_frametext")); |
||
1545 | ss->set("TEXT_STR", QString(QChar(unicodevalue))); |
||
1546 | ss->set("START", currItem->itemText.cursorPosition()); |
||
1547 | UndoObject * undoTarget = currItem; |
||
1548 | if (currItem->isNoteFrame()) |
||
1549 | { |
||
1550 | undoTarget = doc; |
||
1551 | ss->set("noteframeName", currItem->getUName()); |
||
1552 | } |
||
1553 | m_undoManager->action(undoTarget, ss); |
||
19581 | craig | 1554 | } |
22268 | craig | 1555 | } |
1556 | currItem->itemText.insertChars(QString(QChar(unicodevalue)), true); |
||
1557 | if (activeTransaction) |
||
1558 | activeTransaction.commit(); |
||
1559 | } |
||
1560 | else if (unicodevalue==SpecialChars::SHYPHEN.unicode()) //ignore the char as we use an attribute if the text item, for now. |
||
1561 | { |
||
1562 | // this code is currently dead since unicodeSoftHyphen |
||
1563 | // doesn't have unicodevalue == -1 any more |
||
1564 | if (currItem->itemText.cursorPosition() > 1) |
||
1565 | { |
||
1566 | #if 0 |
||
1567 | StyleFlag fl = currItem->itemText.item(qMax(currItem->CPos-1,0))->effects(); |
||
1568 | fl |= ScStyle_HyphenationPossible; |
||
1569 | currItem->itemText.item(qMax(currItem->CPos-1,0))->setEffects(fl); |
||
1570 | #else |
||
19581 | craig | 1571 | if (UndoManager::undoEnabled()) |
5800 | fschmid | 1572 | { |
20691 | craig | 1573 | SimpleState *ss = dynamic_cast<SimpleState*>(m_undoManager->getLastUndo()); |
19932 | jghali | 1574 | if (ss && ss->get("ETEA") == "insert_frametext") |
22268 | craig | 1575 | ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(SpecialChars::SHYPHEN)); |
19581 | craig | 1576 | else { |
1577 | ss = new SimpleState(Um::InsertText,"",Um::ICreate); |
||
20801 | jghali | 1578 | ss->set("INSERT_FRAMETEXT"); |
19581 | craig | 1579 | ss->set("ETEA", QString("insert_frametext")); |
22268 | craig | 1580 | ss->set("TEXT_STR", QString(SpecialChars::SHYPHEN)); |
19581 | craig | 1581 | ss->set("START", currItem->itemText.cursorPosition()); |
1582 | UndoObject * undoTarget = currItem; |
||
1583 | if (currItem->isNoteFrame()) |
||
1584 | { |
||
1585 | undoTarget = doc; |
||
1586 | ss->set("noteframeName", currItem->getUName()); |
||
1587 | } |
||
20691 | craig | 1588 | m_undoManager->action(undoTarget, ss); |
17641 | craig | 1589 | } |
19581 | craig | 1590 | } |
22268 | craig | 1591 | currItem->itemText.insertChars(QString(SpecialChars::SHYPHEN), true); |
5800 | fschmid | 1592 | #endif |
1593 | } |
||
1594 | } |
||
22268 | craig | 1595 | if (doc->appMode == modeEditTable) |
1596 | selItem->asTable()->update(); |
||
1597 | else |
||
1598 | currItem->update(); |
||
5800 | fschmid | 1599 | } |
1600 | } |
||
1601 | } |
||
1602 | |||
1603 | bool ScribusMainWindow::eventFilter( QObject* /*o*/, QEvent *e ) |
||
1604 | { |
||
1605 | bool retVal; |
||
9562 | fschmid | 1606 | if (e->type() == QEvent::ToolTip) |
20691 | craig | 1607 | return (!m_prefsManager->appPrefs.displayPrefs.showToolTips); |
19581 | craig | 1608 | |
11960 | subik | 1609 | if ( e->type() == QEvent::KeyPress ) |
11893 | cbradney | 1610 | { |
22289 | craig | 1611 | QKeyEvent *k = dynamic_cast<QKeyEvent *>(e); |
22313 | craig | 1612 | if (!k) |
1613 | return false; |
||
5800 | fschmid | 1614 | int keyMod=0; |
10390 | cbradney | 1615 | if (k->modifiers() & Qt::ShiftModifier) |
8523 | cbradney | 1616 | keyMod |= Qt::SHIFT; |
10390 | cbradney | 1617 | if (k->modifiers() & Qt::ControlModifier) |
8523 | cbradney | 1618 | keyMod |= Qt::CTRL; |
10390 | cbradney | 1619 | if (k->modifiers() & Qt::AltModifier) |
8523 | cbradney | 1620 | keyMod |= Qt::ALT; |
5800 | fschmid | 1621 | |
1622 | QKeySequence currKeySeq = QKeySequence(k->key() | keyMod); |
||
18194 | fschmid | 1623 | if (QString(currKeySeq.toString()).isNull()) |
1624 | return false; |
||
5800 | fschmid | 1625 | retVal=true; |
1626 | //Palette actions |
||
19304 | craig | 1627 | if (actionManager->compareKeySeqToShortcut(currKeySeq, "specialToggleAllPalettes")) |
8613 | cbradney | 1628 | scrActions["specialToggleAllPalettes"]->activate(QAction::Trigger); |
5800 | fschmid | 1629 | else |
19304 | craig | 1630 | if (actionManager->compareKeySeqToShortcut(currKeySeq, "specialToggleAllGuides")) |
15302 | cbradney | 1631 | scrActions["specialToggleAllGuides"]->activate(QAction::Trigger); |
1632 | else |
||
18920 | craig | 1633 | retVal=false; |
5800 | fschmid | 1634 | } |
1635 | else |
||
1636 | retVal=false; |
||
1637 | //Return false to pass event to object |
||
1638 | return retVal; |
||
1639 | } |
||
1640 | |||
10532 | avox | 1641 | |
16546 | jghali | 1642 | void ScribusMainWindow::inputMethodEvent ( QInputMethodEvent * event ) |
1643 | { |
||
17761 | jghali | 1644 | //qDebug() << "IMEmw" << event->commitString() << event->preeditString() << "attributes:" << event->attributes().count(); |
16546 | jghali | 1645 | } |
1646 | |||
1647 | QVariant ScribusMainWindow::inputMethodQuery ( Qt::InputMethodQuery query ) const |
||
1648 | { |
||
17761 | jghali | 1649 | //qDebug() << "IMQmw" << query; |
16546 | jghali | 1650 | return QVariant(); |
1651 | } |
||
1652 | |||
10532 | avox | 1653 | //AV -> CanvasMode |
5800 | fschmid | 1654 | void ScribusMainWindow::keyPressEvent(QKeyEvent *k) |
1655 | { |
||
13950 | fschmid | 1656 | QList<QMdiSubWindow *> windows; |
1657 | QMdiSubWindow* w = NULL; |
||
5800 | fschmid | 1658 | int kk = k->key(); |
7435 | fschmid | 1659 | if (HaveDoc) |
1660 | { |
||
8523 | cbradney | 1661 | if ((doc->appMode == modeMagnifier) && (kk == Qt::Key_Shift)) |
7435 | fschmid | 1662 | { |
21740 | craig | 1663 | view->setCursor(IconManager::instance()->loadCursor("lupezm.png")); |
7435 | fschmid | 1664 | return; |
1665 | } |
||
1666 | } |
||
20691 | craig | 1667 | if (m_keyrep) |
5800 | fschmid | 1668 | return; |
20691 | craig | 1669 | m_keyrep = true; |
10390 | cbradney | 1670 | int keyMod=0; |
1671 | if (k->modifiers() & Qt::ShiftModifier) |
||
1672 | keyMod |= Qt::SHIFT; |
||
1673 | if (k->modifiers() & Qt::ControlModifier) |
||
1674 | keyMod |= Qt::CTRL; |
||
1675 | if (k->modifiers() & Qt::AltModifier) |
||
1676 | keyMod |= Qt::ALT; |
||
5800 | fschmid | 1677 | //User presses escape and we have a doc open, and we have an item selected |
8523 | cbradney | 1678 | if ((kk == Qt::Key_Escape) && (HaveDoc)) |
5800 | fschmid | 1679 | { |
20691 | craig | 1680 | m_keyrep = false; |
5800 | fschmid | 1681 | PageItem *currItem; |
18871 | craig | 1682 | if (!doc->m_Selection->isEmpty()) |
5800 | fschmid | 1683 | { |
1684 | currItem = doc->m_Selection->itemAt(0); |
||
1685 | switch (doc->appMode) |
||
1686 | { |
||
1687 | case modeNormal: |
||
10532 | avox | 1688 | case modeEditClip: |
5800 | fschmid | 1689 | currItem->Sizing = false; |
1690 | if (doc->SubMode != -1) |
||
1691 | { |
||
1692 | view->Deselect(false); |
||
16943 | fschmid | 1693 | doc->Items->removeOne(currItem); |
5800 | fschmid | 1694 | } |
5967 | fschmid | 1695 | else |
1696 | view->Deselect(false); |
||
11576 | avox | 1697 | view->cancelGroupTransaction(); |
5800 | fschmid | 1698 | break; |
7436 | fschmid | 1699 | case modeEdit: |
11576 | avox | 1700 | view->cancelGroupTransaction(); |
7436 | fschmid | 1701 | break; |
17094 | jghali | 1702 | case modeCopyProperties: |
1703 | case modeEditGradientVectors: |
||
1704 | case modeEditMeshGradient: |
||
5800 | fschmid | 1705 | case modeLinkFrames: |
1706 | case modeUnlinkFrames: |
||
1707 | case modeRotation: |
||
1708 | view->Deselect(false); |
||
17094 | jghali | 1709 | case modeEditWeldPoint: |
12022 | cbradney | 1710 | case modeEyeDropper: |
12971 | jghali | 1711 | case modeImportObject: |
17735 | craig | 1712 | case modeImportImage: |
5800 | fschmid | 1713 | case modePanning: |
11490 | avox | 1714 | view->requestMode(modeNormal); |
5800 | fschmid | 1715 | break; |
1716 | case modeDrawBezierLine: |
||
1717 | break; |
||
1718 | default: |
||
11704 | fschmid | 1719 | if (currItem->Sizing) |
1720 | { |
||
1721 | view->Deselect(false); |
||
16943 | fschmid | 1722 | doc->Items->removeOne(currItem); |
11704 | fschmid | 1723 | } |
5800 | fschmid | 1724 | break; |
1725 | } |
||
1726 | } |
||
1727 | doc->DragP = false; |
||
1728 | doc->leaveDrag = false; |
||
10532 | avox | 1729 | view->stopAllDrags(); |
5800 | fschmid | 1730 | doc->SubMode = -1; |
1731 | doc->ElemToLink = NULL; |
||
1732 | slotSelect(); |
||
18871 | craig | 1733 | if (doc->m_Selection->isEmpty()) |
19288 | jghali | 1734 | HaveNewSel(); |
20691 | craig | 1735 | m_prefsManager->appPrefs.uiPrefs.stickyTools = false; |
13955 | cbradney | 1736 | scrActions["stickyTools"]->setChecked(false); |
5800 | fschmid | 1737 | return; |
1738 | } |
||
10390 | cbradney | 1739 | Qt::KeyboardModifiers buttonModifiers = k->modifiers(); |
5800 | fschmid | 1740 | /**If we have a doc and we are not changing the page or zoom level in the status bar */ |
18972 | craig | 1741 | if ((HaveDoc) && (!zoomSpinBox->hasFocus()) && (!pageSelector->hasFocus())) |
5800 | fschmid | 1742 | { |
11146 | cbradney | 1743 | //Show our context menu |
19304 | craig | 1744 | if (actionManager->compareKeySeqToShortcut(kk, buttonModifiers, "viewShowContextMenu")) |
11146 | cbradney | 1745 | { |
1746 | ContextMenu* cmen=NULL; |
||
18871 | craig | 1747 | if (doc->m_Selection->isEmpty()) |
11146 | cbradney | 1748 | { |
1749 | //CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPos()); |
||
1750 | QPoint p(QCursor::pos() - mapToGlobal(QPoint(0,0))); |
||
1751 | FPoint fp(p.x() / view->scale() + doc->minCanvasCoordinate.x(), |
||
11960 | subik | 1752 | p.y() / view->scale() + doc->minCanvasCoordinate.y()); |
11146 | cbradney | 1753 | cmen = new ContextMenu(this, doc, fp.x(), fp.y()); |
1754 | } |
||
1755 | else |
||
1756 | cmen = new ContextMenu(*(doc->m_Selection), this, doc); |
||
1757 | if (cmen) |
||
1758 | { |
||
1759 | setUndoMode(true); |
||
1760 | cmen->exec(QCursor::pos()); |
||
1761 | setUndoMode(false); |
||
1762 | } |
||
1763 | delete cmen; |
||
1764 | } |
||
11960 | subik | 1765 | |
1766 | |||
5800 | fschmid | 1767 | /** |
1768 | * With no item selected we can: |
||
1769 | * - With space, get into panning mode (modePanning) |
||
1770 | * - With PageUp, scroll up |
||
1771 | * - With PageDown, scroll down |
||
1772 | * - With Tab, change active document windowActivated |
||
1773 | */ |
||
1774 | |||
18871 | craig | 1775 | if ((doc->appMode != modeEdit) && (doc->m_Selection->isEmpty())) |
5800 | fschmid | 1776 | { |
6284 | fschmid | 1777 | int pg; |
20691 | craig | 1778 | int wheelVal = m_prefsManager->mouseWheelJump(); |
10390 | cbradney | 1779 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
8970 | fschmid | 1780 | wheelVal = qMax(qRound(wheelVal / 10.0), 1); |
5800 | fschmid | 1781 | switch (kk) |
1782 | { |
||
8523 | cbradney | 1783 | case Qt::Key_Space: |
20691 | craig | 1784 | m_keyrep = false; |
5800 | fschmid | 1785 | if (doc->appMode == modePanning) |
10532 | avox | 1786 | view->requestMode(modeNormal); |
5800 | fschmid | 1787 | else |
10532 | avox | 1788 | view->requestMode(modePanning); |
5800 | fschmid | 1789 | return; |
1790 | break; |
||
10564 | fschmid | 1791 | case Qt::Key_PageUp: |
17410 | fschmid | 1792 | if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode()) |
20691 | craig | 1793 | view->scrollBy(0, -m_prefsManager->mouseWheelJump()); |
6284 | fschmid | 1794 | else |
1795 | { |
||
1796 | pg = doc->currentPageNumber(); |
||
10390 | cbradney | 1797 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6284 | fschmid | 1798 | pg--; |
1799 | else |
||
15407 | craig | 1800 | pg -= doc->pageSets()[doc->pagePositioning()].Columns; |
6284 | fschmid | 1801 | if (pg > -1) |
1802 | view->GotoPage(pg); |
||
1803 | } |
||
20691 | craig | 1804 | m_keyrep = false; |
5800 | fschmid | 1805 | return; |
1806 | break; |
||
10564 | fschmid | 1807 | case Qt::Key_PageDown: |
17410 | fschmid | 1808 | if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode()) |
20691 | craig | 1809 | view->scrollBy(0, m_prefsManager->mouseWheelJump()); |
6284 | fschmid | 1810 | else |
1811 | { |
||
1812 | pg = doc->currentPageNumber(); |
||
10390 | cbradney | 1813 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6284 | fschmid | 1814 | pg++; |
1815 | else |
||
15407 | craig | 1816 | pg += doc->pageSets()[doc->pagePositioning()].Columns; |
7328 | fschmid | 1817 | if (pg < static_cast<int>(doc->Pages->count())) |
6284 | fschmid | 1818 | view->GotoPage(pg); |
1819 | } |
||
20691 | craig | 1820 | m_keyrep = false; |
5800 | fschmid | 1821 | return; |
1822 | break; |
||
8970 | fschmid | 1823 | case Qt::Key_Left: |
1824 | view->scrollBy(-wheelVal, 0); |
||
20691 | craig | 1825 | m_keyrep = false; |
8970 | fschmid | 1826 | return; |
1827 | break; |
||
1828 | case Qt::Key_Right: |
||
1829 | view->scrollBy(wheelVal, 0); |
||
20691 | craig | 1830 | m_keyrep = false; |
8970 | fschmid | 1831 | return; |
1832 | break; |
||
1833 | case Qt::Key_Up: |
||
1834 | view->scrollBy(0, -wheelVal); |
||
20691 | craig | 1835 | m_keyrep = false; |
8970 | fschmid | 1836 | return; |
1837 | break; |
||
1838 | case Qt::Key_Down: |
||
1839 | view->scrollBy(0, wheelVal); |
||
20691 | craig | 1840 | m_keyrep = false; |
8970 | fschmid | 1841 | return; |
1842 | break; |
||
8523 | cbradney | 1843 | case Qt::Key_Tab: |
14034 | jghali | 1844 | if (buttonModifiers == Qt::ControlModifier) |
5800 | fschmid | 1845 | { |
20691 | craig | 1846 | m_keyrep = false; |
14034 | jghali | 1847 | windows = mdiArea->subWindowList(); |
1848 | if (windows.count() > 1) |
||
5800 | fschmid | 1849 | { |
14034 | jghali | 1850 | for (int i = 0; i < static_cast<int>(windows.count()); ++i) |
5800 | fschmid | 1851 | { |
14034 | jghali | 1852 | if (mdiArea->activeSubWindow() == windows.at(i)) |
1853 | { |
||
1854 | if (i == static_cast<int>(windows.count()-1)) |
||
1855 | w = windows.at(0); |
||
1856 | else |
||
1857 | w = windows.at(i+1); |
||
1858 | break; |
||
1859 | } |
||
5800 | fschmid | 1860 | } |
14034 | jghali | 1861 | outlinePalette->buildReopenVals(); |
1862 | docCheckerPalette->clearErrorList(); |
||
1863 | if ( w ) |
||
1864 | w->showNormal(); |
||
1865 | newActWin(w); |
||
5800 | fschmid | 1866 | } |
14034 | jghali | 1867 | return; |
5800 | fschmid | 1868 | } |
1869 | break; |
||
1870 | } |
||
1871 | } |
||
1872 | } |
||
1873 | switch(kk) |
||
1874 | { |
||
8523 | cbradney | 1875 | case Qt::Key_Left: |
1876 | case Qt::Key_Right: |
||
1877 | case Qt::Key_Up: |
||
1878 | case Qt::Key_Down: |
||
20691 | craig | 1879 | m__arrowKeyDown = true; |
5800 | fschmid | 1880 | } |
20691 | craig | 1881 | m_keyrep = false; |
5800 | fschmid | 1882 | } |
1883 | |||
1884 | void ScribusMainWindow::keyReleaseEvent(QKeyEvent *k) |
||
1885 | { |
||
10390 | cbradney | 1886 | //Exit out of panning mode if Control is release while the right mouse button is pressed |
1887 | if (HaveDoc) |
||
5800 | fschmid | 1888 | { |
10390 | cbradney | 1889 | if ((doc->appMode == modePanning) && (k->key() == Qt::Key_Control) && (QApplication::mouseButtons() & Qt::RightButton)) |
10532 | avox | 1890 | view->requestMode(modeNormal); |
22268 | craig | 1891 | |
7435 | fschmid | 1892 | if (doc->appMode == modeMagnifier) |
21740 | craig | 1893 | view->setCursor(IconManager::instance()->loadCursor("lupez.png")); |
7435 | fschmid | 1894 | } |
20691 | craig | 1895 | if (k->isAutoRepeat() || !m__arrowKeyDown) |
5800 | fschmid | 1896 | return; |
1897 | switch(k->key()) |
||
1898 | { |
||
8523 | cbradney | 1899 | case Qt::Key_Left: |
1900 | case Qt::Key_Right: |
||
1901 | case Qt::Key_Up: |
||
1902 | case Qt::Key_Down: |
||
20691 | craig | 1903 | m__arrowKeyDown = false; |
18972 | craig | 1904 | if ((HaveDoc) && (!zoomSpinBox->hasFocus()) && (!pageSelector->hasFocus())) |
5800 | fschmid | 1905 | { |
10390 | cbradney | 1906 | int docSelectionCount=doc->m_Selection->count(); |
10532 | avox | 1907 | if ((docSelectionCount != 0) && (doc->appMode == modeEditClip) && (doc->nodeEdit.hasNodeSelected())) |
9735 | fschmid | 1908 | { |
1909 | PageItem *currItem = doc->m_Selection->itemAt(0); |
||
1910 | double xposOrig = currItem->xPos(); |
||
1911 | double yposOrig = currItem->yPos(); |
||
20694 | craig | 1912 | doc->adjustItemSize(currItem); |
19946 | craig | 1913 | if (!doc->nodeEdit.isContourLine()) |
9735 | fschmid | 1914 | currItem->ContourLine.translate(xposOrig - currItem->xPos(),yposOrig - currItem->yPos()); |
10532 | avox | 1915 | currItem->update(); |
9735 | fschmid | 1916 | } |
10390 | cbradney | 1917 | for (int i = 0; i < docSelectionCount; ++i) |
5800 | fschmid | 1918 | doc->m_Selection->itemAt(i)->checkChanges(true); |
1919 | if (docSelectionCount > 1 && view->groupTransactionStarted()) |
||
11576 | avox | 1920 | view->endGroupTransaction(); |
5800 | fschmid | 1921 | } |
1922 | break; |
||
1923 | } |
||
1924 | } |
||
1925 | |||
10859 | cbradney | 1926 | void ScribusMainWindow::changeEvent(QEvent *e) |
1927 | { |
||
1928 | if (e->type() == QEvent::LanguageChange) |
||
1929 | languageChange(); |
||
10903 | cbradney | 1930 | else |
1931 | QWidget::changeEvent(e); |
||
10859 | cbradney | 1932 | } |
1933 | |||
5800 | fschmid | 1934 | void ScribusMainWindow::closeEvent(QCloseEvent *ce) |
1935 | { |
||
13487 | cbradney | 1936 | //Do not quit if Preferences or new doc window is open |
14658 | cbradney | 1937 | PreferencesDialog *prefsDialog = findChild<PreferencesDialog *>(QString::fromLocal8Bit("PreferencesDialog")); |
13487 | cbradney | 1938 | NewDoc *newDocWin = findChild<NewDoc *>(QString::fromLocal8Bit("NewDocumentWindow")); |
15834 | fschmid | 1939 | if (prefsDialog!=NULL || newDocWin!=NULL) |
13478 | cbradney | 1940 | { |
1941 | ce->ignore(); |
||
1942 | return; |
||
1943 | } |
||
13959 | jghali | 1944 | QList<QMdiSubWindow *> windows = mdiArea->subWindowList(); |
5800 | fschmid | 1945 | ScribusWin |