Rev 17737 | Rev 18017 | 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 | |||
8591 | cbradney | 24 | #include <QApplication> |
10862 | cbradney | 25 | #include <QByteArray> |
26 | #include <QCloseEvent> |
||
27 | #include <QColor> |
||
10223 | cbradney | 28 | #include <QColorDialog> |
29 | #include <QCursor> |
||
8635 | cbradney | 30 | #include <QDesktopWidget> |
10862 | cbradney | 31 | #include <QDragEnterEvent> |
8501 | cbradney | 32 | #include <QDropEvent> |
33 | #include <QEvent> |
||
10862 | cbradney | 34 | #include <QEventLoop> |
35 | #include <QFrame> |
||
36 | #include <QIcon> |
||
37 | #include <QInputDialog> |
||
8501 | cbradney | 38 | #include <QKeyEvent> |
10862 | cbradney | 39 | #include <QKeySequence> |
40 | #include <QLabel> |
||
41 | #include <QList> |
||
42 | #include <QLocale> |
||
43 | #include <QMouseEvent> |
||
44 | #include <QPixmap> |
||
45 | #include <QRegExp> |
||
46 | #include <QStyleFactory> |
||
9853 | fschmid | 47 | #include <QTableWidget> |
10862 | cbradney | 48 | #include <QTextCodec> |
49 | #include <QTranslator> |
||
50 | #include <QWheelEvent> |
||
1208 | cbradney | 51 | |
3 | paul | 52 | #include <cstdio> |
53 | #include <cstdlib> |
||
9082 | avox | 54 | #include <cassert> |
2629 | craig | 55 | |
2688 | craig | 56 | #include "scconfig.h" |
2629 | craig | 57 | |
58 | #ifdef HAVE_DLFCN_H |
||
3 | paul | 59 | #include <dlfcn.h> |
2629 | craig | 60 | #endif |
61 | |||
62 | #ifdef HAVE_UNISTD_H |
||
135 | Franz | 63 | #include <unistd.h> |
2629 | craig | 64 | #endif |
65 | |||
3 | paul | 66 | #include <iostream> |
8289 | avox | 67 | #include <sstream> |
119 | Franz | 68 | #include <signal.h> |
80 | Franz | 69 | #include <string> |
1208 | cbradney | 70 | |
1641 | cbradney | 71 | #include "about.h" |
3247 | craig | 72 | #include "aboutplugins.h" |
10212 | cbradney | 73 | #include "actionmanager.h" |
74 | #include "aligndistribute.h" |
||
75 | #include "annot.h" |
||
76 | #include "annota.h" |
||
1806 | cbradney | 77 | #include "applytemplatedialog.h" |
10212 | cbradney | 78 | #include "arrowchooser.h" |
79 | #include "autoform.h" |
||
12092 | fschmid | 80 | #include "basepointwidget.h" |
10862 | cbradney | 81 | #include "bookmarkpalette.h" |
10532 | avox | 82 | #include "canvasmode.h" |
10212 | cbradney | 83 | #include "charselect.h" |
84 | #include "checkDocument.h" |
||
3 | paul | 85 | #include "cmsprefs.h" |
10212 | cbradney | 86 | #include "collect4output.h" |
87 | #include "colorcombo.h" |
||
151 | Franz | 88 | #include "colorm.h" |
10212 | cbradney | 89 | #include "commonstrings.h" |
11146 | cbradney | 90 | #include "contextmenu.h" |
3540 | cbradney | 91 | #include "cpalette.h" |
10212 | cbradney | 92 | #include "customfdialog.h" |
93 | #include "delpages.h" |
||
10862 | cbradney | 94 | #include "desaxe/digester.h" |
95 | #include "desaxe/saxXML.h" |
||
96 | #include "desaxe/simple_actions.h" |
||
10212 | cbradney | 97 | #include "docinfo.h" |
98 | #include "docitemattrprefs.h" |
||
99 | #include "documentchecker.h" |
||
100 | #include "documentinformation.h" |
||
101 | #include "effectsdialog.h" |
||
506 | fschmid | 102 | #include "fileloader.h" |
1151 | fschmid | 103 | #include "filewatcher.h" |
10212 | cbradney | 104 | #include "fontcombo.h" |
105 | #include "fontprefs.h" |
||
6397 | cbradney | 106 | #include "fpoint.h" |
3 | paul | 107 | #include "fpointarray.h" |
10212 | cbradney | 108 | #include "gtgettext.h" |
3 | paul | 109 | #include "guidemanager.h" |
10212 | cbradney | 110 | #include "helpbrowser.h" |
838 | cbradney | 111 | #include "hruler.h" |
10212 | cbradney | 112 | #include "hyphenator.h" |
113 | #include "hysettings.h" |
||
114 | #include "imageinfodialog.h" |
||
115 | #include "insertaframe.h" |
||
116 | #include "inspage.h" |
||
117 | #include "javadocs.h" |
||
118 | #include "langmgr.h" |
||
119 | #include "layers.h" |
||
2707 | subik | 120 | #include "loremipsum.h" |
11103 | cbradney | 121 | #include "marginwidget.h" |
2777 | fschmid | 122 | #include "margindialog.h" |
10862 | cbradney | 123 | #include "masterpagepalette.h" |
10212 | cbradney | 124 | #include "menumanager.h" |
125 | #include "mergedoc.h" |
||
126 | #include "movepage.h" |
||
127 | #include "multipleduplicate.h" |
||
10862 | cbradney | 128 | #include "newfile.h" |
10532 | avox | 129 | #include "newtemp.h" |
13188 | fschmid | 130 | #include "nfttemplate.h" |
131 | #include "nftdialog.h" |
||
132 | #include "ui_nftdialog.h" |
||
133 | #include "nftwidget.h" |
||
10862 | cbradney | 134 | #include "nodeeditpalette.h" |
135 | #include "outlinepalette.h" |
||
10212 | cbradney | 136 | #include "page.h" |
16342 | mrdocs | 137 | #include "pageitem.h" |
10212 | cbradney | 138 | #include "pageitem_imageframe.h" |
10532 | avox | 139 | #include "pageitem_latexframe.h" |
10212 | cbradney | 140 | #include "pageitem_textframe.h" |
10862 | cbradney | 141 | #include "pageitemattributes.h" |
10212 | cbradney | 142 | #include "pagelayout.h" |
10862 | cbradney | 143 | #include "pagepalette.h" |
10212 | cbradney | 144 | #include "pageselector.h" |
145 | #include "pagesize.h" |
||
146 | #include "patterndialog.h" |
||
10862 | cbradney | 147 | #include "pdflib.h" |
10212 | cbradney | 148 | #include "pdfoptions.h" |
149 | #include "pdfopts.h" |
||
150 | #include "picstatus.h" |
||
151 | #include "pluginmanager.h" |
||
10862 | cbradney | 152 | #include "plugins/formatidlist.h" |
10212 | cbradney | 153 | #include "polygonwidget.h" |
154 | #include "prefs.h" |
||
155 | #include "prefscontext.h" |
||
156 | #include "prefsfile.h" |
||
2834 | cbradney | 157 | #include "prefsmanager.h" |
10212 | cbradney | 158 | #include "prefstable.h" |
3165 | fschmid | 159 | #include "preview.h" |
10863 | cbradney | 160 | #include "printdialog.h" |
10862 | cbradney | 161 | #include "propertiespalette.h" |
10212 | cbradney | 162 | #include "pslib.h" |
163 | #include "query.h" |
||
164 | #include "reformdoc.h" |
||
11895 | fschmid | 165 | #include "replacecolors.h" |
10212 | cbradney | 166 | #include "resourcecollection.h" |
167 | #include "sccolorengine.h" |
||
10532 | avox | 168 | #include "sccombobox.h" |
169 | #include "scgtplugin.h" |
||
170 | #include "scmessagebox.h" |
||
12841 | jghali | 171 | #include "scmimedata.h" |
10532 | avox | 172 | #include "scpaths.h" |
10967 | jghali | 173 | #include "scprintengine_ps.h" |
10212 | cbradney | 174 | #include "scraction.h" |
10862 | cbradney | 175 | #include "scrapbookpalette.h" |
10212 | cbradney | 176 | #include "scribus.h" |
177 | #include "scribusXml.h" |
||
178 | #include "scribusapp.h" |
||
179 | #include "scribuscore.h" |
||
3252 | craig | 180 | #include "scribuswin.h" |
10212 | cbradney | 181 | #include "search.h" |
3934 | cbradney | 182 | #include "selection.h" |
11919 | fschmid | 183 | #include "selectobjects.h" |
10212 | cbradney | 184 | #include "serializer.h" |
185 | #include "smlinestyle.h" |
||
186 | #include "smtextstyles.h" |
||
187 | #include "splash.h" |
||
188 | #include "stencilreader.h" |
||
12939 | jghali | 189 | #include "storyeditor.h" |
4829 | tsoots | 190 | #include "stylemanager.h" |
10212 | cbradney | 191 | #include "tabcheckdoc.h" |
192 | #include "tabguides.h" |
||
193 | #include "tabmanager.h" |
||
194 | #include "tabpdfoptions.h" |
||
195 | #include "tabtools.h" |
||
196 | #include "tabtypography.h" |
||
10862 | cbradney | 197 | #include "text/nlsconfig.h" |
10212 | cbradney | 198 | #include "tocgenerator.h" |
199 | #include "tocindexprefs.h" |
||
10862 | cbradney | 200 | #include "ui/copypagetomasterpagedialog.h" |
10976 | cbradney | 201 | #include "ui/edittoolbar.h" |
202 | #include "ui/filetoolbar.h" |
||
203 | #include "ui/modetoolbar.h" |
||
204 | #include "ui/pdftoolbar.h" |
||
10212 | cbradney | 205 | #include "undogui.h" |
206 | #include "undomanager.h" |
||
207 | #include "undostate.h" |
||
208 | #include "units.h" |
||
10311 | cbradney | 209 | #include "urllauncher.h" |
5184 | avox | 210 | #include "util.h" |
10212 | cbradney | 211 | #include "util_formats.h" |
212 | #include "util_ghostscript.h" |
||
10200 | cbradney | 213 | #include "util_icon.h" |
15706 | jghali | 214 | #include "util_math.h" |
10212 | cbradney | 215 | #include "vruler.h" |
12110 | fschmid | 216 | #include "loadsaveplugin.h" |
134 | Franz | 217 | |
10212 | cbradney | 218 | |
4361 | cbradney | 219 | #if defined(_WIN32) |
5178 | mrdocs | 220 | #include "scdocoutput_ps2.h" |
10967 | jghali | 221 | #include "scprintengine_gdi.h" |
4361 | cbradney | 222 | #endif |
223 | |||
3 | paul | 224 | using namespace std; |
225 | |||
3234 | fschmid | 226 | bool previewDinUse; |
227 | bool printDinUse; |
||
2891 | cbradney | 228 | |
3 | paul | 229 | QString DocDir; |
3205 | craig | 230 | |
10532 | avox | 231 | |
2536 | cbradney | 232 | extern ScribusQApp* ScQApp; |
2634 | cbradney | 233 | extern bool emergencyActivated; |
3 | paul | 234 | |
10532 | avox | 235 | |
4026 | craig | 236 | ScribusMainWindow::ScribusMainWindow() |
2161 | cbradney | 237 | { |
5781 | cbradney | 238 | actionManager=0; |
239 | scrMenuMgr=0; |
||
240 | prefsManager=0; |
||
10181 | cbradney | 241 | formatsManager=0; |
10311 | cbradney | 242 | UrlLauncher::instance(); |
5781 | cbradney | 243 | mainWindowStatusLabel=0; |
7354 | cbradney | 244 | ExternalApp=0; |
3580 | avox | 245 | #ifdef Q_WS_MAC |
246 | noIcon = loadIcon("noicon.xpm"); |
||
247 | #endif |
||
10625 | cbradney | 248 | } |
188 | Franz | 249 | |
11158 | avox | 250 | /* |
251 | static QCoreApplication::EventFilter origEventFilter = 0; |
||
10532 | avox | 252 | |
11158 | avox | 253 | bool reportFocusChanges(void *message, long *result) |
254 | { |
||
255 | unsigned* data = static_cast<unsigned*>(message); |
||
256 | if (QApplication::focusWidget()) |
||
257 | qDebug() << QApplication::applicationFilePath() << reinterpret_cast<void*>(QApplication::focusWidget()) << typeid(*QApplication::focusWidget()).name() << QApplication::focusWidget()->objectName() << message << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7]; |
||
258 | else |
||
259 | qDebug() << QApplication::applicationFilePath() << "no focus" << message << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7]; |
||
260 | return origEventFilter && origEventFilter(message, result); |
||
261 | } |
||
262 | */ |
||
263 | |||
767 | cbradney | 264 | /* |
265 | * retval 0 - ok, 1 - no fonts, ... |
||
266 | */ |
||
5243 | cbradney | 267 | int ScribusMainWindow::initScMW(bool primaryMainWindow) |
188 | Franz | 268 | { |
767 | cbradney | 269 | int retVal=0; |
5243 | cbradney | 270 | |
9909 | avox | 271 | QByteArray stylesheet; |
9910 | jghali | 272 | if (loadRawText(ScPaths::getApplicationDataDir() + "/stylesheet.css", stylesheet)) |
9909 | avox | 273 | { |
274 | qApp->setStyleSheet(QString(stylesheet)); |
||
275 | } |
||
10953 | subik | 276 | |
11158 | avox | 277 | // origEventFilter = qApp->setEventFilter(reportFocusChanges); |
11960 | subik | 278 | |
3234 | fschmid | 279 | previewDinUse = false; |
280 | printDinUse = false; |
||
9721 | fschmid | 281 | internalCopy = false; |
355 | Franz | 282 | CurrStED = NULL; |
10495 | cbradney | 283 | setWindowTitle( tr("Scribus " VERSION)); |
10564 | fschmid | 284 | setAttribute(Qt::WA_KeyCompression, false); |
285 | setWindowIcon(loadIcon("AppIcon.png")); |
||
1325 | cbradney | 286 | scrActionGroups.clear(); |
1208 | cbradney | 287 | scrActions.clear(); |
288 | scrRecentFileActions.clear(); |
||
5800 | fschmid | 289 | scrRecentPasteActions.clear(); |
1260 | cbradney | 290 | scrWindowsActions.clear(); |
2408 | cbradney | 291 | scrLayersActions.clear(); |
15524 | fschmid | 292 | scrScrapActions.clear(); |
5781 | cbradney | 293 | scrMenuMgr = new MenuManager(menuBar()); |
2835 | cbradney | 294 | prefsManager = PrefsManager::instance(); |
10181 | cbradney | 295 | formatsManager = FormatsManager::instance(); |
5243 | cbradney | 296 | objectSpecificUndo = false; |
7087 | subik | 297 | |
1247 | tsoots | 298 | undoManager = UndoManager::instance(); |
7880 | fschmid | 299 | PrefsContext *undoPrefs = prefsManager->prefsFile->getContext("undo"); |
300 | undoManager->setUndoEnabled(undoPrefs->getBool("enabled", true)); |
||
2441 | cbradney | 301 | tocGenerator = new TOCGenerator(); |
4510 | subik | 302 | |
7087 | subik | 303 | |
1780 | cbradney | 304 | initDefaultValues(); |
7087 | subik | 305 | |
272 | Franz | 306 | initStatusBar(); |
7087 | subik | 307 | |
490 | cbradney | 308 | qApp->processEvents(); |
675 | cbradney | 309 | |
10427 | cbradney | 310 | actionManager = new ActionManager(this); |
5257 | cbradney | 311 | actionManager->init(this); |
11174 | fschmid | 312 | // if (primaryMainWindow) |
313 | // ScCore->setSplashStatus( tr("Applying User Shortcuts") ); |
||
314 | // prefsManager->applyLoadedShortCuts(); |
||
315 | // initKeyboardShortcuts(); |
||
316 | initMenuBar(); |
||
317 | initToolBars(); |
||
318 | ScCore->pluginManager->setupPluginActions(this); |
||
319 | ScCore->pluginManager->languageChange(); |
||
10977 | cbradney | 320 | if (primaryMainWindow) |
321 | ScCore->setSplashStatus( tr("Applying User Shortcuts") ); |
||
322 | prefsManager->applyLoadedShortCuts(); |
||
323 | initKeyboardShortcuts(); |
||
11960 | subik | 324 | |
5243 | cbradney | 325 | resize(610, 600); |
8695 | fschmid | 326 | wsp = new QWorkspace( this ); |
327 | setCentralWidget( wsp ); |
||
5243 | cbradney | 328 | connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *))); |
329 | //Connect windows cascade and tile actions to the workspace after its created. Only depends on wsp created. |
||
10725 | jghali | 330 | connect( scrActions["windowsCascade"], SIGNAL(triggered()) , wsp, SLOT(cascade()) ); |
331 | connect( scrActions["windowsTile"], SIGNAL(triggered()) , wsp, SLOT(tile()) ); |
||
5243 | cbradney | 332 | initPalettes(); |
7087 | subik | 333 | |
5243 | cbradney | 334 | prefsManager->setupMainWindow(this); |
770 | cbradney | 335 | |
5243 | cbradney | 336 | if (primaryMainWindow) |
337 | ScCore->setSplashStatus( tr("Initializing Story Editor") ); |
||
338 | storyEditor = new StoryEditor(this); |
||
770 | cbradney | 339 | |
5243 | cbradney | 340 | DocDir = prefsManager->documentDir(); |
1485 | tsoots | 341 | |
5243 | cbradney | 342 | if (primaryMainWindow) |
5800 | fschmid | 343 | ScCore->setSplashStatus( tr("Initializing Hyphenator") ); |
344 | QString preLang = prefsManager->appPrefs.Language; |
||
345 | initHyphenator(); |
||
12787 | pierre | 346 | if (!LanguageManager::instance()->getHyphFilename( preLang, false ).isEmpty() ) |
5800 | fschmid | 347 | prefsManager->appPrefs.Language = preLang; |
348 | if (primaryMainWindow) |
||
349 | ScCore->setSplashStatus( tr("Reading Scrapbook") ); |
||
350 | initScrapbook(); |
||
351 | |||
10564 | fschmid | 352 | scrActions["helpTooltips"]->setChecked(prefsManager->appPrefs.showToolTips); |
12754 | fschmid | 353 | scrActions["showMouseCoordinates"]->setChecked(prefsManager->appPrefs.showMouseCoordinates); |
10564 | fschmid | 354 | scrActions["stickyTools"]->setChecked(prefsManager->appPrefs.stickyTools); |
5800 | fschmid | 355 | ToggleTips(); |
12754 | fschmid | 356 | ToggleMouseTips(); |
5800 | fschmid | 357 | propertiesPalette->setFontSize(); |
6451 | fschmid | 358 | if (scrActions["SaveAsDocumentTemplate"]) |
359 | scrActions["SaveAsDocumentTemplate"]->setEnabled(false); |
||
7087 | subik | 360 | |
15948 | jghali | 361 | connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecentFromWatcher(QString))); |
9067 | avox | 362 | connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&))); |
5800 | fschmid | 363 | connect(this, SIGNAL(TextIFont(QString)), propertiesPalette, SLOT(setFontFace(QString))); |
9920 | fschmid | 364 | connect(this, SIGNAL(TextISize(double)), propertiesPalette, SLOT(setSize(double))); |
365 | connect(this, SIGNAL(TextUSval(double)), propertiesPalette, SLOT(setExtra(double))); |
||
5800 | fschmid | 366 | connect(this, SIGNAL(TextStil(int)), propertiesPalette, SLOT(setStil(int))); |
9920 | fschmid | 367 | connect(this, SIGNAL(TextScale(double)), propertiesPalette, SLOT(setTScale(double))); |
368 | connect(this, SIGNAL(TextScaleV(double)), propertiesPalette, SLOT(setTScaleV(double))); |
||
369 | connect(this, SIGNAL(TextBase(double)), propertiesPalette, SLOT(setTBase(double))); |
||
370 | connect(this, SIGNAL(TextShadow(double, double )), propertiesPalette, SLOT(setShadowOffs(double, double ))); |
||
371 | connect(this, SIGNAL(TextOutline(double)), propertiesPalette, SLOT(setOutlineW(double))); |
||
372 | connect(this, SIGNAL(TextUnderline(double, double)), propertiesPalette, SLOT(setUnderline(double, double))); |
||
373 | connect(this, SIGNAL(TextStrike(double, double)), propertiesPalette, SLOT(setStrike(double, double))); |
||
374 | connect(this, SIGNAL(TextFarben(QString, QString, double, double)), propertiesPalette, SLOT(setActFarben(QString, QString, double, double))); |
||
5800 | fschmid | 375 | connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange())); |
7337 | fschmid | 376 | // connect(ClipB, SIGNAL(selectionChanged()), this, SLOT(ClipChange())); |
5800 | fschmid | 377 | setAcceptDrops(true); |
9562 | fschmid | 378 | QCoreApplication::instance()->installEventFilter(this); |
12846 | fschmid | 379 | scrActions["toolsSelect"]->setChecked(true); |
11960 | subik | 380 | |
5800 | fschmid | 381 | return retVal; |
382 | } |
||
383 | |||
10532 | avox | 384 | |
5800 | fschmid | 385 | ScribusMainWindow::~ScribusMainWindow() |
386 | { |
||
387 | } |
||
388 | |||
11040 | fschmid | 389 | void ScribusMainWindow::addScToolBar(ScToolBar *tb, QString name) |
390 | { |
||
391 | if (!scrToolBars.contains(name)) |
||
392 | scrToolBars.insert(name, tb); |
||
393 | addToolBar(tb); |
||
394 | } |
||
5800 | fschmid | 395 | |
396 | void ScribusMainWindow::initToolBars() |
||
397 | { |
||
10976 | cbradney | 398 | fileToolBar = new FileToolBar(this); |
399 | editToolBar = new EditToolBar(this); |
||
5800 | fschmid | 400 | UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget"); |
401 | undoManager->registerGui(uWidget); |
||
10976 | cbradney | 402 | modeToolBar = new ModeToolBar(this); |
5800 | fschmid | 403 | pdfToolBar = new PDFToolBar(this); |
10953 | subik | 404 | |
11040 | fschmid | 405 | addScToolBar(fileToolBar, "ToolBar-File"); |
406 | addScToolBar(editToolBar, "ToolBar-Edit"); |
||
407 | addScToolBar(modeToolBar, "ToolBar-Tools"); |
||
408 | addScToolBar(pdfToolBar, "ToolBar-PDF_Tools"); |
||
7087 | subik | 409 | |
10976 | cbradney | 410 | connect(modeToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarTools"], SLOT(setChecked(bool))); |
10734 | jghali | 411 | connect(scrActions["toolsToolbarPDF"], SIGNAL(toggled(bool)), pdfToolBar, SLOT(setVisible(bool))); |
10969 | subik | 412 | connect(pdfToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarPDF"], SLOT(setChecked(bool))); |
10976 | cbradney | 413 | connect(scrActions["toolsToolbarTools"], SIGNAL(toggled(bool)), modeToolBar, SLOT(setVisible(bool)) ); |
5800 | fschmid | 414 | } |
415 | |||
10532 | avox | 416 | |
5800 | fschmid | 417 | void ScribusMainWindow::initDefaultValues() |
418 | { |
||
419 | HaveDoc = false; |
||
14755 | jghali | 420 | ScriptRunning = 0; |
5800 | fschmid | 421 | view = NULL; |
422 | doc = NULL; |
||
423 | DocNr = 1; |
||
424 | PrinterUsed = false; |
||
425 | PDef.Pname = ""; |
||
426 | PDef.Dname = ""; |
||
427 | PDef.Command = ""; |
||
428 | keyrep = false; |
||
429 | _arrowKeyDown = false; |
||
430 | ClipB = QApplication::clipboard(); |
||
431 | palettesStatus[0] = false; |
||
432 | guidesStatus[0] = false; |
||
433 | } |
||
434 | |||
10532 | avox | 435 | |
5800 | fschmid | 436 | void ScribusMainWindow::initKeyboardShortcuts() |
437 | { |
||
8501 | cbradney | 438 | for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrActions.begin(); it!=scrActions.end(); ++it ) |
5800 | fschmid | 439 | { |
10516 | cbradney | 440 | if ((ScrAction*)(it.value())!=NULL) |
5800 | fschmid | 441 | { |
10564 | fschmid | 442 | QString accelerator=it.value()->shortcut(); |
10516 | cbradney | 443 | prefsManager->setKeyEntry(it.key(), it.value()->cleanMenuText(), accelerator,0); |
5800 | fschmid | 444 | } |
445 | //else |
||
13085 | jghali | 446 | // qDebug() << it.key(); |
447 | //qDebug() << QString("|-\n|%1||%2||%3").arg(it.key()).arg(it.value()->cleanMenuText()).arg(QString(it.data()->accel())); |
||
5800 | fschmid | 448 | } |
449 | } |
||
450 | |||
10532 | avox | 451 | |
5800 | fschmid | 452 | void ScribusMainWindow::initPalettes() |
453 | { |
||
454 | //CB TODO hide the publicly available members of some palettes |
||
455 | // these must be filtered too as they take control of the palettes events |
||
10862 | cbradney | 456 | outlinePalette = new OutlinePalette(this); |
5800 | fschmid | 457 | outlinePalette->setMainWindow(this); |
458 | connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 459 | connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setChecked(bool))); |
10862 | cbradney | 460 | propertiesPalette = new PropertiesPalette(this); |
5800 | fschmid | 461 | propertiesPalette->setMainWindow(this); |
462 | connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 463 | connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setChecked(bool))); |
5800 | fschmid | 464 | |
465 | //CB dont need this until we have a doc... |
||
466 | //propertiesPalette->Cpal->SetColors(prefsManager->colorSet()); |
||
467 | propertiesPalette->Fonts->RebuildList(0); |
||
468 | propertiesPalette->installEventFilter(this); |
||
469 | nodePalette = new NodePalette(this); |
||
470 | nodePalette->installEventFilter(this); |
||
471 | layerPalette = new LayerPalette(this); |
||
472 | guidePalette = new GuideManager(this); |
||
7087 | subik | 473 | charPalette = new CharSelect(this); |
5800 | fschmid | 474 | connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) ); |
10581 | cbradney | 475 | connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setChecked(bool))); |
5800 | fschmid | 476 | layerPalette->installEventFilter(this); |
477 | layerPalette->Table->installEventFilter(this); |
||
478 | scrapbookPalette = new Biblio(this); |
||
479 | connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 480 | connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setChecked(bool))); |
11554 | fschmid | 481 | connect( scrapbookPalette, SIGNAL(pasteToActualPage(QString)), this, SLOT(pasteFromScrapbook(QString))); |
5800 | fschmid | 482 | scrapbookPalette->installEventFilter(this); |
483 | pagePalette = new PagePalette(this); |
||
484 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) ); |
||
485 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , this, SLOT(setPagePalette(bool)) ); |
||
10581 | cbradney | 486 | connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setChecked(bool))); |
5800 | fschmid | 487 | pagePalette->installEventFilter(this); |
488 | bookmarkPalette = new BookPalette(this); |
||
489 | connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 490 | connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setChecked(bool))); |
5800 | fschmid | 491 | bookmarkPalette->installEventFilter(this); |
11190 | avox | 492 | // measurementPalette = new Measurements(this); |
493 | // connect( scrActions["toolsMeasurements"], SIGNAL(toggled(bool)) , measurementPalette, SLOT(setPaletteShown(bool)) ); |
||
5800 | fschmid | 494 | connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool, int)) , this, SLOT(setAppModeByToggle(bool, int)) ); |
11190 | avox | 495 | // connect( measurementPalette, SIGNAL(paletteShown(bool)), scrActions["toolsMeasurements"], SLOT(setChecked(bool))); |
496 | // measurementPalette->installEventFilter(this); |
||
497 | // measurementPalette->hide(); |
||
5800 | fschmid | 498 | docCheckerPalette = new CheckDocument(this, false); |
499 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) ); |
||
500 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , this, SLOT(docCheckToggle(bool)) ); |
||
10581 | cbradney | 501 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setChecked(bool))); |
5800 | fschmid | 502 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool))); |
503 | docCheckerPalette->installEventFilter(this); |
||
504 | docCheckerPalette->hide(); |
||
505 | |||
506 | alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette", false); |
||
507 | connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) ); |
||
10581 | cbradney | 508 | connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setChecked(bool))); |
5800 | fschmid | 509 | connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh())); |
510 | alignDistributePalette->installEventFilter(this); |
||
7087 | subik | 511 | |
5800 | fschmid | 512 | undoPalette = new UndoPalette(this, "undoPalette"); |
513 | undoPalette->installEventFilter(this); |
||
514 | undoManager->registerGui(undoPalette); |
||
515 | connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); |
||
516 | connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); |
||
517 | |||
518 | // initializing style manager here too even it's not strictly a palette |
||
519 | styleManager = new StyleManager(this, "styleManager"); |
||
520 | styleManager->addStyle(new SMLineStyle()); |
||
7063 | tsoots | 521 | SMCharacterStyle *tmpCS = new SMCharacterStyle(); |
522 | styleManager->addStyle(new SMParagraphStyle(tmpCS->tmpStyles())); |
||
523 | styleManager->addStyle(tmpCS); |
||
10627 | cbradney | 524 | connect( scrActions["editStyles"], SIGNAL(toggled(bool)), styleManager, SLOT(setPaletteShown(bool)) ); |
10581 | cbradney | 525 | connect( styleManager, SIGNAL(paletteShown(bool)), scrActions["editStyles"], SLOT(setChecked(bool))); |
8005 | cbradney | 526 | styleManager->installEventFilter(this); |
5800 | fschmid | 527 | |
528 | connect(docCheckerPalette, SIGNAL(selectElement(int, int)), this, SLOT(selectItemsFromOutlines(int, int))); |
||
529 | connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
||
530 | connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString))); |
||
531 | connect(outlinePalette, SIGNAL(selectElement(int, int, bool)), this, SLOT(selectItemsFromOutlines(int, int, bool))); |
||
532 | connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
||
533 | connect(outlinePalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString))); |
||
9067 | avox | 534 | connect(propertiesPalette->paraStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setNewParStyle(const QString&))); |
535 | connect(propertiesPalette->charStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setNewCharStyle(const QString&))); |
||
5800 | fschmid | 536 | // connect(propertiesPalette, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles())); |
11852 | fschmid | 537 | connect(nodePalette, SIGNAL(Schliessen()), propertiesPalette, SLOT(endEdit2())); |
10532 | avox | 538 | connect(nodePalette, SIGNAL(Schliessen()), this, SLOT(slotSelect())); |
5800 | fschmid | 539 | connect(nodePalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
540 | connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
||
541 | |||
542 | connect(bookmarkPalette->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks())); |
||
543 | connect(bookmarkPalette->BView, SIGNAL(changed()), this, SLOT(slotDocCh())); |
||
544 | connect(bookmarkPalette->BView, SIGNAL(SelectElement(PageItem *)), this, SLOT(selectItemsFromOutlines(PageItem *))); |
||
545 | // guides |
||
546 | connect(scrActions["pageManageGuides"], SIGNAL(toggled(bool)), guidePalette, SLOT(setPaletteShown(bool))); |
||
10581 | cbradney | 547 | connect(guidePalette, SIGNAL(paletteShown(bool)), scrActions["pageManageGuides"], SLOT(setChecked(bool))); |
7087 | subik | 548 | // char palette |
549 | connect(scrActions["insertGlyph"], SIGNAL(toggled(bool)), charPalette, SLOT(setPaletteShown(bool))); |
||
10581 | cbradney | 550 | connect(charPalette, SIGNAL(paletteShown(bool)), scrActions["insertGlyph"], SLOT(setChecked(bool))); |
5800 | fschmid | 551 | } |
552 | |||
10532 | avox | 553 | |
5800 | fschmid | 554 | void ScribusMainWindow::initScrapbook() |
555 | { |
||
16576 | craig | 556 | QString scrapbookFileO = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrap13.scs"); |
5800 | fschmid | 557 | QFileInfo scrapbookFileInfoO = QFileInfo(scrapbookFileO); |
558 | if (scrapbookFileInfoO.exists()) |
||
559 | { |
||
16576 | craig | 560 | scrapbookPalette->readOldContents(scrapbookFileO, QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/main")); |
5800 | fschmid | 561 | QDir d = QDir(); |
16576 | craig | 562 | d.rename(scrapbookFileO, QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrap13.backup")); |
5800 | fschmid | 563 | } |
16576 | craig | 564 | QString scrapbookTemp = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/tmp"); |
5800 | fschmid | 565 | QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp); |
566 | if (scrapbookTempInfo.exists()) |
||
567 | scrapbookPalette->readTempContents(scrapbookTemp); |
||
16576 | craig | 568 | QString scrapbookFile = QDir::toNativeSeparators(prefsManager->preferencesLocation()+"/scrapbook/main"); |
5800 | fschmid | 569 | QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile); |
570 | if (scrapbookFileInfo.exists()) |
||
571 | scrapbookPalette->readContents(scrapbookFile); |
||
572 | scrapbookPalette->setScrapbookFileName(scrapbookFile); |
||
573 | scrapbookPalette->setOpenScrapbooks(prefsManager->appPrefs.RecentScrapbooks); |
||
574 | rebuildRecentPasteMenu(); |
||
5806 | fschmid | 575 | connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu())); |
5800 | fschmid | 576 | } |
577 | |||
10532 | avox | 578 | |
5800 | fschmid | 579 | bool ScribusMainWindow::warningVersion(QWidget *parent) |
580 | { |
||
581 | bool retval = false; |
||
582 | int t = ScMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" + |
||
6442 | cbradney | 583 | QObject::tr("You are running a development version of Scribus 1.3.x. The document you are working with was created in Scribus 1.2.x. Saving the current file under 1.3.x renders it unable to be edited in Scribus 1.2.x versions. To preserve the ability to edit in 1.2.x, save this file under a different name and further edit the newly named file and the original will be untouched. Are you sure you wish to proceed with this operation?") + "</qt>", |
9422 | fschmid | 584 | QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel); |
585 | if (t == QMessageBox::Ok) |
||
5800 | fschmid | 586 | retval = true; |
587 | return retval; |
||
588 | } |
||
589 | |||
10532 | avox | 590 | |
5800 | fschmid | 591 | void ScribusMainWindow::initMenuBar() |
592 | { |
||
593 | RecentDocs.clear(); |
||
12940 | cbradney | 594 | scrMenuMgr->createMenu("File", ActionManager::defaultMenuNameEntryTranslated("File")); |
5800 | fschmid | 595 | scrMenuMgr->addMenuItem(scrActions["fileNew"], "File"); |
13188 | fschmid | 596 | scrMenuMgr->addMenuItem(scrActions["fileNewFromTemplate"], "File"); |
5800 | fschmid | 597 | scrMenuMgr->addMenuItem(scrActions["fileOpen"], "File"); |
598 | recentFileMenuName="FileOpenRecent"; |
||
10558 | cbradney | 599 | scrMenuMgr->createMenu(recentFileMenuName, tr("Open &Recent"), "File"); |
5800 | fschmid | 600 | scrMenuMgr->addMenuSeparator("File"); |
601 | scrMenuMgr->addMenuItem(scrActions["fileClose"], "File"); |
||
602 | scrMenuMgr->addMenuItem(scrActions["fileSave"], "File"); |
||
603 | scrMenuMgr->addMenuItem(scrActions["fileSaveAs"], "File"); |
||
604 | scrMenuMgr->addMenuItem(scrActions["fileRevert"], "File"); |
||
605 | scrMenuMgr->addMenuItem(scrActions["fileCollect"], "File"); |
||
606 | scrMenuMgr->addMenuSeparator("File"); |
||
10558 | cbradney | 607 | scrMenuMgr->createMenu("FileImport", tr("&Import"), "File"); |
5800 | fschmid | 608 | scrMenuMgr->addMenuItem(scrActions["fileImportText"], "FileImport"); |
7615 | cbradney | 609 | // scrMenuMgr->addMenuItem(scrActions["fileImportText2"], "FileImport"); |
5800 | fschmid | 610 | scrMenuMgr->addMenuItem(scrActions["fileImportAppendText"], "FileImport"); |
611 | scrMenuMgr->addMenuItem(scrActions["fileImportImage"], "FileImport"); |
||
12110 | fschmid | 612 | scrMenuMgr->addMenuItem(scrActions["fileImportVector"], "FileImport"); |
613 | |||
10558 | cbradney | 614 | scrMenuMgr->createMenu("FileExport", tr("&Export"), "File"); |
5800 | fschmid | 615 | scrMenuMgr->addMenuItem(scrActions["fileExportText"], "FileExport"); |
616 | scrMenuMgr->addMenuItem(scrActions["fileExportAsEPS"], "FileExport"); |
||
617 | scrMenuMgr->addMenuItem(scrActions["fileExportAsPDF"], "FileExport"); |
||
618 | scrMenuMgr->addMenuSeparator("File"); |
||
619 | scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File"); |
||
620 | scrMenuMgr->addMenuItem(scrActions["filePreferences"], "File"); |
||
621 | scrMenuMgr->addMenuSeparator("File"); |
||
622 | scrMenuMgr->addMenuItem(scrActions["filePrint"], "File"); |
||
623 | scrMenuMgr->addMenuItem(scrActions["PrintPreview"], "File"); |
||
624 | scrMenuMgr->addMenuSeparator("File"); |
||
625 | scrMenuMgr->addMenuItem(scrActions["fileQuit"], "File"); |
||
626 | |||
627 | scrActions["fileClose"]->setEnabled(false); |
||
628 | scrActions["fileSave"]->setEnabled(false); |
||
629 | scrActions["fileSaveAs"]->setEnabled(false); |
||
630 | scrActions["fileRevert"]->setEnabled(false); |
||
631 | scrActions["fileCollect"]->setEnabled(false); |
||
632 | scrActions["fileImportText"]->setEnabled(false); |
||
633 | scrActions["fileImportText2"]->setEnabled(false); |
||
634 | scrActions["fileImportImage"]->setEnabled(false); |
||
635 | scrActions["fileImportAppendText"]->setEnabled(false); |
||
636 | scrActions["pageImport"]->setEnabled(false); |
||
637 | scrActions["fileExportText"]->setEnabled(false); |
||
638 | scrActions["fileExportAsEPS"]->setEnabled(false); |
||
639 | scrActions["fileExportAsPDF"]->setEnabled(false); |
||
6451 | fschmid | 640 | scrMenuMgr->setMenuEnabled("FileImport", false); |
5800 | fschmid | 641 | scrMenuMgr->setMenuEnabled("FileExport", false); |
642 | scrActions["fileDocSetup"]->setEnabled(false); |
||
643 | scrActions["filePrint"]->setEnabled(false); |
||
644 | scrActions["PrintPreview"]->setEnabled(false); |
||
645 | |||
12940 | cbradney | 646 | scrMenuMgr->createMenu("Edit", ActionManager::defaultMenuNameEntryTranslated("Edit")); |
5800 | fschmid | 647 | scrMenuMgr->addMenuItem(scrActions["editUndoAction"], "Edit"); |
648 | scrMenuMgr->addMenuItem(scrActions["editRedoAction"], "Edit"); |
||
649 | scrMenuMgr->addMenuItem(scrActions["editActionMode"], "Edit"); |
||
650 | scrMenuMgr->addMenuSeparator("Edit"); |
||
651 | scrMenuMgr->addMenuItem(scrActions["editCut"], "Edit"); |
||
652 | scrMenuMgr->addMenuItem(scrActions["editCopy"], "Edit"); |
||
653 | scrMenuMgr->addMenuItem(scrActions["editPaste"], "Edit"); |
||
654 | recentPasteMenuName="EditPasteRecent"; |
||
10558 | cbradney | 655 | scrMenuMgr->createMenu(recentPasteMenuName, tr("Paste Recent"), "Edit"); |
656 | scrMenuMgr->createMenu("EditContents", tr("Contents"), "Edit"); |
||
5800 | fschmid | 657 | scrMenuMgr->addMenuItem(scrActions["editCopyContents"], "EditContents"); |
658 | scrMenuMgr->addMenuItem(scrActions["editPasteContents"], "EditContents"); |
||
659 | scrMenuMgr->addMenuItem(scrActions["editPasteContentsAbs"], "EditContents"); |
||
660 | scrMenuMgr->addMenuItem(scrActions["editClearContents"], "EditContents"); |
||
661 | scrMenuMgr->addMenuSeparator("Edit"); |
||
662 | scrMenuMgr->addMenuItem(scrActions["editSelectAll"], "Edit"); |
||
11893 | cbradney | 663 | scrMenuMgr->addMenuItem(scrActions["editSelectAllOnLayer"], "Edit"); |
5800 | fschmid | 664 | scrMenuMgr->addMenuItem(scrActions["editDeselectAll"], "Edit"); |
665 | scrMenuMgr->addMenuSeparator("Edit"); |
||
666 | scrMenuMgr->addMenuItem(scrActions["editSearchReplace"], "Edit"); |
||
667 | scrMenuMgr->addMenuItem(scrActions["toolsEditWithStoryEditor"], "Edit"); |
||
668 | scrMenuMgr->addMenuItem(scrActions["editEditWithImageEditor"], "Edit"); |
||
12401 | cbradney | 669 | scrMenuMgr->addMenuItem(scrActions["editEditRenderSource"], "Edit"); |
5800 | fschmid | 670 | scrMenuMgr->addMenuSeparator("Edit"); |
671 | scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit"); |
||
11895 | fschmid | 672 | scrMenuMgr->addMenuItem(scrActions["editReplaceColors"], "Edit"); |
6368 | fschmid | 673 | scrMenuMgr->addMenuItem(scrActions["editPatterns"], "Edit"); |
5922 | cbradney | 674 | scrMenuMgr->addMenuItem(scrActions["editStyles"], "Edit"); |
5800 | fschmid | 675 | scrMenuMgr->addMenuItem(scrActions["editMasterPages"], "Edit"); |
676 | scrMenuMgr->addMenuItem(scrActions["editJavascripts"], "Edit"); |
||
677 | scrActions["editUndoAction"]->setEnabled(false); |
||
678 | scrActions["editRedoAction"]->setEnabled(false); |
||
679 | scrActions["editActionMode"]->setEnabled(true); |
||
680 | scrActions["editCut"]->setEnabled(false); |
||
681 | scrActions["editCopy"]->setEnabled(false); |
||
682 | scrActions["editPaste"]->setEnabled(false); |
||
5827 | fschmid | 683 | scrMenuMgr->setMenuEnabled("EditPasteRecent", false); |
7565 | cbradney | 684 | scrMenuMgr->setMenuEnabled("EditContents", false); |
5800 | fschmid | 685 | scrActions["editCopyContents"]->setEnabled(false); |
686 | scrActions["editPasteContents"]->setEnabled(false); |
||
687 | scrActions["editPasteContentsAbs"]->setEnabled(false); |
||
688 | scrActions["editClearContents"]->setEnabled(false); |
||
689 | scrActions["editSelectAll"]->setEnabled(false); |
||
11893 | cbradney | 690 | scrActions["editSelectAllOnLayer"]->setEnabled(false); |
5800 | fschmid | 691 | scrActions["editDeselectAll"]->setEnabled(false); |
692 | scrActions["editSearchReplace"]->setEnabled(false); |
||
11895 | fschmid | 693 | scrActions["editReplaceColors"]->setEnabled(false); |
6368 | fschmid | 694 | scrActions["editPatterns"]->setEnabled(false); |
9566 | cbradney | 695 | scrActions["editStyles"]->setEnabled(false); |
5800 | fschmid | 696 | scrActions["editMasterPages"]->setEnabled(false); |
697 | scrActions["editJavascripts"]->setEnabled(false); |
||
698 | scrActions["toolsEditWithStoryEditor"]->setEnabled(false); |
||
699 | scrActions["editEditWithImageEditor"]->setEnabled(false); |
||
12401 | cbradney | 700 | scrActions["editEditRenderSource"]->setEnabled(false); |
5800 | fschmid | 701 | |
702 | //Item Menu |
||
12940 | cbradney | 703 | scrMenuMgr->createMenu("Item", ActionManager::defaultMenuNameEntryTranslated("Item")); |
5800 | fschmid | 704 | scrMenuMgr->addMenuItem(scrActions["itemDuplicate"], "Item"); |
705 | scrMenuMgr->addMenuItem(scrActions["itemMulDuplicate"], "Item"); |
||
706 | scrMenuMgr->addMenuItem(scrActions["itemDelete"], "Item"); |
||
707 | scrMenuMgr->addMenuSeparator("Item"); |
||
708 | scrMenuMgr->addMenuItem(scrActions["itemGroup"], "Item"); |
||
709 | scrMenuMgr->addMenuItem(scrActions["itemUngroup"], "Item"); |
||
710 | scrMenuMgr->addMenuItem(scrActions["itemLock"], "Item"); |
||
711 | scrMenuMgr->addMenuItem(scrActions["itemLockSize"], "Item"); |
||
712 | scrMenuMgr->addMenuSeparator("Item"); |
||
713 | scrMenuMgr->createMenu("ItemLevel", tr("Level")); |
||
714 | scrMenuMgr->addMenuToMenu("ItemLevel", "Item"); |
||
715 | scrMenuMgr->addMenuItem(scrActions["itemRaise"], "ItemLevel"); |
||
716 | scrMenuMgr->addMenuItem(scrActions["itemLower"], "ItemLevel"); |
||
717 | scrMenuMgr->addMenuItem(scrActions["itemRaiseToTop"], "ItemLevel"); |
||
718 | scrMenuMgr->addMenuItem(scrActions["itemLowerToBottom"], "ItemLevel"); |
||
719 | scrMenuMgr->createMenu("ItemLayer", tr("Send to La&yer")); |
||
720 | scrMenuMgr->addMenuToMenu("ItemLayer", "Item"); |
||
721 | layerMenuName="ItemLayer"; |
||
15524 | fschmid | 722 | scrMenuMgr->createMenu("itemSendToScrapbook", tr("Send to Scrapbook")); |
723 | scrMenuMgr->addMenuToMenu("itemSendToScrapbook", "Item"); |
||
6410 | fschmid | 724 | scrMenuMgr->addMenuItem(scrActions["itemSendToPattern"], "Item"); |
5800 | fschmid | 725 | scrMenuMgr->addMenuSeparator("Item"); |
8020 | cbradney | 726 | scrMenuMgr->addMenuItem(scrActions["itemAdjustFrameToImage"], "Item"); |
12591 | fschmid | 727 | scrMenuMgr->addMenuItem(scrActions["itemAdjustImageToFrame"], "Item"); |
14779 | cbradney | 728 | scrMenuMgr->addMenuItem(scrActions["itemUpdateImage"], "Item"); |
729 | scrMenuMgr->addMenuItem(scrActions["styleImageEffects"], "Item"); |
||
8020 | cbradney | 730 | scrMenuMgr->addMenuItem(scrActions["itemExtendedImageProperties"], "Item"); |
731 | scrMenuMgr->createMenu("ItemPreviewSettings", tr("Preview Settings"), "Item"); |
||
732 | scrMenuMgr->addMenuItem(scrActions["itemImageIsVisible"], "ItemPreviewSettings"); |
||
733 | scrMenuMgr->addMenuSeparator("ItemPreviewSettings"); |
||
734 | scrMenuMgr->addMenuItem(scrActions["itemPreviewLow"], "ItemPreviewSettings"); |
||
735 | scrMenuMgr->addMenuItem(scrActions["itemPreviewNormal"], "ItemPreviewSettings"); |
||
736 | scrMenuMgr->addMenuItem(scrActions["itemPreviewFull"], "ItemPreviewSettings"); |
||
737 | scrMenuMgr->addMenuSeparator("Item"); |
||
5800 | fschmid | 738 | scrMenuMgr->addMenuItem(scrActions["itemAttributes"], "Item"); |
739 | scrMenuMgr->createMenu("ItemPDFOptions", tr("&PDF Options")); |
||
740 | scrMenuMgr->addMenuToMenu("ItemPDFOptions", "Item"); |
||
741 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsAnnotation"], "ItemPDFOptions"); |
||
742 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsBookmark"], "ItemPDFOptions"); |
||
743 | scrMenuMgr->addMenuItem(scrActions["itemPDFAnnotationProps"], "ItemPDFOptions"); |
||
744 | scrMenuMgr->addMenuItem(scrActions["itemPDFFieldProps"], "ItemPDFOptions"); |
||
11067 | cbradney | 745 | //scrMenuMgr->createMenu("ItemShapes", tr("&Shape"), "Item"); |
10558 | cbradney | 746 | scrMenuMgr->createMenu("ItemConvertTo", tr("C&onvert To"), "Item"); |
5800 | fschmid | 747 | scrMenuMgr->addMenuItem(scrActions["itemConvertToBezierCurve"], "ItemConvertTo"); |
748 | scrMenuMgr->addMenuItem(scrActions["itemConvertToImageFrame"], "ItemConvertTo"); |
||
749 | scrMenuMgr->addMenuItem(scrActions["itemConvertToOutlines"], "ItemConvertTo"); |
||
750 | scrMenuMgr->addMenuItem(scrActions["itemConvertToPolygon"], "ItemConvertTo"); |
||
751 | scrMenuMgr->addMenuItem(scrActions["itemConvertToTextFrame"], "ItemConvertTo"); |
||
15109 | cbradney | 752 | scrMenuMgr->addMenuSeparator("Item"); |
753 | scrMenuMgr->addMenuItem(scrActions["toolsLinkTextFrame"], "Item"); |
||
754 | scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrame"], "Item"); |
||
755 | scrMenuMgr->addMenuSeparator("Item"); |
||
5800 | fschmid | 756 | scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item"); |
757 | scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item"); |
||
11050 | fschmid | 758 | // scrMenuMgr->createMenu("ItemPathOps", tr("Path Tools"), "Item"); |
759 | scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item"); |
||
760 | scrMenuMgr->addMenuItem(scrActions["itemSplitPolygons"], "Item"); |
||
11067 | cbradney | 761 | //scrMenuMgr->setMenuEnabled("ItemShapes", false); |
5800 | fschmid | 762 | scrActions["itemGroup"]->setEnabled(false); |
763 | scrActions["itemUngroup"]->setEnabled(false); |
||
764 | scrActions["itemAttachTextToPath"]->setEnabled(false); |
||
765 | scrActions["itemDetachTextFromPath"]->setEnabled(false); |
||
766 | scrActions["itemCombinePolygons"]->setEnabled(false); |
||
767 | scrActions["itemSplitPolygons"]->setEnabled(false); |
||
768 | scrActions["itemLock"]->setEnabled(false); |
||
769 | scrActions["itemLockSize"]->setEnabled(false); |
||
770 | scrActions["itemPrintingEnabled"]->setEnabled(false); |
||
771 | scrActions["itemImageIsVisible"]->setEnabled(false); |
||
14779 | cbradney | 772 | scrActions["styleImageEffects"]->setEnabled(false); |
5800 | fschmid | 773 | scrMenuMgr->setMenuEnabled("ItemConvertTo", false); |
774 | scrActions["itemConvertToBezierCurve"]->setEnabled(false); |
||
775 | scrActions["itemConvertToImageFrame"]->setEnabled(false); |
||
776 | scrActions["itemConvertToOutlines"]->setEnabled(false); |
||
777 | scrActions["itemConvertToPolygon"]->setEnabled(false); |
||
778 | scrActions["itemConvertToTextFrame"]->setEnabled(false); |
||
779 | |||
780 | //Insert menu |
||
12940 | cbradney | 781 | scrMenuMgr->createMenu("Insert", ActionManager::defaultMenuNameEntryTranslated("Insert")); |
6090 | cbradney | 782 | scrMenuMgr->addMenuItem(scrActions["insertFrame"], "Insert"); |
783 | scrMenuMgr->addMenuSeparator("Insert"); |
||
5800 | fschmid | 784 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTextFrame"], "Insert"); |
785 | scrMenuMgr->addMenuItem(scrActions["toolsInsertImageFrame"], "Insert"); |
||
12616 | cbradney | 786 | scrMenuMgr->addMenuItem(scrActions["toolsInsertRenderFrame"], "Insert"); |
5800 | fschmid | 787 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTableFrame"], "Insert"); |
788 | scrMenuMgr->addMenuItem(scrActions["toolsInsertShape"], "Insert"); |
||
789 | scrMenuMgr->addMenuItem(scrActions["toolsInsertPolygon"], "Insert"); |
||
790 | scrMenuMgr->addMenuItem(scrActions["toolsInsertLine"], "Insert"); |
||
791 | scrMenuMgr->addMenuItem(scrActions["toolsInsertBezier"], "Insert"); |
||
792 | scrMenuMgr->addMenuItem(scrActions["toolsInsertFreehandLine"], "Insert"); |
||
7400 | cbradney | 793 | scrMenuMgr->addMenuSeparator("Insert"); |
7350 | fschmid | 794 | scrMenuMgr->addMenuItem(scrActions["stickyTools"], "Insert"); |
5800 | fschmid | 795 | scrMenuMgr->addMenuSeparator("Insert"); |
796 | scrMenuMgr->addMenuItem(scrActions["insertGlyph"], "Insert"); |
||
797 | |||
10558 | cbradney | 798 | scrMenuMgr->createMenu("InsertChar", tr("&Character"), "Insert"); |
5800 | fschmid | 799 | scrMenuMgr->addMenuItem(scrActions["unicodePageNumber"], "InsertChar"); |
11713 | fschmid | 800 | scrMenuMgr->addMenuItem(scrActions["unicodePageCount"], "InsertChar"); |
5800 | fschmid | 801 | scrMenuMgr->addMenuItem(scrActions["unicodeSmartHyphen"], "InsertChar"); |
802 | scrMenuMgr->addMenuItem(scrActions["unicodeNonBreakingHyphen"], "InsertChar"); |
||
803 | scrMenuMgr->addMenuSeparator("InsertChar"); |
||
804 | scrMenuMgr->addMenuItem(scrActions["unicodeCopyRight"], "InsertChar"); |
||
805 | scrMenuMgr->addMenuItem(scrActions["unicodeRegdTM"], "InsertChar"); |
||
806 | scrMenuMgr->addMenuItem(scrActions["unicodeTM"], "InsertChar"); |
||
807 | scrMenuMgr->addMenuItem(scrActions["unicodeSolidus"], "InsertChar"); |
||
808 | scrMenuMgr->addMenuItem(scrActions["unicodeBullet"], "InsertChar"); |
||
809 | scrMenuMgr->addMenuItem(scrActions["unicodeMidpoint"], "InsertChar"); |
||
810 | scrMenuMgr->addMenuSeparator("InsertChar"); |
||
811 | scrMenuMgr->addMenuItem(scrActions["unicodeDashEm"], "InsertChar"); |
||
812 | scrMenuMgr->addMenuItem(scrActions["unicodeDashEn"], "InsertChar"); |
||
813 | scrMenuMgr->addMenuItem(scrActions["unicodeDashFigure"], "InsertChar"); |
||
814 | scrMenuMgr->addMenuItem(scrActions["unicodeDashQuotation"], "InsertChar"); |
||
815 | |||
10558 | cbradney | 816 | scrMenuMgr->createMenu("InsertQuote", tr("&Quote"), "Insert"); |
5800 | fschmid | 817 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteApostrophe"], "InsertQuote"); |
818 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteStraight"], "InsertQuote"); |
||
819 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
820 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleLeft"], "InsertQuote"); |
||
821 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleRight"], "InsertQuote"); |
||
822 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleLeft"], "InsertQuote"); |
||
823 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleRight"], "InsertQuote"); |
||
824 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
8755 | cbradney | 825 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleReversed"], "InsertQuote"); |
826 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleReversed"], "InsertQuote"); |
||
827 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
5800 | fschmid | 828 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteLowSingleComma"], "InsertQuote"); |
829 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteLowDoubleComma"], "InsertQuote"); |
||
830 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
831 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleLeftGuillemet"], "InsertQuote"); |
||
832 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteSingleRightGuillemet"], "InsertQuote"); |
||
833 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleLeftGuillemet"], "InsertQuote"); |
||
834 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteDoubleRightGuillemet"], "InsertQuote"); |
||
835 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
836 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKSingleLeft"], "InsertQuote"); |
||
837 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKSingleRight"], "InsertQuote"); |
||
838 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKDoubleLeft"], "InsertQuote"); |
||
839 | scrMenuMgr->addMenuItem(scrActions["unicodeQuoteCJKDoubleRight"], "InsertQuote"); |
||
840 | |||
10558 | cbradney | 841 | scrMenuMgr->createMenu("InsertSpace", tr("S&paces && Breaks"), "Insert"); |
5800 | fschmid | 842 | scrMenuMgr->addMenuItem(scrActions["unicodeNonBreakingSpace"], "InsertSpace"); |
843 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceEN"], "InsertSpace"); |
||
844 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceEM"], "InsertSpace"); |
||
845 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceThin"], "InsertSpace"); |
||
846 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceThick"], "InsertSpace"); |
||
847 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceMid"], "InsertSpace"); |
||
848 | scrMenuMgr->addMenuItem(scrActions["unicodeSpaceHair"], "InsertSpace"); |
||
849 | scrMenuMgr->addMenuSeparator("InsertSpace"); |
||
850 | scrMenuMgr->addMenuItem(scrActions["unicodeNewLine"], "InsertSpace"); |
||
851 | scrMenuMgr->addMenuItem(scrActions["unicodeFrameBreak"], "InsertSpace"); |
||
852 | scrMenuMgr->addMenuItem(scrActions["unicodeColumnBreak"], "InsertSpace"); |
||
7038 | avox | 853 | scrMenuMgr->addMenuItem(scrActions["unicodeZerowidthSpace"], "InsertSpace"); |
5800 | fschmid | 854 | |
10558 | cbradney | 855 | scrMenuMgr->createMenu("InsertLigature", tr("Liga&ture"), "Insert"); |
5800 | fschmid | 856 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ff"], "InsertLigature"); |
857 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_fi"], "InsertLigature"); |
||
858 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_fl"], "InsertLigature"); |
||
859 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ffi"], "InsertLigature"); |
||
860 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ffl"], "InsertLigature"); |
||
861 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_ft"], "InsertLigature"); |
||
862 | scrMenuMgr->addMenuItem(scrActions["unicodeLigature_st"], "InsertLigature"); |
||
863 | |||
864 | scrMenuMgr->addMenuSeparator("Insert"); |
||
865 | scrMenuMgr->addMenuItem(scrActions["insertSampleText"], "Insert"); |
||
6115 | cbradney | 866 | scrActions["insertFrame"]->setEnabled(false); |
5800 | fschmid | 867 | |
868 | //Page menu |
||
12940 | cbradney | 869 | scrMenuMgr->createMenu("Page", ActionManager::defaultMenuNameEntryTranslated("Page")); |
5800 | fschmid | 870 | scrMenuMgr->addMenuItem(scrActions["pageInsert"], "Page"); |
871 | scrMenuMgr->addMenuItem(scrActions["pageImport"], "Page"); |
||
872 | scrMenuMgr->addMenuItem(scrActions["pageDelete"], "Page"); |
||
873 | scrMenuMgr->addMenuItem(scrActions["pageCopy"], "Page"); |
||
874 | scrMenuMgr->addMenuItem(scrActions["pageMove"], "Page"); |
||
875 | scrMenuMgr->addMenuItem(scrActions["pageApplyMasterPage"], "Page"); |
||
876 | scrMenuMgr->addMenuItem(scrActions["pageCopyToMasterPage"], "Page"); |
||
877 | scrMenuMgr->addMenuItem(scrActions["pageManageGuides"], "Page"); |
||
878 | scrMenuMgr->addMenuItem(scrActions["pageManageMargins"], "Page"); |
||
879 | scrMenuMgr->addMenuSeparator("Page"); |
||
880 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "Page"); |
||
881 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "Page"); |
||
882 | scrActions["pageDelete"]->setEnabled(false); |
||
883 | scrActions["pageMove"]->setEnabled(false); |
||
884 | |||
885 | //View menu |
||
12940 | cbradney | 886 | scrMenuMgr->createMenu("View", ActionManager::defaultMenuNameEntryTranslated("View")); |
5800 | fschmid | 887 | scrMenuMgr->addMenuItem(scrActions["viewFitInWindow"], "View"); |
7164 | fschmid | 888 | scrMenuMgr->addMenuItem(scrActions["viewFitWidth"], "View"); |
5800 | fschmid | 889 | scrMenuMgr->addMenuItem(scrActions["viewFit50"], "View"); |
890 | scrMenuMgr->addMenuItem(scrActions["viewFit75"], "View"); |
||
891 | scrMenuMgr->addMenuItem(scrActions["viewFit100"], "View"); |
||
892 | scrMenuMgr->addMenuItem(scrActions["viewFit200"], "View"); |
||
9744 | jghali | 893 | scrMenuMgr->addMenuItem(scrActions["viewFit400"], "View"); |
5800 | fschmid | 894 | scrMenuMgr->addMenuSeparator("View"); |
7587 | cbradney | 895 | scrMenuMgr->addMenuItem(scrActions["viewFitPreview"], "View"); |
896 | scrMenuMgr->addMenuSeparator("View"); |
||
5800 | fschmid | 897 | scrMenuMgr->addMenuItem(scrActions["viewShowMargins"], "View"); |
7051 | fschmid | 898 | scrMenuMgr->addMenuItem(scrActions["viewShowBleeds"], "View"); |
5800 | fschmid | 899 | scrMenuMgr->addMenuItem(scrActions["viewShowFrames"], "View"); |
900 | scrMenuMgr->addMenuItem(scrActions["viewShowLayerMarkers"], "View"); |
||
901 | scrMenuMgr->addMenuItem(scrActions["viewShowImages"], "View"); |
||
902 | scrMenuMgr->addMenuItem(scrActions["viewShowGrid"], "View"); |
||
903 | scrMenuMgr->addMenuItem(scrActions["viewShowGuides"], "View"); |
||
904 | scrMenuMgr->addMenuItem(scrActions["viewShowColumnBorders"], "View"); |
||
905 | scrMenuMgr->addMenuItem(scrActions["viewShowBaseline"], "View"); |
||
906 | scrMenuMgr->addMenuItem(scrActions["viewShowTextChain"], "View"); |
||
907 | scrMenuMgr->addMenuItem(scrActions["viewShowTextControls"], "View"); |
||
908 | scrMenuMgr->addMenuItem(scrActions["viewShowRulers"], "View"); |
||
909 | scrMenuMgr->addMenuItem(scrActions["viewRulerMode"], "View"); |
||
12754 | fschmid | 910 | scrMenuMgr->addMenuItem(scrActions["showMouseCoordinates"], "View"); |
5800 | fschmid | 911 | |
912 | scrActions["viewShowRulers"]->setEnabled(false); |
||
913 | |||
914 | //CB If this is viewNewView imeplemented, it should be on the windows menu |
||
915 | // scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View"); |
||
916 | |||
917 | //Tool menu |
||
918 | /* |
||
919 | scrMenuMgr->createMenu("Tools", tr("&Tools")); |
||
920 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Tools"); |
||
921 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Tools"); |
||
922 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Tools"); |
||
923 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Tools"); |
||
924 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Tools"); |
||
925 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Tools"); |
||
926 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Tools"); |
||
927 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Tools"); |
||
928 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Tools"); |
||
929 | scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Tools"); |
||
930 | scrMenuMgr->addMenuSeparator("Tools"); |
||
931 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Tools"); |
||
932 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Tools"); |
||
933 | //scrActions["toolsPreflightVerifier"]->setEnabled(false);*/ |
||
934 | |||
935 | //Extra menu |
||
12940 | cbradney | 936 | scrMenuMgr->createMenu("Extras", ActionManager::defaultMenuNameEntryTranslated("Extras")); |
11439 | cbradney | 937 | scrMenuMgr->addMenuItem(scrActions["extrasManageImages"], "Extras"); |
5800 | fschmid | 938 | scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras"); |
939 | scrMenuMgr->addMenuItem(scrActions["extrasDeHyphenateText"], "Extras"); |
||
940 | scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras"); |
||
941 | |||
942 | scrMenuMgr->setMenuEnabled("Extras", false); |
||
943 | scrActions["extrasHyphenateText"]->setEnabled(false); |
||
944 | scrActions["extrasDeHyphenateText"]->setEnabled(false); |
||
11129 | subik | 945 | connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow())); |
5800 | fschmid | 946 | |
947 | //Window menu |
||
12940 | cbradney | 948 | scrMenuMgr->createMenu("Windows", ActionManager::defaultMenuNameEntryTranslated("Windows"), QString::null, true); |
5800 | fschmid | 949 | connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
950 | addDefaultWindowMenuItems(); |
||
951 | |||
952 | //Help menu |
||
12940 | cbradney | 953 | scrMenuMgr->createMenu("Help", ActionManager::defaultMenuNameEntryTranslated("Help")); |
7425 | cbradney | 954 | scrMenuMgr->addMenuItem(scrActions["helpManual"], "Help"); |
10051 | cbradney | 955 | scrMenuMgr->addMenuItem(scrActions["helpManual2"], "Help"); |
7425 | cbradney | 956 | scrMenuMgr->addMenuSeparator("Help"); |
957 | scrMenuMgr->addMenuItem(scrActions["helpTooltips"], "Help"); |
||
958 | scrMenuMgr->addMenuSeparator("Help"); |
||
10311 | cbradney | 959 | scrMenuMgr->addMenuItem(scrActions["helpOnlineWWW"], "Help"); |
960 | scrMenuMgr->addMenuItem(scrActions["helpOnlineDocs"], "Help"); |
||
961 | scrMenuMgr->addMenuItem(scrActions["helpOnlineWiki"], "Help"); |
||
10558 | cbradney | 962 | scrMenuMgr->createMenu("HelpOnlineTutorials", tr("Online &Tutorials"), "Help"); |
10325 | cbradney | 963 | scrMenuMgr->addMenuItem(scrActions["helpOnlineTutorial1"], "HelpOnlineTutorials"); |
10311 | cbradney | 964 | scrMenuMgr->addMenuSeparator("Help"); |
10913 | jghali | 965 | scrMenuMgr->addMenuItem(scrActions["helpCheckUpdates"], "Help"); |
966 | scrMenuMgr->addMenuSeparator("Help"); |
||
5800 | fschmid | 967 | scrMenuMgr->addMenuItem(scrActions["helpAboutScribus"], "Help"); |
968 | scrMenuMgr->addMenuItem(scrActions["helpAboutPlugins"], "Help"); |
||
969 | scrMenuMgr->addMenuItem(scrActions["helpAboutQt"], "Help"); |
||
10953 | subik | 970 | |
5800 | fschmid | 971 | scrMenuMgr->addMenuToMenuBar("File"); |
972 | scrMenuMgr->addMenuToMenuBar("Edit"); |
||
973 | scrMenuMgr->addMenuToMenuBar("Item"); |
||
974 | scrMenuMgr->setMenuEnabled("Item", false); |
||
975 | scrMenuMgr->addMenuToMenuBar("Insert"); |
||
976 | scrMenuMgr->setMenuEnabled("Insert", false); |
||
977 | scrMenuMgr->addMenuToMenuBar("Page"); |
||
978 | scrMenuMgr->setMenuEnabled("Page", false); |
||
979 | scrMenuMgr->addMenuToMenuBar("View"); |
||
980 | scrMenuMgr->setMenuEnabled("View", false); |
||
981 | //scrMenuMgr->addMenuToMenuBar("Tools"); |
||
982 | scrMenuMgr->addMenuToMenuBar("Extras"); |
||
983 | scrMenuMgr->setMenuEnabled("Extras", false); |
||
984 | scrMenuMgr->addMenuToMenuBar("Windows"); |
||
985 | //scrMenuMgr->setMenuEnabled("Windows", false); |
||
10564 | fschmid | 986 | menuBar()->addSeparator(); |
5800 | fschmid | 987 | scrMenuMgr->addMenuToMenuBar("Help"); |
988 | } |
||
989 | |||
10532 | avox | 990 | |
5800 | fschmid | 991 | void ScribusMainWindow::addDefaultWindowMenuItems() |
992 | { |
||
993 | scrMenuMgr->clearMenu("Windows"); |
||
994 | scrMenuMgr->addMenuItem(scrActions["windowsCascade"], "Windows"); |
||
995 | scrMenuMgr->addMenuItem(scrActions["windowsTile"], "Windows"); |
||
996 | scrMenuMgr->addMenuSeparator("Windows"); |
||
997 | |||
998 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Windows"); |
||
999 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Windows"); |
||
1000 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Windows"); |
||
1001 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Windows"); |
||
1002 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Windows"); |
||
1003 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Windows"); |
||
1004 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Windows"); |
||
1005 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Windows"); |
||
1006 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Windows"); |
||
1007 | scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Windows"); |
||
1008 | scrMenuMgr->addMenuSeparator("Windows"); |
||
1009 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Windows"); |
||
1010 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Windows"); |
||
1011 | } |
||
1012 | |||
1013 | |||
1014 | void ScribusMainWindow::initStatusBar() |
||
1015 | { |
||
10564 | fschmid | 1016 | mainWindowStatusLabel = new QLabel( " ", statusBar()); |
9953 | cbradney | 1017 | mainWindowProgressBar = new QProgressBar(statusBar()); |
1018 | mainWindowProgressBar->setAlignment(Qt::AlignHCenter); |
||
5800 | fschmid | 1019 | mainWindowProgressBar->setFixedWidth( 100 ); |
1020 | mainWindowProgressBar->reset(); |
||
12904 | jghali | 1021 | mainWindowXPosLabel = new QLabel( tr("X-Pos:"), statusBar()); |
1022 | mainWindowYPosLabel = new QLabel( tr("Y-Pos:"), statusBar()); |
||
10564 | fschmid | 1023 | mainWindowXPosDataLabel = new QLabel( " ", statusBar()); |
1024 | mainWindowYPosDataLabel = new QLabel( " ", statusBar()); |
||
5800 | fschmid | 1025 | |
10564 | fschmid | 1026 | statusBar()->addPermanentWidget(mainWindowStatusLabel, 6); |
1027 | statusBar()->addPermanentWidget(mainWindowProgressBar, 0); |
||
1028 | statusBar()->addPermanentWidget(mainWindowXPosLabel, 0); |
||
1029 | statusBar()->addPermanentWidget(mainWindowXPosDataLabel, 1); |
||
1030 | statusBar()->addPermanentWidget(mainWindowYPosLabel, 0); |
||
1031 | statusBar()->addPermanentWidget(mainWindowYPosDataLabel, 1); |
||
5800 | fschmid | 1032 | } |
1033 | |||
10532 | avox | 1034 | |
5800 | fschmid | 1035 | void ScribusMainWindow::setStatusBarMousePosition(double xp, double yp) |
1036 | { |
||
1037 | double xn = xp; |
||
1038 | double yn = yp; |
||
1039 | if (doc->guidesSettings.rulerMode) |
||
1040 | { |
||
1041 | xn -= doc->currentPage()->xOffset(); |
||
1042 | yn -= doc->currentPage()->yOffset(); |
||
1043 | } |
||
1044 | xn -= doc->rulerXoffset; |
||
1045 | yn -= doc->rulerYoffset; |
||
12652 | cbradney | 1046 | mainWindowXPosDataLabel->setText(value2String(xn, doc->unitIndex(), true, true)); |
1047 | mainWindowYPosDataLabel->setText(value2String(yn, doc->unitIndex(), true, true)); |
||
5800 | fschmid | 1048 | } |
1049 | |||
15468 | craig | 1050 | void ScribusMainWindow::setStatusBarTextPosition(double base, double xp) |
1051 | { |
||
1052 | mainWindowXPosDataLabel->setText(base + xp >= 0? value2String(xp, doc->unitIndex(), true, true): QString("-")); |
||
1053 | mainWindowYPosDataLabel->setText("-"); |
||
1054 | } |
||
10532 | avox | 1055 | |
5800 | fschmid | 1056 | void ScribusMainWindow::setStatusBarInfoText(QString newText) |
1057 | { |
||
1058 | if (mainWindowStatusLabel) |
||
1059 | mainWindowStatusLabel->setText(newText); |
||
1060 | } |
||
1061 | |||
10532 | avox | 1062 | |
1063 | //AV to be replaced with Selection::update and listener in PropertiesPalette |
||
5800 | fschmid | 1064 | void ScribusMainWindow::setTBvals(PageItem *currItem) |
1065 | { |
||
1066 | if (currItem->itemText.length() != 0) |
||
1067 | { |
||
8562 | jghali | 1068 | // int ChPos = qMin(currItem->CPos, static_cast<int>(currItem->itemText.length()-1)); |
12715 | pierre | 1069 | const ParagraphStyle& currPStyle( (doc->appMode == modeEdit) ? currItem->currentStyle() : currItem->itemText.defaultStyle()); |
5800 | fschmid | 1070 | setAbsValue(currPStyle.alignment()); |
6866 | avox | 1071 | propertiesPalette->setParStyle(currPStyle.parent()); |
9607 | avox | 1072 | propertiesPalette->setCharStyle(currItem->currentCharStyle().parent()); |
9067 | avox | 1073 | doc->currentStyle = currItem->currentStyle(); |
13615 | jghali | 1074 | // #8112 : do not use operator= here as it does not update style features |
1075 | doc->currentStyle.charStyle().setStyle( currItem->currentCharStyle() ); |
||
9067 | avox | 1076 | emit TextStyle(doc->currentStyle); |
1077 | // to go: (av) |
||
5800 | fschmid | 1078 | emit TextUnderline(doc->currentStyle.charStyle().underlineOffset(), doc->currentStyle.charStyle().underlineWidth()); |
1079 | emit TextStrike(doc->currentStyle.charStyle().strikethruOffset(), doc->currentStyle.charStyle().strikethruWidth()); |
||
1080 | emit TextShadow(doc->currentStyle.charStyle().shadowXOffset(), doc->currentStyle.charStyle().shadowYOffset()); |
||
7087 | subik | 1081 | emit TextFarben(doc->currentStyle.charStyle().strokeColor(), |
1082 | doc->currentStyle.charStyle().fillColor(), |
||
1083 | doc->currentStyle.charStyle().strokeShade(), |
||
5800 | fschmid | 1084 | doc->currentStyle.charStyle().fillShade()); |
5980 | avox | 1085 | emit TextIFont(doc->currentStyle.charStyle().font().scName()); |
5800 | fschmid | 1086 | emit TextISize(doc->currentStyle.charStyle().fontSize()); |
1087 | emit TextUSval(doc->currentStyle.charStyle().tracking()); |
||
1088 | emit TextStil(doc->currentStyle.charStyle().effects()); |
||
1089 | emit TextScale(doc->currentStyle.charStyle().scaleH()); |
||
1090 | emit TextScaleV(doc->currentStyle.charStyle().scaleV()); |
||
1091 | emit TextBase(doc->currentStyle.charStyle().baselineOffset()); |
||
1092 | emit TextOutline(doc->currentStyle.charStyle().outlineWidth()); |
||
1093 | } |
||
1094 | } |
||
1095 | |||
1096 | //Special keys assigned to actions are stolen by the action and not passed to |
||
1097 | //keyPressEvent so process them here. |
||
8080 | cbradney | 1098 | void ScribusMainWindow::specialActionKeyEvent(const QString& actionName, int unicodevalue) |
5800 | fschmid | 1099 | { |
1100 | if (HaveDoc) |
||
1101 | { |
||
1102 | if (doc->appMode==modeEdit) |
||
1103 | { |
||
1104 | if (doc->m_Selection->count() == 1) |
||
1105 | { |
||
1106 | PageItem *currItem = doc->m_Selection->itemAt(0); |
||
1107 | if (currItem!=NULL) |
||
1108 | { |
||
1109 | if (unicodevalue!=-1) |
||
1110 | { |
||
1111 | if (currItem->HasSel && currItem->itemType()==PageItem::TextFrame) |
||
16342 | mrdocs | 1112 | { |
1113 | currItem->oldCPos = currItem->itemText.startOfSelection(); |
||
1114 | currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::SELECTION); |
||
5800 | fschmid | 1115 | currItem->asTextFrame()->deleteSelectedTextFromFrame(); |
16342 | mrdocs | 1116 | } |
1117 | else |
||
16638 | jghali | 1118 | currItem->oldCPos = currItem->itemText.cursorPosition(); |
1119 | currItem->itemText.insertChars(QString(QChar(unicodevalue)), true); |
||
16342 | mrdocs | 1120 | if (currItem->itemTextSaxed.isEmpty()) |
1121 | currItem->asTextFrame()->updateUndo(PageItem::INS, QString(QChar(unicodevalue))); |
||
1122 | else |
||
1123 | currItem->asTextFrame()->updateUndo(PageItem::REPSAX, currItem->getTextSaxed(QString(QChar(unicodevalue)))); |
||
8177 | avox | 1124 | // currItem->Tinput = true; |
10532 | avox | 1125 | currItem->update(); |
5800 | fschmid | 1126 | } |
1127 | else if (actionName=="unicodeSmartHyphen") //ignore the char as we use an attribute if the text item, for now. |
||
1128 | { |
||
7087 | subik | 1129 | // this code is currently dead since unicodeSmartHyphen |
6999 | avox | 1130 | // doesnt have unicodevalue == -1 any more |
16638 | jghali | 1131 | if (currItem->itemText.cursorPosition() - 1 > 0) |
5800 | fschmid | 1132 | { |
7442 | avox | 1133 | #if 0 |
16638 | jghali | 1134 | StyleFlag fl = currItem->itemText.item(qMax(currItem->itemText.cursorPosition()-1,0))->effects(); |
5800 | fschmid | 1135 | fl |= ScStyle_HyphenationPossible; |
8562 | jghali | 1136 | currItem->itemText.item(qMax(currItem->CPos-1,0))->setEffects(fl); |
5800 | fschmid | 1137 | #else |
16638 | jghali | 1138 | currItem->oldCPos = currItem->itemText.cursorPosition() ; |
1139 | currItem->itemText.insertChars(QString(SpecialChars::SHYPHEN), true); |
||
16342 | mrdocs | 1140 | currItem->asTextFrame()->updateUndo(PageItem::INS, QString(SpecialChars::SHYPHEN)); |
5800 | fschmid | 1141 | #endif |
8177 | avox | 1142 | // currItem->Tinput = true; |
10532 | avox | 1143 | currItem->update(); |
5800 | fschmid | 1144 | } |
1145 | } |
||
1146 | } |
||
1147 | } |
||
1148 | } |
||
1149 | } |
||
1150 | } |
||
1151 | |||
1152 | bool ScribusMainWindow::eventFilter( QObject* /*o*/, QEvent *e ) |
||
1153 | { |
||
1154 | bool retVal; |
||
9562 | fschmid | 1155 | if (e->type() == QEvent::ToolTip) |
1156 | { |
||
12476 | cbradney | 1157 | return (!prefsManager->appPrefs.showToolTips); |
9562 | fschmid | 1158 | } |
11960 | subik | 1159 | if ( e->type() == QEvent::KeyPress ) |
11893 | cbradney | 1160 | { |
5800 | fschmid | 1161 | QKeyEvent *k = (QKeyEvent *)e; |
1162 | int keyMod=0; |
||
10390 | cbradney | 1163 | if (k->modifiers() & Qt::ShiftModifier) |
8523 | cbradney | 1164 | keyMod |= Qt::SHIFT; |
10390 | cbradney | 1165 | if (k->modifiers() & Qt::ControlModifier) |
8523 | cbradney | 1166 | keyMod |= Qt::CTRL; |
10390 | cbradney | 1167 | if (k->modifiers() & Qt::AltModifier) |
8523 | cbradney | 1168 | keyMod |= Qt::ALT; |
5800 | fschmid | 1169 | |
1170 | QKeySequence currKeySeq = QKeySequence(k->key() | keyMod); |
||
1171 | if (QString(currKeySeq).isNull()) |
||
1172 | return false; |
||
1173 | retVal=true; |
||
1174 | //Palette actions |
||
10564 | fschmid | 1175 | if (currKeySeq == scrActions["specialToggleAllPalettes"]->shortcut()) |
8613 | cbradney | 1176 | scrActions["specialToggleAllPalettes"]->activate(QAction::Trigger); |
5800 | fschmid | 1177 | else |
15303 | cbradney | 1178 | if (currKeySeq == scrActions["specialToggleAllGuides"]->shortcut()) |
1179 | scrActions["specialToggleAllGuides"]->activate(QAction::Trigger); |
||
1180 | else |
||
10390 | cbradney | 1181 | // CB These were moved to ActionManager via the setShortcutContext(Qt::ApplicationShortcut) calls, leaving for notes for now |
10181 | cbradney | 1182 | // if (currKeySeq == scrActions["toolsProperties"]->accel()) |
1183 | // scrActions["toolsProperties"]->toggle(); |
||
1184 | // else |
||
1185 | // if (currKeySeq == scrActions["toolsOutline"]->accel()) |
||
1186 | // scrActions["toolsOutline"]->toggle(); |
||
1187 | // else |
||
1188 | // if (currKeySeq == scrActions["toolsScrapbook"]->accel()) |
||
1189 | // scrActions["toolsScrapbook"]->toggle(); |
||
1190 | // else |
||
1191 | // if (currKeySeq == scrActions["toolsLayers"]->accel()) |
||
1192 | // scrActions["toolsLayers"]->toggle(); |
||
1193 | // else |
||
1194 | // if (currKeySeq == scrActions["toolsPages"]->accel()) |
||
1195 | // scrActions["toolsPages"]->toggle(); |
||
1196 | // else |
||
1197 | // if (currKeySeq == scrActions["toolsBookmarks"]->accel()) |
||
1198 | // scrActions["toolsBookmarks"]->toggle(); |
||
1199 | // else |
||
1200 | // if (currKeySeq == scrActions["toolsActionHistory"]->accel()) |
||
1201 | // scrActions["toolsActionHistory"]->toggle(); |
||
1202 | // else |
||
1203 | // if (currKeySeq == scrActions["toolsPreflightVerifier"]->accel()) |
||
1204 | // scrActions["toolsPreflightVerifier"]->toggle(); |
||
1205 | // else |
||
1206 | // if (currKeySeq == scrActions["toolsAlignDistribute"]->accel()) |
||
1207 | // scrActions["toolsAlignDistribute"]->toggle(); |
||
1208 | // else |
||
8005 | cbradney | 1209 | //Edit actions |
15723 | fschmid | 1210 | // commented out to fix Bug #9437 |
1211 | /* if (currKeySeq == scrActions["editStyles"]->shortcut()) |
||
8005 | cbradney | 1212 | scrActions["editStyles"]->toggle(); |
1213 | else |
||
10564 | fschmid | 1214 | if (currKeySeq == scrActions["editUndoAction"]->shortcut() && scrActions["editUndoAction"]->isEnabled()) |
8613 | cbradney | 1215 | scrActions["editUndoAction"]->activate(QAction::Trigger); |
5800 | fschmid | 1216 | else |
10564 | fschmid | 1217 | if (currKeySeq == scrActions["editRedoAction"]->shortcut() && scrActions["editRedoAction"]->isEnabled()) |
8613 | cbradney | 1218 | scrActions["editRedoAction"]->activate(QAction::Trigger); |
5800 | fschmid | 1219 | else |
1220 | //Other actions |
||
10564 | fschmid | 1221 | if (currKeySeq == scrActions["fileQuit"]->shortcut()) |
8613 | cbradney | 1222 | scrActions["fileQuit"]->activate(QAction::Trigger); |
5800 | fschmid | 1223 | else |
1224 | //Zoom actions |
||
10564 | fschmid | 1225 | if (currKeySeq == scrActions["toolsZoomIn"]->shortcut()) |
8613 | cbradney | 1226 | scrActions["toolsZoomIn"]->activate(QAction::Trigger); |
5800 | fschmid | 1227 | else |
10564 | fschmid | 1228 | if (currKeySeq == scrActions["toolsZoomOut"]->shortcut()) |
8613 | cbradney | 1229 | scrActions["toolsZoomOut"]->activate(QAction::Trigger); |
15723 | fschmid | 1230 | else */ |
5800 | fschmid | 1231 | retVal=false; |
1232 | } |
||
1233 | else |
||
1234 | retVal=false; |
||
1235 | //Return false to pass event to object |
||
1236 | return retVal; |
||
1237 | } |
||
1238 | |||
10532 | avox | 1239 | |
1240 | //AV -> CanvasMode |
||
5800 | fschmid | 1241 | void ScribusMainWindow::keyPressEvent(QKeyEvent *k) |
1242 | { |
||
1243 | QWidgetList windows; |
||
1244 | QWidget* w = NULL; |
||
1245 | int kk = k->key(); |
||
1246 | QString uc = k->text(); |
||
11146 | cbradney | 1247 | // QString cr, Tcha, Twort; |
7435 | fschmid | 1248 | if (HaveDoc) |
1249 | { |
||
8523 | cbradney | 1250 | if ((doc->appMode == modeMagnifier) && (kk == Qt::Key_Shift)) |
7435 | fschmid | 1251 | { |
9380 | fschmid | 1252 | qApp->changeOverrideCursor(QCursor(loadIcon("LupeZm.xpm"))); |
7435 | fschmid | 1253 | return; |
1254 | } |
||
1255 | } |
||
5800 | fschmid | 1256 | if (keyrep) |
1257 | return; |
||
1258 | keyrep = true; |
||
10390 | cbradney | 1259 | int keyMod=0; |
1260 | if (k->modifiers() & Qt::ShiftModifier) |
||
1261 | keyMod |= Qt::SHIFT; |
||
1262 | if (k->modifiers() & Qt::ControlModifier) |
||
1263 | keyMod |= Qt::CTRL; |
||
1264 | if (k->modifiers() & Qt::AltModifier) |
||
1265 | keyMod |= Qt::ALT; |
||
5800 | fschmid | 1266 | //User presses escape and we have a doc open, and we have an item selected |
8523 | cbradney | 1267 | if ((kk == Qt::Key_Escape) && (HaveDoc)) |
5800 | fschmid | 1268 | { |
1269 | keyrep = false; |
||
1270 | PageItem *currItem; |
||
1271 | if (doc->m_Selection->count() != 0) |
||
1272 | { |
||
1273 | currItem = doc->m_Selection->itemAt(0); |
||
1274 | switch (doc->appMode) |
||
1275 | { |
||
1276 | case modeNormal: |
||
10532 | avox | 1277 | case modeEditClip: |
5800 | fschmid | 1278 | currItem->Sizing = false; |
1279 | if (doc->SubMode != -1) |
||
1280 | { |
||
1281 | view->Deselect(false); |
||
9856 | fschmid | 1282 | doc->Items->removeAt(currItem->ItemNr); |
5800 | fschmid | 1283 | } |
5967 | fschmid | 1284 | else |
1285 | view->Deselect(false); |
||
11576 | avox | 1286 | view->cancelGroupTransaction(); |
5800 | fschmid | 1287 | break; |
7436 | fschmid | 1288 | case modeEdit: |
11576 | avox | 1289 | view->cancelGroupTransaction(); |
7436 | fschmid | 1290 | break; |
5800 | fschmid | 1291 | case modeLinkFrames: |
1292 | case modeUnlinkFrames: |
||
1293 | case modeRotation: |
||
1294 | case modeEditGradientVectors: |
||
8942 | cbradney | 1295 | case modeCopyProperties: |
5800 | fschmid | 1296 | view->Deselect(false); |
12022 | cbradney | 1297 | case modeEyeDropper: |
12971 | jghali | 1298 | case modeImportObject: |
5800 | fschmid | 1299 | case modePanning: |
11490 | avox | 1300 | view->requestMode(modeNormal); |
5800 | fschmid | 1301 | break; |
1302 | case modeDrawBezierLine: |
||
11672 | cbradney | 1303 | currItem->PoLine.resize(qMax(0, static_cast<int>(currItem->PoLine.size())-2)); |
5800 | fschmid | 1304 | if (currItem->PoLine.size() < 4) |
1305 | { |
||
1306 | view->Deselect(false); |
||
9856 | fschmid | 1307 | doc->Items->removeAt(currItem->ItemNr); |
5800 | fschmid | 1308 | } |
1309 | else |
||
1310 | { |
||
7736 | cbradney | 1311 | doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false); |
8591 | cbradney | 1312 | currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2.0, 1.0))); |
7736 | cbradney | 1313 | doc->AdjustItemSize(currItem); |
5800 | fschmid | 1314 | currItem->ContourLine = currItem->PoLine.copy(); |
1315 | currItem->ClipEdited = true; |
||
1316 | currItem->FrameType = 3; |
||
1317 | slotDocCh(); |
||
1318 | } |
||
1319 | view->FirstPoly = true; |
||
1320 | break; |
||
1321 | default: |
||
11704 | fschmid | 1322 | if (currItem->Sizing) |
1323 | { |
||
1324 | view->Deselect(false); |
||
1325 | doc->Items->removeAt(currItem->ItemNr); |
||
1326 | } |
||
5800 | fschmid | 1327 | break; |
1328 | } |
||
1329 | } |
||
1330 | doc->DragP = false; |
||
1331 | doc->leaveDrag = false; |
||
10532 | avox | 1332 | view->stopAllDrags(); |
5800 | fschmid | 1333 | doc->SubMode = -1; |
1334 | doc->ElemToLink = NULL; |
||
1335 | slotSelect(); |
||
11704 | fschmid | 1336 | if (doc->m_Selection->count() == 0) |
1337 | HaveNewSel(-1); |
||
11606 | fschmid | 1338 | prefsManager->appPrefs.stickyTools = false; |
1339 | scrActions["stickyTools"]->setChecked(prefsManager->appPrefs.stickyTools); |
||
5800 | fschmid | 1340 | return; |
1341 | } |
||
10390 | cbradney | 1342 | Qt::KeyboardModifiers buttonModifiers = k->modifiers(); |
5800 | fschmid | 1343 | /**If we have a doc and we are not changing the page or zoom level in the status bar */ |
1344 | if ((HaveDoc) && (!view->zoomSpinBox->hasFocus()) && (!view->pageSelector->hasFocus())) |
||
1345 | { |
||
11146 | cbradney | 1346 | //Show our context menu |
1347 | QKeySequence currKeySeq = QKeySequence(kk | keyMod); |
||
11149 | cbradney | 1348 | if (currKeySeq.matches(scrActions["viewShowContextMenu"]->shortcut()) == QKeySequence::ExactMatch) |
11146 | cbradney | 1349 | { |
1350 | ContextMenu* cmen=NULL; |
||
1351 | qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); |
||
1352 | if (doc->m_Selection->count() == 0) |
||
1353 | { |
||
1354 | //CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPos()); |
||
1355 | QPoint p(QCursor::pos() - mapToGlobal(QPoint(0,0))); |
||
1356 | FPoint fp(p.x() / view->scale() + doc->minCanvasCoordinate.x(), |
||
11960 | subik | 1357 | p.y() / view->scale() + doc->minCanvasCoordinate.y()); |
11146 | cbradney | 1358 | cmen = new ContextMenu(this, doc, fp.x(), fp.y()); |
1359 | } |
||
1360 | else |
||
1361 | cmen = new ContextMenu(*(doc->m_Selection), this, doc); |
||
1362 | if (cmen) |
||
1363 | { |
||
1364 | setUndoMode(true); |
||
1365 | cmen->exec(QCursor::pos()); |
||
1366 | setUndoMode(false); |
||
1367 | } |
||
1368 | delete cmen; |
||
1369 | } |
||
11960 | subik | 1370 | |
1371 | |||
5800 | fschmid | 1372 | /** |
1373 | * With no item selected we can: |
||
1374 | * - With space, get into panning mode (modePanning) |
||
1375 | * - With PageUp, scroll up |
||
1376 | * - With PageDown, scroll down |
||
1377 | * - With Tab, change active document windowActivated |
||
1378 | */ |
||
1379 | |||
1380 | if ((doc->appMode != modeEdit) && (doc->m_Selection->count() == 0)) |
||
1381 | { |
||
6284 | fschmid | 1382 | int pg; |
8970 | fschmid | 1383 | int wheelVal = prefsManager->mouseWheelValue(); |
10390 | cbradney | 1384 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
8970 | fschmid | 1385 | wheelVal = qMax(qRound(wheelVal / 10.0), 1); |
5800 | fschmid | 1386 | switch (kk) |
1387 | { |
||
8523 | cbradney | 1388 | case Qt::Key_Space: |
5800 | fschmid | 1389 | keyrep = false; |
1390 | if (doc->appMode == modePanning) |
||
10532 | avox | 1391 | view->requestMode(modeNormal); |
5800 | fschmid | 1392 | else |
10532 | avox | 1393 | view->requestMode(modePanning); |
5800 | fschmid | 1394 | return; |
1395 | break; |
||
10564 | fschmid | 1396 | case Qt::Key_PageUp: |
6284 | fschmid | 1397 | if (doc->masterPageMode()) |
1398 | view->scrollBy(0, -prefsManager->mouseWheelValue()); |
||
1399 | else |
||
1400 | { |
||
1401 | pg = doc->currentPageNumber(); |
||
10390 | cbradney | 1402 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6284 | fschmid | 1403 | pg--; |
1404 | else |
||
1405 | pg -= doc->pageSets[doc->currentPageLayout].Columns; |
||
1406 | if (pg > -1) |
||
1407 | view->GotoPage(pg); |
||
1408 | } |
||
5800 | fschmid | 1409 | keyrep = false; |
1410 | return; |
||
1411 | break; |
||
10564 | fschmid | 1412 | case Qt::Key_PageDown: |
6284 | fschmid | 1413 | if (doc->masterPageMode()) |
1414 | view->scrollBy(0, prefsManager->mouseWheelValue()); |
||
1415 | else |
||
1416 | { |
||
1417 | pg = doc->currentPageNumber(); |
||
10390 | cbradney | 1418 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6284 | fschmid | 1419 | pg++; |
1420 | else |
||
1421 | pg += doc->pageSets[doc->currentPageLayout].Columns; |
||
7328 | fschmid | 1422 | if (pg < static_cast<int>(doc->Pages->count())) |
6284 | fschmid | 1423 | view->GotoPage(pg); |
1424 | } |
||
5800 | fschmid | 1425 | keyrep = false; |
1426 | return; |
||
1427 | break; |
||
8970 | fschmid | 1428 | case Qt::Key_Left: |
1429 | view->scrollBy(-wheelVal, 0); |
||
1430 | keyrep = false; |
||
1431 | return; |
||
1432 | break; |
||
1433 | case Qt::Key_Right: |
||
1434 | view->scrollBy(wheelVal, 0); |
||
1435 | keyrep = false; |
||
1436 | return; |
||
1437 | break; |
||
1438 | case Qt::Key_Up: |
||
1439 | view->scrollBy(0, -wheelVal); |
||
1440 | keyrep = false; |
||
1441 | return; |
||
1442 | break; |
||
1443 | case Qt::Key_Down: |
||
1444 | view->scrollBy(0, wheelVal); |
||
1445 | keyrep = false; |
||
1446 | return; |
||
1447 | break; |
||
8523 | cbradney | 1448 | case Qt::Key_Tab: |
14035 | jghali | 1449 | if (buttonModifiers == Qt::ControlModifier) |
5800 | fschmid | 1450 | { |
14035 | jghali | 1451 | keyrep = false; |
1452 | windows = wsp->windowList(); |
||
1453 | if (windows.count() > 1) |
||
5800 | fschmid | 1454 | { |
14035 | jghali | 1455 | for (int i = 0; i < static_cast<int>(windows.count()); ++i) |
5800 | fschmid | 1456 | { |
14035 | jghali | 1457 | if (wsp->activeWindow() == windows.at(i)) |
1458 | { |
||
1459 | if (i == static_cast<int>(windows.count()-1)) |
||
1460 | w = windows.at(0); |
||
1461 | else |
||
1462 | w = windows.at(i+1); |
||
1463 | break; |
||
1464 | } |
||
5800 | fschmid | 1465 | } |
14035 | jghali | 1466 | outlinePalette->buildReopenVals(); |
1467 | docCheckerPalette->clearErrorList(); |
||
1468 | if ( w ) |
||
1469 | w->showNormal(); |
||
1470 | newActWin(w); |
||
5800 | fschmid | 1471 | } |
14035 | jghali | 1472 | return; |
5800 | fschmid | 1473 | } |
1474 | break; |
||
1475 | } |
||
1476 | } |
||
1477 | /** Now if we have an item selected |
||
1478 | * - In normal mode we can: |
||
1479 | * -- Use backspace or delete to delete the item |
||
13142 | cbradney | 1480 | * -- Use itemRaise action shortcut to raise an item (actionmanager.cpp connect, no code here) |
1481 | * -- Use itemLower action shortcut to lower an item (actionmanager.cpp connect, no code here) |
||
6083 | cbradney | 1482 | * -- Use the arrow keys to move an item or group around for !inches: |
5800 | fschmid | 1483 | With no meta, by 1.0 unit |
5975 | cbradney | 1484 | Ctrl, by 10.0 units |
1485 | Shift by 0.1 units |
||
1486 | Ctrl Shift 0.01 units |
||
6083 | cbradney | 1487 | - For inches: |
1488 | With no meta, by 1.0 pt |
||
1489 | Ctrl, by 1.0 unit |
||
1490 | Shift by 0.1 units |
||
1491 | Ctrl Shift 0.01 units |
||
5800 | fschmid | 1492 | * -- Use the arrow keys to resize an item: |
1493 | Alt right arrow, move right side outwards (expand) |
||
1494 | Alt left arrow, move left side outwards (expand) |
||
1495 | Alt Shift right arrow, move left side inwards (shrink) |
||
1496 | Alt Shift left arrow, move right side inwards (shrink) |
||
1497 | * -- In edit mode of an image frame, use the arrow keys to resize the image: |
||
1498 | (flows to pageitem_imageframe for control) |
||
1499 | Alt right arrow, move right side of image outwards (expand) |
||
1500 | Alt left arrow, move right side inwards (shrink) |
||
1501 | Alt down arrow, move bottom side downwards (expand) |
||
1502 | Alt up arrow, move top side inwards (shrink) |
||
1503 | */ |
||
1504 | if (doc->m_Selection->count() != 0) |
||
1505 | { |
||
1506 | double moveBy=1.0; |
||
6083 | cbradney | 1507 | if (doc->unitIndex()!=SC_INCHES) |
1508 | { |
||
10390 | cbradney | 1509 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6083 | cbradney | 1510 | moveBy=0.1; |
10390 | cbradney | 1511 | else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6083 | cbradney | 1512 | moveBy=10.0; |
10390 | cbradney | 1513 | else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6083 | cbradney | 1514 | moveBy=0.01; |
7087 | subik | 1515 | |
6083 | cbradney | 1516 | moveBy/=doc->unitRatio();//Lets allow movement by the current doc ratio, not only points |
1517 | } |
||
1518 | else |
||
1519 | { |
||
10390 | cbradney | 1520 | if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6083 | cbradney | 1521 | moveBy=0.1/doc->unitRatio(); |
10390 | cbradney | 1522 | else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6083 | cbradney | 1523 | moveBy=1.0/doc->unitRatio(); |
10390 | cbradney | 1524 | else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier)) |
6083 | cbradney | 1525 | moveBy=0.01/doc->unitRatio(); |
1526 | } |
||
10390 | cbradney | 1527 | bool resizing=((buttonModifiers & Qt::AltModifier) && !(buttonModifiers & Qt::ControlModifier)); |
1528 | bool resizingsmaller=(resizing && (buttonModifiers & Qt::ShiftModifier)); |
||
5800 | fschmid | 1529 | double resizeBy=1.0; |
1530 | //CB with control locked out due to the requirement of moveby of 0.01, we cannot support |
||
1531 | //resizeby 10 units unless we move to supporting modifier keys that most people dont have. |
||
10537 | cbradney | 1532 | //if (buttonModifiers & Qt::ControlModifier) |
5800 | fschmid | 1533 | // resizeBy*=10.0; |
1534 | resizeBy/=doc->unitRatio(); |
||
1535 | if (resizingsmaller) |
||
1536 | resizeBy*=-1.0; |
||
1537 | |||
1538 | |||
1539 | PageItem *currItem = doc->m_Selection->itemAt(0); |
||
1540 | switch (doc->appMode) |
||
1541 | { |
||
1542 | case modeNormal: |
||
10532 | avox | 1543 | case modeEditClip: |
5800 | fschmid | 1544 | switch (kk) |
1545 | { |
||
8523 | cbradney | 1546 | case Qt::Key_Backspace: |
1547 | case Qt::Key_Delete: |
||
5800 | fschmid | 1548 | doc->itemSelection_DeleteItem(); |
1549 | break; |
||
13142 | cbradney | 1550 | /* CB: Stop using inflexible hardcoded keys here, actions for lower/raise work without this |
1551 | per note above with shortcuts. |
||
10564 | fschmid | 1552 | case Qt::Key_PageUp: |
5800 | fschmid | 1553 | if (!currItem->locked()) |
1554 | { |
||
1555 | view->RaiseItem(); |
||
1556 | } |
||
1557 | break; |
||
10564 | fschmid | 1558 | case Qt::Key_PageDown: |
5800 | fschmid | 1559 | if (!currItem->locked()) |
1560 | { |
||
1561 | view->LowerItem(); |
||
1562 | } |
||
1563 | break; |
||
13142 | cbradney | 1564 | */ |
8523 | cbradney | 1565 | case Qt::Key_Left: |
5800 | fschmid | 1566 | if (!currItem->locked()) |
1567 | { |
||
1568 | if (!resizing) |
||
1569 | { |
||
10532 | avox | 1570 | if ((doc->appMode == modeEditClip) && (doc->nodeEdit.hasNodeSelected())) |
5800 | fschmid | 1571 | { |
10532 | avox | 1572 | int storedClRe = doc->nodeEdit.ClRe; |
1573 | if ((doc->nodeEdit.SelNode.count() != 0) && (doc->nodeEdit.EdPoints)) |
||
9735 | fschmid | 1574 | { |
16975 | fschmid | 1575 | QPolygonF poly; |
10532 | avox | 1576 | for (int itm = 0; itm < doc->nodeEdit.SelNode.count(); ++itm) |
9735 | fschmid | 1577 | { |
1578 | FPoint np; |
||
10532 | avox | 1579 | int clRe = doc->nodeEdit.SelNode.at(itm); |
11395 | fschmid | 1580 | if (doc->nodeEdit.isContourLine) |
1581 | np = currItem->ContourLine.point(clRe); |
||
1582 | else |
||
1583 | np = currItem->PoLine.point(clRe); |
||
1584 | doc->nodeEdit.ClRe = clRe; |
||
1585 | np = np - FPoint(moveBy, 0); |
||
1586 | doc->nodeEdit.moveClipPoint(currItem, np); |
||
16975 | fschmid | 1587 | poly.append(QPointF(np.x(), np.y())); |
9735 | fschmid | 1588 | } |
16975 | fschmid | 1589 | QMatrix m = currItem->getTransform(); |
1590 | poly = m.map(poly); |
||
1591 | QRectF oldR = poly.boundingRect().adjusted(-5, -5, 10, 10); |
||
1592 | QRectF newR(currItem->getBoundingRect()); |
||
1593 | doc->regionsChanged()->update(newR.unite(oldR)); |
||
9735 | fschmid | 1594 | } |
10532 | avox | 1595 | doc->nodeEdit.ClRe = storedClRe; |
5800 | fschmid | 1596 | } |
1597 | else |
||
1598 | { |
||
1599 | /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ |
||
1600 | /* as the user might be trying to fine tune a position */ |
||
1601 | bool sav1 = doc->SnapGuides; |
||
1602 | bool sav2 = doc->useRaster; |
||
1603 | doc->SnapGuides = false; |
||
1604 | doc->useRaster = false; |
||
11490 | avox | 1605 | if (doc->m_Selection->count() > 1) |
1606 | view->startGroupTransaction(Um::Move, "", Um::IMove); |
||
1607 | doc->moveGroup(-moveBy, 0); |
||
1608 | if (doc->m_Selection->count() > 1) |
||
1609 | view->endGroupTransaction(); |
||
5800 | fschmid | 1610 | doc->SnapGuides = sav1; |
1611 | doc->useRaster = sav2; |
||
1612 | } |
||
1613 | } |
||
1614 | else |
||
1615 | { |
||
1616 | //CB If in EditContour mode, allow contour line to be scaled with arrow keys too |
||
10532 | avox | 1617 | if(doc->nodeEdit.isContourLine) |
5800 | fschmid | 1618 | view->TransformPoly(10, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex())); |
16889 | jghali | 1619 | else if (!currItem->sizeLocked()) |
5800 | fschmid | 1620 | { |
16889 | jghali | 1621 | if (!resizingsmaller) |
5800 | fschmid | 1622 | { |
7736 | cbradney | 1623 | doc->MoveItem(-resizeBy, 0, currItem, false); |
16889 | jghali | 1624 | currItem->moveImageXYOffsetBy(resizeBy / currItem->imageXScale(), 0); |
5800 | fschmid | 1625 | } |
16889 | jghali | 1626 | currItem->Sizing = false; |
1627 | doc->SizeItem(currItem->width() + resizeBy, currItem->height(), currItem->ItemNr); |
||
5800 | fschmid | 1628 | } |
1629 | } |
||
17151 | jghali | 1630 | if (doc->m_Selection->count() > 1) |
1631 | { |
||
1632 | double x, y, w, h; |
||
1633 | doc->m_Selection->setGroupRect(); |
||
1634 | doc->m_Selection->getGroupRect(&x, &y, &w, &h); |
||
1635 | propertiesPalette->setXY(x, y); |
||
1636 | propertiesPalette->setBH(w, h); |
||
1637 | } |
||
10532 | avox | 1638 | currItem->update(); |
5800 | fschmid | 1639 | slotDocCh(); |
1640 | } |
||
1641 | break; |
||
8523 | cbradney | 1642 | case Qt::Key_Right: |
5800 | fschmid | 1643 | if (!currItem->locked()) |
1644 | { |
||
1645 | if (!resizing) |
||
1646 | { |
||
10532 | avox | 1647 | if ((doc->appMode == modeEditClip) && (doc->nodeEdit.hasNodeSelected())) |
5800 | fschmid | 1648 | { |
10532 | avox | 1649 | int storedClRe = doc->nodeEdit.ClRe; |
1650 | if ((doc->nodeEdit.SelNode.count() != 0) && (doc->nodeEdit.EdPoints)) |
||
9735 | fschmid | 1651 | { |
16975 | fschmid | 1652 | QPolygonF poly; |
10532 | avox | 1653 | for (int itm = 0; itm < doc->nodeEdit.SelNode.count(); ++itm) |
9735 | fschmid | 1654 | { |
1655 | FPoint np; |
||
10532 | avox | 1656 | int clRe = doc->nodeEdit.SelNode.at(itm); |
11395 | fschmid | 1657 | if (doc->nodeEdit.isContourLine) |
1658 | np = currItem->ContourLine.point(clRe); |
||
1659 | else |
||
1660 | np = currItem->PoLine.point(clRe); |
||
1661 | doc->nodeEdit.ClRe = clRe; |
||
1662 | np = np + FPoint(moveBy, 0); |
||
1663 | doc->nodeEdit.moveClipPoint(currItem, np); |
||
16975 | fschmid | 1664 | poly.append(QPointF(np.x(), np.y())); |
9735 | fschmid | 1665 | } |
16975 | fschmid | 1666 | QMatrix m = currItem->getTransform(); |
1667 | poly = m.map(poly); |
||
1668 | QRectF oldR = poly.boundingRect().adjusted(-5, -5, 10, 10); |
||
1669 | QRectF newR(currItem->getBoundingRect()); |
||
1670 | doc->regionsChanged()->update(newR.unite(oldR)); |
||
9735 | fschmid | 1671 | } |
10532 | avox | 1672 | doc->nodeEdit.ClRe = storedClRe; |
5800 | fschmid | 1673 | } |
1674 | else |
||
1675 | { |
||
1676 | /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ |
||
1677 | /* as the user might be trying to fine tune a position */ |
||
1678 | bool sav1 = doc->SnapGuides; |
||
1679 | bool sav2 = doc->useRaster; |
||
1680 | doc->SnapGuides = false; |
||
1681 | doc->useRaster = false; |
||
11490 | avox | 1682 | if (doc->m_Selection->count() > 1) |
1683 | view->startGroupTransaction(Um::Move, "", Um::IMove); |
||
1684 | doc->moveGroup(moveBy, 0); |
||
1685 | if (doc->m_Selection->count() > 1) |
||
1686 | view->endGroupTransaction(); |
||
5800 | fschmid | 1687 | doc->SnapGuides = sav1; |
1688 | doc->useRaster = sav2; |
||
1689 | } |
||
1690 | } |
||
1691 | else |
||
1692 | { |
||
1693 | //CB If in EditContour mode, allow contour line to be scaled with arrow keys too |
||
10532 | avox | 1694 | if(doc->nodeEdit.isContourLine) |
5800 | fschmid | 1695 | view->TransformPoly(11, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex())); |
16889 | jghali | 1696 | else if (!currItem->sizeLocked()) |
5800 | fschmid | 1697 | { |
1698 | if (resizingsmaller) |
||
1699 | { |
||
7736 | cbradney | 1700 | doc->MoveItem(-resizeBy, 0, currItem, false); |
16889 | jghali | 1701 | currItem->moveImageXYOffsetBy(resizeBy / currItem->imageXScale(), 0); |
5800 | fschmid | 1702 | } |
16889 | jghali | 1703 | currItem->Sizing = false; |
1704 | doc->SizeItem(currItem->width() + resizeBy, currItem->height(), currItem->ItemNr); |
||
5800 | fschmid | 1705 | } |
1706 | } |
||
17151 | jghali | 1707 | if (doc->m_Selection->count() > 1) |
1708 | { |
||
1709 | double x, y, w, h; |
||
1710 | doc->m_Selection->setGroupRect(); |
||
1711 | doc->m_Selection->getGroupRect(&x, &y, &w, &h); |
||
1712 | propertiesPalette->setXY(x, y); |
||
1713 | propertiesPalette->setBH(w, h); |
||
1714 | } |
||
10532 | avox | 1715 | currItem->update(); |
5800 | fschmid | 1716 | slotDocCh(); |
1717 | } |
||
1718 | break; |
||
8523 | cbradney | 1719 | case Qt::Key_Up: |
5800 | fschmid | 1720 | if (!currItem->locked()) |
1721 | { |
||
1722 | if (!resizing) |
||
1723 | { |
||
10532 | avox | 1724 | if ((doc->appMode == modeEditClip) && (doc->nodeEdit.hasNodeSelected())) |
5800 | fschmid | 1725 | { |
10532 | avox | 1726 | int storedClRe = doc->nodeEdit.ClRe; |
1727 | if ((doc->nodeEdit.SelNode.count() != 0) && (doc->nodeEdit.EdPoints)) |
||
9735 | fschmid | 1728 | { |
16975 | fschmid | 1729 | QPolygonF poly; |
10532 | avox | 1730 | for (int itm = 0; itm < doc->nodeEdit.SelNode.count(); ++itm) |
9735 | fschmid | 1731 | { |
1732 | FPoint np; |
||
10532 | avox | 1733 | int clRe = doc->nodeEdit.SelNode.at(itm); |
11395 | fschmid | 1734 | if (doc->nodeEdit.isContourLine) |
1735 | np = currItem->ContourLine.point(clRe); |
||
1736 | else |
||
1737 | np = currItem->PoLine.point(clRe); |
||
1738 | doc->nodeEdit.ClRe = clRe; |
||
1739 | np = np - FPoint(0, moveBy); |
||
1740 | doc->nodeEdit.moveClipPoint(currItem, np); |
||
16975 | fschmid | 1741 | poly.append(QPointF(np.x(), np.y())); |
9735 | fschmid | 1742 | } |
16975 | fschmid | 1743 | QMatrix m = currItem->getTransform(); |
1744 | poly = m.map(poly); |
||
1745 | QRectF oldR = poly.boundingRect().adjusted(-5, -5, 10, 10); |
||
1746 | QRectF newR(currItem->getBoundingRect()); |
||
1747 | doc->regionsChanged()->update(newR.unite(oldR)); |
||
9735 | fschmid | 1748 | } |
10532 | avox | 1749 | doc->nodeEdit.ClRe = storedClRe; |
5800 | fschmid | 1750 | } |
1751 | else |
||
1752 | { |
||
1753 | /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ |
||
1754 | /* as the user might be trying to fine tune a position */ |
||
1755 | bool sav1 = doc->SnapGuides; |
||
1756 | bool sav2 = doc->useRaster; |
||
1757 | doc->SnapGuides = false; |
||
1758 | doc->useRaster = false; |
||
11490 | avox | 1759 | if (doc->m_Selection->count() > 1) |
1760 | view->startGroupTransaction(Um::Move, "", Um::IMove); |
||
1761 | doc->moveGroup(0, -moveBy); |
||
1762 | if (doc->m_Selection->count() > 1) |
||
1763 | view->endGroupTransaction(); |
||
5800 | fschmid | 1764 | doc->SnapGuides = sav1; |
1765 | doc->useRaster = sav2; |
||
1766 | } |
||
1767 | } |
||
1768 | else |
||
1769 | { |
||
1770 | //CB If in EditContour mode, allow contour line to be scaled with arrow keys too |
||
10532 | avox | 1771 | if(doc->nodeEdit.isContourLine) |
5800 | fschmid | 1772 | view->TransformPoly(12, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex())); |
16889 | jghali | 1773 | else if (!currItem->sizeLocked()) |
5800 | fschmid | 1774 | { |
16889 | jghali | 1775 | if (!resizingsmaller) |
5800 | fschmid | 1776 | { |
7736 | cbradney | 1777 | doc->MoveItem(0, -resizeBy, currItem, false); |
16889 | jghali | 1778 | currItem->moveImageXYOffsetBy(0, resizeBy / currItem->imageYScale()); |
5800 | fschmid | 1779 | } |
16889 | jghali | 1780 | currItem->Sizing = false; |
1781 | doc->SizeItem(currItem->width(), currItem->height() + resizeBy, currItem->ItemNr); |
||
5800 | fschmid | 1782 | } |
1783 | } |
||
17151 | jghali | 1784 | if (doc->m_Selection->count() > 1) |
1785 | { |
||
1786 | double x, y, w, h; |
||
1787 | doc->m_Selection->setGroupRect(); |
||
1788 | doc->m_Selection->getGroupRect(&x, &y, &w, &h); |
||
1789 | propertiesPalette->setXY(x, y); |
||
1790 | propertiesPalette->setBH(w, h); |
||
1791 | } |
||
10532 | avox | 1792 | currItem->update(); |
5800 | fschmid | 1793 | slotDocCh(); |
1794 | } |
||
1795 | break; |
||
8523 | cbradney | 1796 | case Qt::Key_Down: |
5800 | fschmid | 1797 | if (!currItem->locked()) |
1798 | { |
||
1799 | if (!resizing) |
||
1800 | { |
||
10532 | avox | 1801 | if ((doc->appMode == modeEditClip) && (doc->nodeEdit.hasNodeSelected())) |
5800 | fschmid | 1802 | { |
10532 | avox | 1803 | int storedClRe = doc->nodeEdit.ClRe; |
1804 | if ((doc->nodeEdit.SelNode.count() != 0) && (doc->nodeEdit.EdPoints)) |
||
9735 | fschmid | 1805 | { |
16975 | fschmid | 1806 | QPolygonF poly; |
10532 | avox | 1807 | for (int itm = 0; itm < doc->nodeEdit.SelNode.count(); ++itm) |
9735 | fschmid | 1808 | { |
1809 | FPoint np; |
||
10532 | avox | 1810 | int clRe = doc->nodeEdit.SelNode.at(itm); |
11395 | fschmid | 1811 | if (doc->nodeEdit.isContourLine) |
1812 | np = currItem->ContourLine.point(clRe); |
||
1813 | else |
||
1814 | np = currItem->PoLine.point(clRe); |
||
1815 | doc->nodeEdit.ClRe = clRe; |
||
1816 | np = np - FPoint(0, -moveBy); |
||
1817 | doc->nodeEdit.moveClipPoint(currItem, np); |
||
16975 | fschmid | 1818 | poly.append(QPointF(np.x(), np.y())); |
9735 | fschmid | 1819 | } |
16975 | fschmid | 1820 | QMatrix m = currItem->getTransform(); |
1821 | poly = m.map(poly); |
||
1822 | QRectF oldR = poly.boundingRect().adjusted(-5, -5, 10, 10); |
||
1823 | QRectF newR(currItem->getBoundingRect()); |
||
1824 | doc->regionsChanged()->update(newR.unite(oldR)); |
||
9735 | fschmid | 1825 | } |
10532 | avox | 1826 | doc->nodeEdit.ClRe = storedClRe; |
5800 | fschmid | 1827 | } |
1828 | else |
||
1829 | { |
||
1830 | /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ |
||
1831 | /* as the user might be trying to fine tune a position */ |
||
1832 | bool sav1 = doc->SnapGuides; |
||
1833 | bool sav2 = doc->useRaster; |
||
1834 | doc->SnapGuides = false; |
||
1835 | doc->useRaster = false; |
||
11490 | avox | 1836 | if (doc->m_Selection->count() > 1) |
1837 | view->startGroupTransaction(Um::Move, "", Um::IMove); |
||
1838 | doc->moveGroup(0, moveBy); |
||
1839 | if (doc->m_Selection->count(< |