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