Rev 3219 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | paul | 1 | /*************************************************************************** |
2 | scribus.cpp - description |
||
3 | ------------------- |
||
4 | begin : Fre Apr 6 21:09:31 CEST 2001 |
||
5 | copyright : (C) 2001 by Franz Schmid |
||
6 | email : Franz.Schmid@altmuehlnet.de |
||
7 | ***************************************************************************/ |
||
8 | |||
9 | /*************************************************************************** |
||
10 | * * |
||
11 | * This program is free software; you can redistribute it and/or modify * |
||
12 | * it under the terms of the GNU General Public License as published by * |
||
13 | * the Free Software Foundation; either version 2 of the License, or * |
||
14 | * (at your option) any later version. * |
||
15 | * * |
||
16 | ***************************************************************************/ |
||
17 | |||
18 | #include <qaccel.h> |
||
19 | #include <qapplication.h> |
||
204 | Franz | 20 | #include <qeventloop.h> |
3 | paul | 21 | #include <qcolordialog.h> |
22 | #include <qcolor.h> |
||
23 | #include <qiconset.h> |
||
24 | #include <qtextstream.h> |
||
25 | #include <qstylefactory.h> |
||
26 | #include <qregexp.h> |
||
27 | #include <qtextcodec.h> |
||
28 | #include <qcursor.h> |
||
29 | #include <qvbox.h> |
||
1208 | cbradney | 30 | #include <qpixmap.h> |
31 | #include <qkeysequence.h> |
||
32 | |||
3 | paul | 33 | #include <cstdio> |
34 | #include <cstdlib> |
||
391 | Franz | 35 | #include <cmath> |
2629 | craig | 36 | |
2688 | craig | 37 | #include "scconfig.h" |
2629 | craig | 38 | |
39 | #ifdef HAVE_DLFCN_H |
||
3 | paul | 40 | #include <dlfcn.h> |
2629 | craig | 41 | #endif |
42 | |||
43 | #ifdef HAVE_UNISTD_H |
||
135 | Franz | 44 | #include <unistd.h> |
2629 | craig | 45 | #endif |
46 | |||
3 | paul | 47 | #include <iostream> |
119 | Franz | 48 | #include <signal.h> |
80 | Franz | 49 | #include <string> |
1208 | cbradney | 50 | |
51 | |||
2160 | cbradney | 52 | #include "scribusapp.h" |
3 | paul | 53 | #include "scribus.h" |
54 | #include "scribus.moc" |
||
55 | #include "newfile.h" |
||
56 | #include "page.h" |
||
57 | #include "query.h" |
||
58 | #include "mdup.h" |
||
59 | #include "docinfo.h" |
||
60 | #include "reformdoc.h" |
||
61 | #include "serializer.h" |
||
2355 | cbradney | 62 | #include "aligndistribute.h" |
3 | paul | 63 | #include "fmitem.h" |
64 | #include "fontprefs.h" |
||
1641 | cbradney | 65 | #include "prefs.h" |
3251 | craig | 66 | #include "prefscontext.h" |
1158 | cbradney | 67 | #include "prefstable.h" |
3 | paul | 68 | #include "pdfopts.h" |
3133 | fschmid | 69 | #include "pdflib.h" |
3 | paul | 70 | #include "inspage.h" |
71 | #include "delpages.h" |
||
72 | #include "movepage.h" |
||
73 | #include "helpbrowser.h" |
||
74 | #include "scribusXml.h" |
||
1641 | cbradney | 75 | #include "about.h" |
3247 | craig | 76 | #include "aboutplugins.h" |
3136 | fschmid | 77 | #include "pslib.h" |
3 | paul | 78 | #include "druck.h" |
79 | #include "editformats.h" |
||
80 | #include "muster.h" |
||
3187 | fschmid | 81 | #include "newtemp.h" |
1806 | cbradney | 82 | #include "applytemplatedialog.h" |
3 | paul | 83 | #include "picstatus.h" |
84 | #include "customfdialog.h" |
||
85 | #include "cmsprefs.h" |
||
86 | #include "annot.h" |
||
87 | #include "annota.h" |
||
88 | #include "javadocs.h" |
||
151 | Franz | 89 | #include "colorm.h" |
265 | Franz | 90 | #include "mpalette.h" |
1525 | cbradney | 91 | #include "bookpalette.h" |
92 | #include "seiten.h" |
||
93 | #include "layers.h" |
||
94 | #include "frameedit.h" |
||
95 | #include "splash.h" |
||
284 | Franz | 96 | #include "measurements.h" |
364 | Franz | 97 | #include "gtgettext.h" |
506 | fschmid | 98 | #include "fileloader.h" |
740 | fschmid | 99 | #include "arrowchooser.h" |
788 | fschmid | 100 | #include "tabtypography.h" |
879 | fschmid | 101 | #include "tabguides.h" |
1194 | fschmid | 102 | #include "tabtools.h" |
1114 | tsoots | 103 | #include "undogui.h" |
1151 | fschmid | 104 | #include "filewatcher.h" |
1202 | fschmid | 105 | #include "charselect.h" |
1232 | fschmid | 106 | #include "checkDocument.h" |
1235 | fschmid | 107 | #include "tabcheckdoc.h" |
1307 | fschmid | 108 | #include "tabpdfoptions.h" |
1641 | cbradney | 109 | #include "docitemattrprefs.h" |
1644 | cbradney | 110 | #include "pageitemattributes.h" |
1694 | cbradney | 111 | #include "tocindexprefs.h" |
2441 | cbradney | 112 | #include "tocgenerator.h" |
3201 | subik | 113 | #include "collect4output.h" |
3 | paul | 114 | #include "fpoint.h" |
115 | #include "fpointarray.h" |
||
116 | #include "hysettings.h" |
||
117 | #include "guidemanager.h" |
||
284 | Franz | 118 | #include "keymanager.h" |
3 | paul | 119 | #include "mergedoc.h" |
27 | Franz | 120 | #include "lineformats.h" |
102 | Franz | 121 | #include "story.h" |
123 | Franz | 122 | #include "autoform.h" |
140 | Franz | 123 | #include "tabmanager.h" |
164 | Franz | 124 | #include "search.h" |
169 | Franz | 125 | #include "fontcombo.h" |
415 | Franz | 126 | #include "prefsfile.h" |
1114 | tsoots | 127 | #include "undomanager.h" |
731 | fschmid | 128 | #include "polygonwidget.h" |
766 | cbradney | 129 | #include "werktoolb.h" |
806 | cbradney | 130 | #include "units.h" |
838 | cbradney | 131 | #include "hruler.h" |
132 | #include "vruler.h" |
||
3053 | avox | 133 | #include "pageselector.h" |
1208 | cbradney | 134 | #include "scraction.h" |
135 | #include "menumanager.h" |
||
1293 | tsoots | 136 | #include "undostate.h" |
1414 | fschmid | 137 | #include "tree.h" |
1500 | cbradney | 138 | #include "scrap.h" |
1549 | subik | 139 | #include "pluginmanager.h" |
1693 | craig | 140 | #include "scpaths.h" |
1972 | craig | 141 | #include "pdfoptions.h" |
1993 | cbradney | 142 | #include "actionmanager.h" |
2024 | cbradney | 143 | #include "documentinformation.h" |
2056 | fschmid | 144 | #include "effectsdialog.h" |
2111 | cbradney | 145 | #include "documentchecker.h" |
2531 | craig | 146 | #include "util.h" |
2658 | fschmid | 147 | #include "pagesize.h" |
2707 | subik | 148 | #include "loremipsum.h" |
2769 | fschmid | 149 | #include "marginWidget.h" |
2777 | fschmid | 150 | #include "margindialog.h" |
2834 | cbradney | 151 | #include "prefsmanager.h" |
2901 | fschmid | 152 | #include "pagelayout.h" |
2952 | cbradney | 153 | #include "commonstrings.h" |
3165 | fschmid | 154 | #include "preview.h" |
3252 | craig | 155 | #include "scribuswin.h" |
156 | #include "hyphenator.h" |
||
134 | Franz | 157 | |
3 | paul | 158 | using namespace std; |
159 | |||
160 | #ifdef HAVE_CMS |
||
161 | cmsHPROFILE CMSoutputProf; |
||
162 | cmsHPROFILE CMSprinterProf; |
||
1781 | fschmid | 163 | cmsHTRANSFORM stdTransG; |
164 | cmsHTRANSFORM stdProofG; |
||
165 | cmsHTRANSFORM stdTransImgG; |
||
166 | cmsHTRANSFORM stdProofImgG; |
||
167 | cmsHTRANSFORM stdTransCMYKG; |
||
168 | cmsHTRANSFORM stdProofCMYKG; |
||
169 | cmsHTRANSFORM stdTransRGBG; |
||
3046 | fschmid | 170 | cmsHTRANSFORM stdProofGCG; |
171 | cmsHTRANSFORM stdProofCMYKGCG; |
||
1488 | fschmid | 172 | bool BlackPoint; |
3 | paul | 173 | bool SoftProofing; |
174 | bool Gamut; |
||
3206 | craig | 175 | bool SCRIBUS_API CMSuse; |
3 | paul | 176 | int IntentMonitor; |
177 | int IntentPrinter; |
||
178 | #endif |
||
179 | bool CMSavail; |
||
3234 | fschmid | 180 | bool previewDinUse; |
181 | bool printDinUse; |
||
2891 | cbradney | 182 | |
3 | paul | 183 | QString DocDir; |
3205 | craig | 184 | |
2536 | cbradney | 185 | extern ScribusQApp* ScQApp; |
2634 | cbradney | 186 | extern bool emergencyActivated; |
3 | paul | 187 | |
188 | Franz | 188 | ScribusApp::ScribusApp() |
2161 | cbradney | 189 | { |
2199 | cbradney | 190 | scribusInitialized=false; |
2164 | subik | 191 | actionManager=NULL; |
2178 | cbradney | 192 | scrMenuMgr=NULL; |
2199 | cbradney | 193 | undoManager=NULL; |
2834 | cbradney | 194 | prefsManager=NULL; |
2161 | cbradney | 195 | } // ScribusApp::ScribusApp() |
188 | Franz | 196 | |
767 | cbradney | 197 | /* |
198 | * retval 0 - ok, 1 - no fonts, ... |
||
199 | */ |
||
2295 | cbradney | 200 | int ScribusApp::initScribus(bool showSplash, bool showFontInfo, const QString newGuiLanguage) |
188 | Franz | 201 | { |
2952 | cbradney | 202 | CommonStrings::languageChange(); |
2894 | fschmid | 203 | noneString = tr("None"); |
767 | cbradney | 204 | int retVal=0; |
1155 | fschmid | 205 | ExternalApp = 0; |
3234 | fschmid | 206 | previewDinUse = false; |
207 | printDinUse = false; |
||
770 | cbradney | 208 | guiLanguage = newGuiLanguage; |
767 | cbradney | 209 | initSplash(showSplash); |
1208 | cbradney | 210 | setUsesBigPixmaps(true); |
355 | Franz | 211 | CurrStED = NULL; |
272 | Franz | 212 | setCaption( tr("Scribus " VERSION)); |
118 | Franz | 213 | setKeyCompression(false); |
272 | Franz | 214 | setIcon(loadIcon("AppIcon.png")); |
1325 | cbradney | 215 | scrActionGroups.clear(); |
216 | scrActionGroups.setAutoDelete(true); |
||
1208 | cbradney | 217 | scrActions.clear(); |
218 | scrRecentFileActions.clear(); |
||
1260 | cbradney | 219 | scrWindowsActions.clear(); |
2408 | cbradney | 220 | scrLayersActions.clear(); |
1208 | cbradney | 221 | scrMenuMgr = new MenuManager(this->menuBar()); |
766 | cbradney | 222 | |
2835 | cbradney | 223 | prefsManager = PrefsManager::instance(); |
2856 | cbradney | 224 | prefsManager->setup(); |
2835 | cbradney | 225 | PrefsPfad = prefsManager->preferencesLocation(); |
2907 | subik | 226 | |
227 | |||
1247 | tsoots | 228 | undoManager = UndoManager::instance(); |
1443 | tsoots | 229 | objectSpecificUndo = false; |
1549 | subik | 230 | pluginManager = new PluginManager(); |
2441 | cbradney | 231 | tocGenerator = new TOCGenerator(); |
1780 | cbradney | 232 | initDefaultValues(); |
2143 | subik | 233 | |
2187 | cbradney | 234 | actionManager = new ActionManager(this, "actionManager"); |
272 | Franz | 235 | initMenuBar(); |
236 | initStatusBar(); |
||
766 | cbradney | 237 | initToolBars(); |
490 | cbradney | 238 | qApp->processEvents(); |
675 | cbradney | 239 | |
3 | paul | 240 | BuFromApp = false; |
1485 | tsoots | 241 | |
2870 | cbradney | 242 | bool haveFonts=initFonts(showFontInfo); |
243 | if (!haveFonts) |
||
767 | cbradney | 244 | retVal=1; |
272 | Franz | 245 | else |
246 | { |
||
777 | fschmid | 247 | buildFontMenu(); |
2835 | cbradney | 248 | prefsManager->initDefaults(); |
249 | prefsManager->initDefaultGUIFont(qApp->font()); |
||
250 | prefsManager->initArrowStyles(); |
||
3 | paul | 251 | resize(610, 600); |
272 | Franz | 252 | QVBox* vb = new QVBox( this ); |
253 | vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); |
||
254 | wsp = new QWorkspace( vb ); |
||
255 | setCentralWidget( vb ); |
||
3 | paul | 256 | connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *))); |
3097 | cbradney | 257 | //Connect windows cascade and tile actions to the workspace after its created. Only depends on wsp created. |
258 | connect( scrActions["windowsCascade"], SIGNAL(activated()) , wsp, SLOT(cascade()) ); |
||
259 | connect( scrActions["windowsTile"], SIGNAL(activated()) , wsp, SLOT(tile()) ); |
||
770 | cbradney | 260 | |
801 | cbradney | 261 | initPalettes(); |
770 | cbradney | 262 | |
1155 | fschmid | 263 | fileWatcher = new FileWatcher(this); |
1485 | tsoots | 264 | |
2870 | cbradney | 265 | setSplashStatus( tr("Initializing Plugins") ); |
1550 | cbradney | 266 | pluginManager->initPlugs(); |
2870 | cbradney | 267 | setSplashStatus( tr("Initializing Keyboard Shortcuts") ); |
1437 | cbradney | 268 | initKeyboardShortcuts(); |
2870 | cbradney | 269 | setSplashStatus( tr("Reading Preferences") ); |
2859 | cbradney | 270 | prefsManager->ReadPrefs(); |
2870 | cbradney | 271 | setSplashStatus( tr("Initializing Story Editor") ); |
2494 | cbradney | 272 | storyEditor = new StoryEditor(this); |
801 | cbradney | 273 | |
2843 | fschmid | 274 | #ifndef _WIN32 |
2862 | cbradney | 275 | HaveGS = system(prefsManager->ghostscriptExecutable()+" -h > /dev/null 2>&1"); |
276 | HavePngAlpha = system(prefsManager->ghostscriptExecutable()+" -sDEVICE=pngalpha -c quit > /dev/null 2>&1"); |
||
3169 | fschmid | 277 | HaveTiffSep = system(prefsManager->ghostscriptExecutable()+" -sDEVICE=tiffsep -c quit > /dev/null 2>&1"); |
2843 | fschmid | 278 | #else |
2885 | fschmid | 279 | HaveGS = system(getShortPathName(prefsManager->ghostscriptExecutable())+" -h >NUL"); |
280 | HavePngAlpha = system(getShortPathName(prefsManager->ghostscriptExecutable())+" -sDEVICE=pngalpha -c quit >NUL"); |
||
3169 | fschmid | 281 | HaveTiffSep = system(getShortPathName(prefsManager->ghostscriptExecutable())+" -sDEVICE=tiffsep -c quit >NUL"); |
2843 | fschmid | 282 | #endif |
2871 | cbradney | 283 | DocDir = prefsManager->documentDir(); |
801 | cbradney | 284 | |
2870 | cbradney | 285 | setSplashStatus( tr("Reading ICC Profiles") ); |
831 | cbradney | 286 | CMSavail = false; |
3 | paul | 287 | GetCMSProfiles(); |
803 | cbradney | 288 | initCMS(); |
831 | cbradney | 289 | |
2870 | cbradney | 290 | setSplashStatus( tr("Initializing Hyphenator") ); |
3225 | fschmid | 291 | QString preLang = prefsManager->appPrefs.Language; |
766 | cbradney | 292 | initHyphenator(); |
3225 | fschmid | 293 | if (Sprachen.contains(preLang)) |
294 | prefsManager->appPrefs.Language = preLang; |
||
2870 | cbradney | 295 | setSplashStatus( tr("Reading Scrapbook") ); |
801 | cbradney | 296 | initScrapbook(); |
2870 | cbradney | 297 | setSplashStatus( tr("Setting up Shortcuts") ); |
1230 | cbradney | 298 | SetShortCut(); |
1485 | tsoots | 299 | |
1441 | cbradney | 300 | emit prefsChanged(); |
1485 | tsoots | 301 | |
1208 | cbradney | 302 | connect(fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecent(QString))); |
3 | paul | 303 | connect(this, SIGNAL(TextIFont(QString)), this, SLOT(AdjustFontMenu(QString))); |
304 | connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int))); |
||
1545 | cbradney | 305 | connect(this, SIGNAL(TextISize(int)), propertiesPalette, SLOT(setSize(int))); |
2382 | fschmid | 306 | connect(this, SIGNAL(TextUSval(int)), propertiesPalette, SLOT(setExtra(int))); |
1545 | cbradney | 307 | connect(this, SIGNAL(TextStil(int)), propertiesPalette, SLOT(setStil(int))); |
308 | connect(this, SIGNAL(TextScale(int)), propertiesPalette, SLOT(setTScale(int))); |
||
2230 | fschmid | 309 | connect(this, SIGNAL(TextScaleV(int)), propertiesPalette, SLOT(setTScaleV(int))); |
2234 | fschmid | 310 | connect(this, SIGNAL(TextBase(int)), propertiesPalette, SLOT(setTBase(int))); |
2247 | fschmid | 311 | connect(this, SIGNAL(TextShadow(int, int )), propertiesPalette, SLOT(setShadowOffs(int, int ))); |
2257 | fschmid | 312 | connect(this, SIGNAL(TextOutline(int)), propertiesPalette, SLOT(setOutlineW(int))); |
2262 | fschmid | 313 | connect(this, SIGNAL(TextUnderline(int, int)), propertiesPalette, SLOT(setUnderline(int, int))); |
2272 | fschmid | 314 | connect(this, SIGNAL(TextStrike(int, int)), propertiesPalette, SLOT(setStrike(int, int))); |
1545 | cbradney | 315 | connect(this, SIGNAL(TextFarben(QString, QString, int, int)), propertiesPalette, SLOT(setActFarben(QString, QString, int, int))); |
3 | paul | 316 | } |
767 | cbradney | 317 | closeSplash(); |
2199 | cbradney | 318 | scribusInitialized=true; |
2223 | cbradney | 319 | //pluginManager->languageChange(); |
767 | cbradney | 320 | return retVal; |
3 | paul | 321 | } |
322 | |||
767 | cbradney | 323 | void ScribusApp::initSplash(bool showSplash) |
324 | { |
||
325 | if (showSplash) |
||
326 | { |
||
327 | splashScreen = new SplashScreen(); |
||
2870 | cbradney | 328 | setSplashStatus(QObject::tr("Initializing...")); |
767 | cbradney | 329 | } |
330 | else |
||
331 | splashScreen = NULL; |
||
332 | } |
||
333 | |||
2870 | cbradney | 334 | void ScribusApp::setSplashStatus(const QString& newText) |
335 | { |
||
336 | if (splashScreen != NULL) |
||
337 | splashScreen->setStatus( newText ); |
||
338 | qApp->processEvents(); |
||
339 | } |
||
340 | |||
2835 | cbradney | 341 | void ScribusApp::showSplash(bool shown) |
342 | { |
||
343 | if (splashScreen!=NULL && shown!=splashScreen->isShown()) |
||
344 | splashScreen->setShown(shown); |
||
345 | } |
||
346 | |||
3171 | craig | 347 | bool ScribusApp::splashShowing() const |
348 | { |
||
349 | if (splashScreen != NULL) |
||
350 | return splashScreen->isShown(); |
||
3172 | subik | 351 | return false; |
3171 | craig | 352 | } |
353 | |||
767 | cbradney | 354 | void ScribusApp::closeSplash() |
355 | { |
||
356 | if (splashScreen!=NULL) |
||
357 | { |
||
358 | splashScreen->close(); |
||
359 | delete splashScreen; |
||
360 | splashScreen = NULL; |
||
361 | } |
||
362 | } |
||
363 | |||
766 | cbradney | 364 | void ScribusApp::initToolBars() |
365 | { |
||
2859 | cbradney | 366 | fileToolBar = new QToolBar( tr("File"), this); |
367 | scrActions["fileNew"]->addTo(fileToolBar); |
||
368 | scrActions["fileOpen"]->addTo(fileToolBar); |
||
1210 | cbradney | 369 | scrMenuMgr->addMenuToWidgetOfAction("FileOpenRecent", scrActions["fileOpen"]); |
2859 | cbradney | 370 | scrActions["fileSave"]->addTo(fileToolBar); |
371 | scrActions["fileClose"]->addTo(fileToolBar); |
||
372 | scrActions["filePrint"]->addTo(fileToolBar); |
||
373 | scrActions["toolsPreflightVerifier"]->addTo(fileToolBar); |
||
374 | scrActions["fileExportAsPDF"]->addTo(fileToolBar); |
||
1485 | tsoots | 375 | |
2397 | cbradney | 376 | editToolBar = new QToolBar( tr("Edit"), this); |
1114 | tsoots | 377 | UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget"); |
1247 | tsoots | 378 | undoManager->registerGui(uWidget); |
1485 | tsoots | 379 | |
2859 | cbradney | 380 | mainToolBar = new WerkToolB(this); |
381 | setDockEnabled(mainToolBar, DockLeft, false); |
||
382 | setDockEnabled(mainToolBar, DockRight, false); |
||
383 | mainToolBar->Sichtbar = true; |
||
384 | mainToolBar->setEnabled(false); |
||
385 | pdfToolBar = new WerkToolBP(this); |
||
386 | setDockEnabled(pdfToolBar, DockLeft, false); |
||
387 | setDockEnabled(pdfToolBar, DockRight, false); |
||
388 | pdfToolBar->setEnabled(false); |
||
389 | pdfToolBar->Sichtbar = true; |
||
801 | cbradney | 390 | |
2859 | cbradney | 391 | connect(mainToolBar, SIGNAL(Schliessen()), this, SLOT(ToggleTools())); |
392 | connect(pdfToolBar, SIGNAL(NewMode(int)), this, SLOT(setAppMode(int))); |
||
393 | connect(pdfToolBar, SIGNAL(Schliessen()), this, SLOT(TogglePDFTools())); |
||
766 | cbradney | 394 | } |
395 | |||
2870 | cbradney | 396 | //Returns false when there are no fonts |
397 | const bool ScribusApp::initFonts(bool showFontInfo) |
||
767 | cbradney | 398 | { |
2870 | cbradney | 399 | setSplashStatus( tr("Searching for Fonts") ); |
400 | bool haveFonts=prefsManager->GetAllFonts(showFontInfo); |
||
401 | if (!haveFonts) |
||
767 | cbradney | 402 | { |
403 | if (splashScreen!=NULL) |
||
404 | splashScreen->close(); // 10/10/2004 pv fix #1200 |
||
1801 | cbradney | 405 | QString mess = tr("There are no fonts found on your system."); |
406 | mess += "\n" + tr("Exiting now."); |
||
767 | cbradney | 407 | QMessageBox::critical(this, tr("Fatal Error"), mess, 1, 0, 0); |
408 | } |
||
829 | cbradney | 409 | else |
2870 | cbradney | 410 | setSplashStatus( tr("Font System Initialized") ); |
411 | return haveFonts; |
||
767 | cbradney | 412 | } |
766 | cbradney | 413 | |
801 | cbradney | 414 | void ScribusApp::initDefaultValues() |
415 | { |
||
2856 | cbradney | 416 | dirs = prefsManager->prefsFile->getContext("dirs"); |
1780 | cbradney | 417 | HaveDoc = false; |
801 | cbradney | 418 | singleClose = false; |
419 | ScriptRunning = false; |
||
420 | view = NULL; |
||
421 | doc = NULL; |
||
422 | Buffer2 = ""; |
||
3034 | cbradney | 423 | unicodeTextEditMode = false; |
424 | unicodeInputCount = 0; |
||
425 | unicodeInputString = ""; |
||
801 | cbradney | 426 | DispX = 10; |
427 | DispY = 10; |
||
428 | DocNr = 1; |
||
429 | PrinterUsed = false; |
||
430 | PDef.Pname = ""; |
||
431 | PDef.Dname = ""; |
||
432 | PDef.Command = ""; |
||
433 | keyrep = false; |
||
1204 | tsoots | 434 | _arrowKeyDown = false; |
801 | cbradney | 435 | ClipB = QApplication::clipboard(); |
436 | PalettesStat[0] = false; |
||
437 | GuidesStat[0] = false; |
||
438 | |||
439 | connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange())); |
||
770 | cbradney | 440 | } |
441 | |||
801 | cbradney | 442 | void ScribusApp::initKeyboardShortcuts() |
443 | { |
||
1478 | cbradney | 444 | for( QMap<QString, QGuardedPtr<ScrAction> >::Iterator it = scrActions.begin(); it!=scrActions.end(); ++it ) |
1525 | cbradney | 445 | { |
2178 | cbradney | 446 | if ((ScrAction*)(it.data())!=NULL) |
2873 | cbradney | 447 | { |
448 | QString accelerator=it.data()->accel(); |
||
449 | prefsManager->setKeyEntry(it.key(), it.data()->cleanMenuText(), accelerator,0); |
||
450 | } |
||
2178 | cbradney | 451 | //else |
452 | // qDebug(it.key()); |
||
1525 | cbradney | 453 | //qDebug(QString("|-\n|%1||%2||%3").arg(it.key()).arg(it.data()->cleanMenuText()).arg(QString(it.data()->accel()))); |
454 | } |
||
801 | cbradney | 455 | } |
456 | |||
457 | void ScribusApp::initPalettes() |
||
458 | { |
||
1493 | cbradney | 459 | //CB TODO hide the publicly available members of some palettes |
460 | // these must be filtered too as they take control of the palettes events |
||
1545 | cbradney | 461 | outlinePalette = new Tree(this, this); |
462 | connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool)) ); |
||
463 | connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setOn(bool))); |
||
464 | outlinePalette->setPrefsContext("OutlinePalette"); |
||
465 | outlinePalette->reportDisplay->installEventFilter(this); |
||
2834 | cbradney | 466 | propertiesPalette = new Mpalette(this); |
1545 | cbradney | 467 | connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool)) ); |
468 | connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setOn(bool))); |
||
469 | propertiesPalette->setPrefsContext("PropertiesPalette"); |
||
2871 | cbradney | 470 | propertiesPalette->Cpal->SetColors(prefsManager->colorSet()); |
1545 | cbradney | 471 | propertiesPalette->Cpal->UseTrans(true); |
2508 | fschmid | 472 | propertiesPalette->Fonts->RebuildList(0); |
1545 | cbradney | 473 | propertiesPalette->installEventFilter(this); |
474 | nodePalette = new NodePalette(this); |
||
475 | nodePalette->setPrefsContext("NodePalette"); |
||
476 | nodePalette->installEventFilter(this); |
||
1549 | subik | 477 | |
1545 | cbradney | 478 | layerPalette = new LayerPalette(this); |
479 | connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) ); |
||
480 | connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setOn(bool))); |
||
481 | layerPalette->setPrefsContext("LayerPalette"); |
||
482 | layerPalette->installEventFilter(this); |
||
483 | layerPalette->Table->installEventFilter(this); |
||
2834 | cbradney | 484 | scrapbookPalette = new Biblio(this); |
1545 | cbradney | 485 | connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) ); |
486 | connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setOn(bool))); |
||
487 | scrapbookPalette->setPrefsContext("ScrapbookPalette"); |
||
488 | scrapbookPalette->installEventFilter(this); |
||
489 | pagePalette = new SeitenPal(this); |
||
490 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) ); |
||
491 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , this, SLOT(setPagePalette(bool)) ); |
||
492 | connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setOn(bool))); |
||
493 | pagePalette->setPrefsContext("PagePalette"); |
||
494 | pagePalette->installEventFilter(this); |
||
495 | bookmarkPalette = new BookPalette(this); |
||
496 | connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) ); |
||
497 | connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setOn(bool))); |
||
498 | bookmarkPalette->setPrefsContext("BookmarkPalette"); |
||
499 | bookmarkPalette->installEventFilter(this); |
||
500 | measurementPalette = new Measurements(this); |
||
501 | connect( scrActions["toolsMeasurements"], SIGNAL(toggled(bool)) , measurementPalette, SLOT(setPaletteShown(bool)) ); |
||
1525 | cbradney | 502 | connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool, int)) , this, SLOT(setAppModeByToggle(bool, int)) ); |
1545 | cbradney | 503 | connect( measurementPalette, SIGNAL(paletteShown(bool)), scrActions["toolsMeasurements"], SLOT(setOn(bool))); |
504 | measurementPalette->setPrefsContext("MeasurementPalette"); |
||
505 | measurementPalette->installEventFilter(this); |
||
506 | measurementPalette->hide(); |
||
507 | docCheckerPalette = new CheckDocument(this, false); |
||
508 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) ); |
||
509 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setOn(bool))); |
||
1825 | fschmid | 510 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool))); |
1545 | cbradney | 511 | docCheckerPalette->setPrefsContext("DocCheckerPalette"); |
512 | docCheckerPalette->installEventFilter(this); |
||
513 | docCheckerPalette->hide(); |
||
2707 | subik | 514 | |
2355 | cbradney | 515 | alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette", false); |
516 | connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) ); |
||
517 | connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setOn(bool))); |
||
518 | connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh())); |
||
519 | alignDistributePalette->setPrefsContext("AlignDistributePalette"); |
||
520 | alignDistributePalette->installEventFilter(this); |
||
521 | alignDistributePalette->hide(); |
||
2707 | subik | 522 | |
1448 | cbradney | 523 | undoPalette = new UndoPalette(this, "undoPalette"); |
1493 | cbradney | 524 | undoPalette->installEventFilter(this); |
1448 | cbradney | 525 | undoManager->registerGui(undoPalette); |
1493 | cbradney | 526 | connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); |
1448 | cbradney | 527 | connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); |
1485 | tsoots | 528 | |
1545 | cbradney | 529 | connect(propertiesPalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
530 | connect(propertiesPalette, SIGNAL(NewAbStyle(int)), this, SLOT(setNewAbStyle(int))); |
||
531 | connect(propertiesPalette, SIGNAL(Stellung(int)), this, SLOT(setItemHoch(int))); |
||
532 | connect(propertiesPalette, SIGNAL(EditCL()), this, SLOT(ToggleFrameEdit())); |
||
3135 | cbradney | 533 | connect(propertiesPalette, SIGNAL(NewTF(const QString&)), this, SLOT(SetNewFont(const QString&))); |
1545 | cbradney | 534 | connect(propertiesPalette, SIGNAL(UpdtGui(int)), this, SLOT(HaveNewSel(int))); |
535 | connect(propertiesPalette->Cpal, SIGNAL(NewPen(QString)), this, SLOT(setPenFarbe(QString))); |
||
536 | connect(propertiesPalette->Cpal, SIGNAL(NewBrush(QString)), this, SLOT(setBrushFarbe(QString))); |
||
537 | connect(propertiesPalette->Cpal, SIGNAL(NewPenShade(int)), this, SLOT(setPenShade(int))); |
||
538 | connect(propertiesPalette->Cpal, SIGNAL(NewBrushShade(int)), this, SLOT(setBrushShade(int))); |
||
2026 | cbradney | 539 | connect(propertiesPalette->Cpal, SIGNAL(NewTrans(double)), this, SLOT(setItemFillTransparency(double))); |
540 | connect(propertiesPalette->Cpal, SIGNAL(NewTransS(double)), this, SLOT(setItemLineTransparency(double))); |
||
1545 | cbradney | 541 | connect(propertiesPalette->Cpal, SIGNAL(NewGradient(int)), this, SLOT(setGradFill(int))); |
542 | connect(propertiesPalette->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), this, SLOT(updtGradFill())); |
||
543 | connect(propertiesPalette->Cpal, SIGNAL(gradientChanged()), this, SLOT(updtGradFill())); |
||
544 | connect(propertiesPalette->Cpal, SIGNAL(QueryItem()), this, SLOT(GetBrushPen())); |
||
3025 | cbradney | 545 | connect(docCheckerPalette, SIGNAL(selectElement(int, int)), this, SLOT(selectItemsFromOutlines(int, int))); |
546 | connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
||
2093 | cbradney | 547 | connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString))); |
3025 | cbradney | 548 | connect(outlinePalette, SIGNAL(selectElement(int, int, bool)), this, SLOT(selectItemsFromOutlines(int, int, bool))); |
549 | connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); |
||
2093 | cbradney | 550 | connect(outlinePalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString))); |
1545 | cbradney | 551 | connect(propertiesPalette->Spal, SIGNAL(newStyle(int)), this, SLOT(setNewAbStyle(int))); |
552 | connect(propertiesPalette, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles())); |
||
553 | connect(nodePalette, SIGNAL(Schliessen()), this, SLOT(NoFrameEdit())); |
||
554 | connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
||
2093 | cbradney | 555 | connect(pagePalette, SIGNAL(EditTemp(QString)), this, SLOT(manageMasterPages(QString))); |
556 | connect(pagePalette->PageView, SIGNAL(UseTemp(QString, int)), this, SLOT(Apply_MasterPage(QString, int))); |
||
1545 | cbradney | 557 | connect(pagePalette->PageView, SIGNAL(NewPage(int, QString)), this, SLOT(slotNewPageP(int, QString))); |
558 | connect(pagePalette->Trash, SIGNAL(DelPage(int)), this, SLOT(DeletePage2(int))); |
||
3025 | cbradney | 559 | connect(pagePalette, SIGNAL(GotoSeite(int)), this, SLOT(selectPagesFromOutlines(int))); |
1545 | cbradney | 560 | connect(bookmarkPalette->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks())); |
561 | connect(bookmarkPalette->BView, SIGNAL(ChangeBMNr(int, int, int)), this, SLOT(ChBookmarks(int, int, int))); |
||
3025 | cbradney | 562 | connect(bookmarkPalette->BView, SIGNAL(SelectElement(int, int)), this, SLOT(selectItemsFromOutlines(int, int))); |
801 | cbradney | 563 | } |
564 | |||
565 | void ScribusApp::initScrapbook() |
||
566 | { |
||
1554 | cbradney | 567 | QString scrapbookFile = QDir::convertSeparators(PrefsPfad+"/scrap13.scs"); |
801 | cbradney | 568 | QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile); |
569 | if (scrapbookFileInfo.exists()) |
||
2144 | cbradney | 570 | scrapbookPalette->readContents(scrapbookFile); |
571 | scrapbookPalette->setScrapbookFileName(scrapbookFile); |
||
1545 | cbradney | 572 | scrapbookPalette->AdjustMenu(); |
801 | cbradney | 573 | } |
574 | |||
770 | cbradney | 575 | const QString ScribusApp::getGuiLanguage() |
576 | { |
||
577 | return guiLanguage; |
||
578 | } |
||
579 | |||
1525 | cbradney | 580 | bool ScribusApp::warningVersion(QWidget *parent) |
581 | { |
||
582 | bool retval = false; |
||
2143 | subik | 583 | int t = QMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" + |
2132 | cbradney | 584 | QObject::tr("You are running a development version of Scribus 1.3.x. The current document you are working with was originally created in Scribus 1.2.2 or lower. The process of saving will make this file unusable again in Scribus 1.2.2 unless you use File->Save As. Are you sure you wish to proceed with this operation?") + "</qt>", |
2952 | cbradney | 585 | CommonStrings::tr_Cancel, QObject::tr("&Proceed"), "", 1, 0); |
1525 | cbradney | 586 | if (t == 1) |
587 | retval = true; |
||
588 | return retval; |
||
589 | } |
||
590 | |||
3 | paul | 591 | void ScribusApp::initMenuBar() |
592 | { |
||
593 | QFont tmp; |
||
594 | RecentDocs.clear(); |
||
1208 | cbradney | 595 | |
596 | scrMenuMgr->createMenu("File", tr("&File")); |
||
597 | scrMenuMgr->addMenuItem(scrActions["fileNew"], "File"); |
||
598 | scrMenuMgr->addMenuItem(scrActions["fileOpen"], "File"); |
||
599 | recentFileMenuName="FileOpenRecent"; |
||
600 | scrMenuMgr->createMenu(recentFileMenuName, tr("Open &Recent"), "File"); |
||
601 | scrMenuMgr->addMenuSeparator("File"); |
||
602 | scrMenuMgr->addMenuItem(scrActions["fileClose"], "File"); |
||
603 | scrMenuMgr->addMenuItem(scrActions["fileSave"], "File"); |
||
604 | scrMenuMgr->addMenuItem(scrActions["fileSaveAs"], "File"); |
||
605 | scrMenuMgr->addMenuItem(scrActions["fileRevert"], "File"); |
||
606 | scrMenuMgr->addMenuItem(scrActions["fileCollect"], "File"); |
||
607 | scrMenuMgr->addMenuSeparator("File"); |
||
608 | scrMenuMgr->createMenu("FileImport", tr("&Import"), "File"); |
||
609 | scrMenuMgr->addMenuItem(scrActions["fileImportText"], "FileImport"); |
||
610 | scrMenuMgr->addMenuItem(scrActions["fileImportAppendText"], "FileImport"); |
||
611 | scrMenuMgr->addMenuItem(scrActions["fileImportImage"], "FileImport"); |
||
612 | scrMenuMgr->createMenu("FileExport", tr("&Export"), "File"); |
||
613 | scrMenuMgr->addMenuItem(scrActions["fileExportText"], "FileExport"); |
||
614 | scrMenuMgr->addMenuItem(scrActions["fileExportAsEPS"], "FileExport"); |
||
615 | scrMenuMgr->addMenuItem(scrActions["fileExportAsPDF"], "FileExport"); |
||
616 | scrMenuMgr->addMenuSeparator("File"); |
||
617 | scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File"); |
||
618 | scrMenuMgr->addMenuItem(scrActions["filePrint"], "File"); |
||
3165 | fschmid | 619 | scrMenuMgr->addMenuItem(scrActions["PrintPreview"], "File"); |
1208 | cbradney | 620 | scrMenuMgr->addMenuSeparator("File"); |
621 | scrMenuMgr->addMenuItem(scrActions["fileQuit"], "File"); |
||
622 | |||
1485 | tsoots | 623 | scrActions["fileClose"]->setEnabled(false); |
1208 | cbradney | 624 | scrActions["fileSave"]->setEnabled(false); |
625 | scrActions["fileSaveAs"]->setEnabled(false); |
||
626 | scrActions["fileRevert"]->setEnabled(false); |
||
627 | scrActions["fileCollect"]->setEnabled(false); |
||
628 | scrActions["fileImportText"]->setEnabled(false); |
||
629 | scrActions["fileImportImage"]->setEnabled(false); |
||
630 | scrActions["fileImportAppendText"]->setEnabled(false); |
||
2093 | cbradney | 631 | scrActions["pageImport"]->setEnabled(false); |
1208 | cbradney | 632 | scrActions["fileExportText"]->setEnabled(false); |
633 | scrActions["fileExportAsEPS"]->setEnabled(false); |
||
634 | scrActions["fileExportAsPDF"]->setEnabled(false); |
||
635 | scrMenuMgr->setMenuEnabled("FileExport", false); |
||
636 | scrActions["fileDocSetup"]->setEnabled(false); |
||
637 | scrActions["filePrint"]->setEnabled(false); |
||
3165 | fschmid | 638 | scrActions["PrintPreview"]->setEnabled(false); |
1485 | tsoots | 639 | |
1227 | cbradney | 640 | scrMenuMgr->createMenu("Edit", tr("&Edit")); |
641 | scrMenuMgr->addMenuItem(scrActions["editUndoAction"], "Edit"); |
||
642 | scrMenuMgr->addMenuItem(scrActions["editRedoAction"], "Edit"); |
||
643 | scrMenuMgr->addMenuItem(scrActions["editActionMode"], "Edit"); |
||
644 | scrMenuMgr->addMenuSeparator("Edit"); |
||
645 | scrMenuMgr->addMenuItem(scrActions["editCut"], "Edit"); |
||
646 | scrMenuMgr->addMenuItem(scrActions["editCopy"], "Edit"); |
||
647 | scrMenuMgr->addMenuItem(scrActions["editPaste"], "Edit"); |
||
1963 | cbradney | 648 | scrMenuMgr->addMenuItem(scrActions["editClearContents"], "Edit"); |
1227 | cbradney | 649 | scrMenuMgr->addMenuItem(scrActions["editSelectAll"], "Edit"); |
1837 | cbradney | 650 | scrMenuMgr->addMenuItem(scrActions["editDeselectAll"], "Edit"); |
1227 | cbradney | 651 | scrMenuMgr->addMenuSeparator("Edit"); |
652 | scrMenuMgr->addMenuItem(scrActions["editSearchReplace"], "Edit"); |
||
1981 | cbradney | 653 | scrMenuMgr->addMenuItem(scrActions["toolsEditWithStoryEditor"], "Edit"); |
2259 | cbradney | 654 | scrMenuMgr->addMenuItem(scrActions["editEditWithImageEditor"], "Edit"); |
1227 | cbradney | 655 | scrMenuMgr->addMenuSeparator("Edit"); |
656 | scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit"); |
||
657 | scrMenuMgr->addMenuItem(scrActions["editParaStyles"], "Edit"); |
||
658 | scrMenuMgr->addMenuItem(scrActions["editLineStyles"], "Edit"); |
||
2093 | cbradney | 659 | scrMenuMgr->addMenuItem(scrActions["editMasterPages"], "Edit"); |
1227 | cbradney | 660 | scrMenuMgr->addMenuItem(scrActions["editJavascripts"], "Edit"); |
661 | scrMenuMgr->addMenuSeparator("Edit"); |
||
662 | scrMenuMgr->addMenuItem(scrActions["editPreferences"], "Edit"); |
||
663 | scrActions["editUndoAction"]->setEnabled(false); |
||
664 | scrActions["editRedoAction"]->setEnabled(false); |
||
1446 | tsoots | 665 | scrActions["editActionMode"]->setEnabled(true); |
1227 | cbradney | 666 | scrActions["editCut"]->setEnabled(false); |
667 | scrActions["editCopy"]->setEnabled(false); |
||
668 | scrActions["editPaste"]->setEnabled(false); |
||
1963 | cbradney | 669 | scrActions["editClearContents"]->setEnabled(false); |
1227 | cbradney | 670 | scrActions["editSelectAll"]->setEnabled(false); |
1837 | cbradney | 671 | scrActions["editDeselectAll"]->setEnabled(false); |
1227 | cbradney | 672 | scrActions["editSearchReplace"]->setEnabled(false); |
673 | scrActions["editParaStyles"]->setEnabled(false); |
||
674 | scrActions["editLineStyles"]->setEnabled(false); |
||
2093 | cbradney | 675 | scrActions["editMasterPages"]->setEnabled(false); |
1227 | cbradney | 676 | scrActions["editJavascripts"]->setEnabled(false); |
1996 | cbradney | 677 | scrActions["toolsEditWithStoryEditor"]->setEnabled(false); |
2279 | cbradney | 678 | scrActions["editEditWithImageEditor"]->setEnabled(false); |
1227 | cbradney | 679 | |
680 | //Style Menu |
||
1325 | cbradney | 681 | scrMenuMgr->createMenu("Style", tr("St&yle")); |
1437 | cbradney | 682 | //Color menu |
683 | // CB TODO |
||
684 | scrMenuMgr->createMenu("Color", tr("&Color")); |
||
685 | ColorMenC = new QComboBox(false); |
||
686 | ColorMenC->setEditable(false); |
||
687 | scrMenuMgr->addMenuItem(ColorMenC, "Color"); |
||
1485 | tsoots | 688 | |
1437 | cbradney | 689 | //Text size menu |
690 | scrMenuMgr->createMenu("FontSize", tr("&Size")); |
||
691 | scrActionGroups["fontSize"]->addTo(scrMenuMgr->getLocalPopupMenu("FontSize")); |
||
1485 | tsoots | 692 | |
1437 | cbradney | 693 | //Shade menu |
694 | scrMenuMgr->createMenu("Shade", tr("&Shade")); |
||
695 | scrActionGroups["shade"]->addTo(scrMenuMgr->getLocalPopupMenu("Shade")); |
||
1485 | tsoots | 696 | |
1437 | cbradney | 697 | //Font menu |
698 | scrMenuMgr->createMenu("Font", tr("&Font")); |
||
699 | FontMenu = scrMenuMgr->getLocalPopupMenu("Font"); |
||
1485 | tsoots | 700 | |
1437 | cbradney | 701 | //Type style menu |
702 | scrMenuMgr->createMenu("TypeEffects", tr("&Effects")); |
||
703 | scrActionGroups["typeEffects"]->addTo(scrMenuMgr->getLocalPopupMenu("TypeEffects")); |
||
1485 | tsoots | 704 | |
1236 | cbradney | 705 | //Item Menu |
706 | scrMenuMgr->createMenu("Item", tr("&Item")); |
||
707 | scrMenuMgr->addMenuItem(scrActions["itemDuplicate"], "Item"); |
||
708 | scrMenuMgr->addMenuItem(scrActions["itemMulDuplicate"], "Item"); |
||
709 | scrMenuMgr->addMenuItem(scrActions["itemDelete"], "Item"); |
||
710 | scrMenuMgr->addMenuSeparator("Item"); |
||
711 | scrMenuMgr->addMenuItem(scrActions["itemGroup"], "Item"); |
||
712 | scrMenuMgr->addMenuItem(scrActions["itemUngroup"], "Item"); |
||
713 | scrMenuMgr->addMenuItem(scrActions["itemLock"], "Item"); |
||
1858 | cbradney | 714 | scrMenuMgr->addMenuItem(scrActions["itemLockSize"], "Item"); |
2256 | cbradney | 715 | scrMenuMgr->addMenuSeparator("Item"); |
2026 | cbradney | 716 | scrMenuMgr->addMenuItem(scrActions["itemImageIsVisible"], "Item"); |
2260 | cbradney | 717 | scrMenuMgr->addMenuItem(scrActions["itemUpdateImage"], "Item"); |
2259 | cbradney | 718 | scrMenuMgr->addMenuItem(scrActions["itemAdjustFrameToImage"], "Item"); |
2260 | cbradney | 719 | scrMenuMgr->addMenuItem(scrActions["itemExtendedImageProperties"], "Item"); |
2959 | subik | 720 | scrMenuMgr->createMenu("ItemPreviewSettings", tr("Preview Settings"), "Item"); |
2256 | cbradney | 721 | scrMenuMgr->addMenuItem(scrActions["itemPreviewLow"], "ItemPreviewSettings"); |
722 | scrMenuMgr->addMenuItem(scrActions["itemPreviewNormal"], "ItemPreviewSettings"); |
||
723 | scrMenuMgr->addMenuItem(scrActions["itemPreviewFull"], "ItemPreviewSettings"); |
||
1236 | cbradney | 724 | scrMenuMgr->addMenuSeparator("Item"); |
2959 | subik | 725 | scrMenuMgr->createMenu("ItemLevel", tr("Level")); |
1858 | cbradney | 726 | scrMenuMgr->addMenuToMenu("ItemLevel", "Item"); |
2104 | cbradney | 727 | scrMenuMgr->addMenuItem(scrActions["itemRaise"], "ItemLevel"); |
1858 | cbradney | 728 | scrMenuMgr->addMenuItem(scrActions["itemLower"], "ItemLevel"); |
2104 | cbradney | 729 | scrMenuMgr->addMenuItem(scrActions["itemRaiseToTop"], "ItemLevel"); |
730 | scrMenuMgr->addMenuItem(scrActions["itemLowerToBottom"], "ItemLevel"); |
||
2959 | subik | 731 | scrMenuMgr->createMenu("ItemLayer", tr("Send to La&yer")); |
2408 | cbradney | 732 | scrMenuMgr->addMenuToMenu("ItemLayer", "Item"); |
733 | layerMenuName="ItemLayer"; |
||
1981 | cbradney | 734 | scrMenuMgr->addMenuItem(scrActions["itemSendToScrapbook"], "Item"); |
1236 | cbradney | 735 | scrMenuMgr->addMenuSeparator("Item"); |
2256 | cbradney | 736 | scrMenuMgr->addMenuItem(scrActions["itemAttributes"], "Item"); |
1981 | cbradney | 737 | scrMenuMgr->createMenu("ItemPDFOptions", tr("&PDF Options")); |
738 | scrMenuMgr->addMenuToMenu("ItemPDFOptions", "Item"); |
||
739 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsAnnotation"], "ItemPDFOptions"); |
||
2143 | subik | 740 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsBookmark"], "ItemPDFOptions"); |
1981 | cbradney | 741 | scrMenuMgr->addMenuItem(scrActions["itemPDFAnnotationProps"], "ItemPDFOptions"); |
742 | scrMenuMgr->addMenuItem(scrActions["itemPDFFieldProps"], "ItemPDFOptions"); |
||
1236 | cbradney | 743 | scrMenuMgr->createMenu("ItemShapes", tr("&Shape"), "Item"); |
744 | // CB TODO |
||
745 | //Shape menu |
||
169 | Franz | 746 | SCustom = new Autoforms(0); |
1236 | cbradney | 747 | scrMenuMgr->addMenuItem(SCustom, "ItemShapes"); |
272 | Franz | 748 | connect(SCustom, SIGNAL(FormSel(int, int, double *)), this, SLOT(MakeFrame(int, int, double *))); |
1236 | cbradney | 749 | scrMenuMgr->addMenuItem(scrActions["itemShapeEdit"], "ItemShapes"); |
1858 | cbradney | 750 | scrMenuMgr->createMenu("ItemConvertTo", tr("C&onvert To")); |
751 | scrMenuMgr->addMenuToMenu("ItemConvertTo", "Item"); |
||
752 | scrMenuMgr->addMenuItem(scrActions["itemConvertToBezierCurve"], "ItemConvertTo"); |
||
753 | scrMenuMgr->addMenuItem(scrActions["itemConvertToImageFrame"], "ItemConvertTo"); |
||
754 | scrMenuMgr->addMenuItem(scrActions["itemConvertToOutlines"], "ItemConvertTo"); |
||
755 | scrMenuMgr->addMenuItem(scrActions["itemConvertToPolygon"], "ItemConvertTo"); |
||
756 | scrMenuMgr->addMenuItem(scrActions["itemConvertToTextFrame"], "ItemConvertTo"); |
||
2143 | subik | 757 | |
1236 | cbradney | 758 | scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item"); |
759 | scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item"); |
||
760 | scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item"); |
||
761 | scrMenuMgr->addMenuItem(scrActions["itemSplitPolygons"], "Item"); |
||
762 | scrMenuMgr->setMenuEnabled("ItemShapes", false); |
||
763 | scrActions["itemGroup"]->setEnabled(false); |
||
764 | scrActions["itemUngroup"]->setEnabled(false); |
||
765 | scrActions["itemAttachTextToPath"]->setEnabled(false); |
||
766 | scrActions["itemDetachTextFromPath"]->setEnabled(false); |
||
767 | scrActions["itemCombinePolygons"]->setEnabled(false); |
||
768 | scrActions["itemSplitPolygons"]->setEnabled(false); |
||
769 | scrActions["itemLock"]->setEnabled(false); |
||
1858 | cbradney | 770 | scrActions["itemLockSize"]->setEnabled(false); |
2026 | cbradney | 771 | scrActions["itemImageIsVisible"]->setEnabled(false); |
1858 | cbradney | 772 | scrMenuMgr->setMenuEnabled("ItemConvertTo", false); |
773 | scrActions["itemConvertToBezierCurve"]->setEnabled(false); |
||
774 | scrActions["itemConvertToImageFrame"]->setEnabled(false); |
||
1236 | cbradney | 775 | scrActions["itemConvertToOutlines"]->setEnabled(false); |
1858 | cbradney | 776 | scrActions["itemConvertToPolygon"]->setEnabled(false); |
777 | scrActions["itemConvertToTextFrame"]->setEnabled(false); |
||
1485 | tsoots | 778 | |
1801 | cbradney | 779 | //Insert menu |
780 | scrMenuMgr->createMenu("Insert", tr("I&nsert")); |
||
781 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTextFrame"], "Insert"); |
||
782 | scrMenuMgr->addMenuItem(scrActions["toolsInsertImageFrame"], "Insert"); |
||
783 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTableFrame"], "Insert"); |
||
784 | scrMenuMgr->addMenuItem(scrActions["toolsInsertShape"], "Insert"); |
||
785 | scrMenuMgr->addMenuItem(scrActions["toolsInsertPolygon"], "Insert"); |
||
786 | scrMenuMgr->addMenuItem(scrActions["toolsInsertLine"], "Insert"); |
||
787 | scrMenuMgr->addMenuItem(scrActions["toolsInsertBezier"], "Insert"); |
||
788 | scrMenuMgr->addMenuItem(scrActions["toolsInsertFreehandLine"], "Insert"); |
||
789 | scrMenuMgr->addMenuSeparator("Insert"); |
||
1903 | cbradney | 790 | scrMenuMgr->addMenuItem(scrActions["insertGlyph"], "Insert"); |
2143 | subik | 791 | |
2226 | cbradney | 792 | scrMenuMgr->createMenu("InsertChar", tr("Character"), "Insert"); |
793 | //scrMenuMgr->addMenuToMenu("InsertChar", "Insert"); |
||
1903 | cbradney | 794 | scrMenuMgr->addMenuItem(scrActions["specialPageNumber"], "InsertChar"); |
795 | scrMenuMgr->addMenuItem(scrActions["specialSmartHyphen"], "InsertChar"); |
||
2407 | fschmid | 796 | scrMenuMgr->addMenuItem(scrActions["specialNonBreakingHyphen"], "InsertChar"); |
2039 | cbradney | 797 | scrMenuMgr->addMenuSeparator("InsertChar"); |
1903 | cbradney | 798 | scrMenuMgr->addMenuItem(scrActions["specialCopyRight"], "InsertChar"); |
799 | scrMenuMgr->addMenuItem(scrActions["specialRegdTM"], "InsertChar"); |
||
800 | scrMenuMgr->addMenuItem(scrActions["specialTM"], "InsertChar"); |
||
801 | scrMenuMgr->addMenuItem(scrActions["specialBullet"], "InsertChar"); |
||
802 | scrMenuMgr->addMenuSeparator("InsertChar"); |
||
803 | scrMenuMgr->addMenuItem(scrActions["specialDashEm"], "InsertChar"); |
||
804 | scrMenuMgr->addMenuItem(scrActions["specialDashEn"], "InsertChar"); |
||
805 | scrMenuMgr->addMenuItem(scrActions["specialDashFigure"], "InsertChar"); |
||
806 | scrMenuMgr->addMenuItem(scrActions["specialDashQuotation"], "InsertChar"); |
||
2143 | subik | 807 | |
2226 | cbradney | 808 | scrMenuMgr->createMenu("InsertQuote", tr("Quote"), "Insert"); |
809 | //scrMenuMgr->addMenuToMenu("InsertQuote", "Insert"); |
||
2039 | cbradney | 810 | scrMenuMgr->addMenuItem(scrActions["specialQuoteApostrophe"], "InsertQuote"); |
811 | scrMenuMgr->addMenuItem(scrActions["specialQuoteStraight"], "InsertQuote"); |
||
812 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
813 | scrMenuMgr->addMenuItem(scrActions["specialQuoteSingleLeft"], "InsertQuote"); |
||
814 | scrMenuMgr->addMenuItem(scrActions["specialQuoteSingleRight"], "InsertQuote"); |
||
815 | scrMenuMgr->addMenuItem(scrActions["specialQuoteDoubleLeft"], "InsertQuote"); |
||
816 | scrMenuMgr->addMenuItem(scrActions["specialQuoteDoubleRight"], "InsertQuote"); |
||
817 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
818 | scrMenuMgr->addMenuItem(scrActions["specialQuoteSingleReversed"], "InsertQuote"); |
||
819 | scrMenuMgr->addMenuItem(scrActions["specialQuoteDoubleReversed"], "InsertQuote"); |
||
820 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
821 | scrMenuMgr->addMenuItem(scrActions["specialQuoteSingleLeftGuillemet"], "InsertQuote"); |
||
822 | scrMenuMgr->addMenuItem(scrActions["specialQuoteSingleRightGuillemet"], "InsertQuote"); |
||
823 | scrMenuMgr->addMenuItem(scrActions["specialQuoteDoubleLeftGuillemet"], "InsertQuote"); |
||
824 | scrMenuMgr->addMenuItem(scrActions["specialQuoteDoubleRightGuillemet"], "InsertQuote"); |
||
825 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
826 | scrMenuMgr->addMenuItem(scrActions["specialQuoteLowSingleComma"], "InsertQuote"); |
||
827 | scrMenuMgr->addMenuItem(scrActions["specialQuoteLowDoubleComma"], "InsertQuote"); |
||
828 | scrMenuMgr->addMenuItem(scrActions["specialQuoteDoubleTurnedComma"], "InsertQuote"); |
||
829 | scrMenuMgr->addMenuSeparator("InsertQuote"); |
||
830 | scrMenuMgr->addMenuItem(scrActions["specialQuoteCJKSingleLeft"], "InsertQuote"); |
||
831 | scrMenuMgr->addMenuItem(scrActions["specialQuoteCJKSingleRight"], "InsertQuote"); |
||
832 | scrMenuMgr->addMenuItem(scrActions["specialQuoteCJKDoubleLeft"], "InsertQuote"); |
||
833 | scrMenuMgr->addMenuItem(scrActions["specialQuoteCJKDoubleRight"], "InsertQuote"); |
||
1903 | cbradney | 834 | |
2226 | cbradney | 835 | scrMenuMgr->createMenu("InsertSpace", tr("Space"), "Insert"); |
836 | //scrMenuMgr->addMenuToMenu("InsertSpace", "Insert"); |
||
1903 | cbradney | 837 | scrMenuMgr->addMenuItem(scrActions["specialNonBreakingSpace"], "InsertSpace"); |
2352 | fschmid | 838 | scrMenuMgr->addMenuItem(scrActions["specialNewLine"], "InsertSpace"); |
839 | scrMenuMgr->addMenuItem(scrActions["specialFrameBreak"], "InsertSpace"); |
||
2384 | fschmid | 840 | scrMenuMgr->addMenuItem(scrActions["specialColumnBreak"], "InsertSpace"); |
1903 | cbradney | 841 | scrMenuMgr->addMenuSeparator("Insert"); |
1818 | cbradney | 842 | scrMenuMgr->addMenuItem(scrActions["insertSampleText"], "Insert"); |
1903 | cbradney | 843 | scrActions["insertGlyph"]->setEnabled(false); |
2143 | subik | 844 | |
1236 | cbradney | 845 | //Page menu |
846 | scrMenuMgr->createMenu("Page", tr("&Page")); |
||
847 | scrMenuMgr->addMenuItem(scrActions["pageInsert"], "Page"); |
||
2143 | subik | 848 | scrMenuMgr->addMenuItem(scrActions["pageImport"], "Page"); |
1236 | cbradney | 849 | scrMenuMgr->addMenuItem(scrActions["pageDelete"], "Page"); |
850 | scrMenuMgr->addMenuItem(scrActions["pageCopy"], "Page"); |
||
851 | scrMenuMgr->addMenuItem(scrActions["pageMove"], "Page"); |
||
2093 | cbradney | 852 | scrMenuMgr->addMenuItem(scrActions["pageApplyMasterPage"], "Page"); |
3187 | fschmid | 853 | scrMenuMgr->addMenuItem(scrActions["pageCopyToMasterPage"], "Page"); |
1236 | cbradney | 854 | scrMenuMgr->addMenuItem(scrActions["pageManageGuides"], "Page"); |
2777 | fschmid | 855 | scrMenuMgr->addMenuItem(scrActions["pageManageMargins"], "Page"); |
3098 | cbradney | 856 | scrMenuMgr->addMenuSeparator("Page"); |
857 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "Page"); |
||
858 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "Page"); |
||
1236 | cbradney | 859 | scrActions["pageDelete"]->setEnabled(false); |
860 | scrActions["pageMove"]->setEnabled(false); |
||
1485 | tsoots | 861 | |
1236 | cbradney | 862 | //View menu |
1246 | cbradney | 863 | scrMenuMgr->createMenu("View", tr("&View")); |
864 | scrMenuMgr->addMenuItem(scrActions["viewFitInWindow"], "View"); |
||
865 | scrMenuMgr->addMenuItem(scrActions["viewFit50"], "View"); |
||
866 | scrMenuMgr->addMenuItem(scrActions["viewFit75"], "View"); |
||
867 | scrMenuMgr->addMenuItem(scrActions["viewFit100"], "View"); |
||
868 | scrMenuMgr->addMenuItem(scrActions["viewFit200"], "View"); |
||
869 | scrMenuMgr->addMenuItem(scrActions["viewFit20"], "View"); |
||
870 | scrMenuMgr->addMenuSeparator("View"); |
||
871 | scrMenuMgr->addMenuItem(scrActions["viewShowMargins"], "View"); |
||
872 | scrMenuMgr->addMenuItem(scrActions["viewShowFrames"], "View"); |
||
873 | scrMenuMgr->addMenuItem(scrActions["viewShowImages"], "View"); |
||
874 | scrMenuMgr->addMenuItem(scrActions["viewShowGrid"], "View"); |
||
875 | scrMenuMgr->addMenuItem(scrActions["viewShowGuides"], "View"); |
||
1334 | cbradney | 876 | scrMenuMgr->addMenuItem(scrActions["viewShowBaseline"], "View"); |
1246 | cbradney | 877 | scrMenuMgr->addMenuItem(scrActions["viewShowTextChain"], "View"); |
2353 | fschmid | 878 | scrMenuMgr->addMenuItem(scrActions["viewShowTextControls"], "View"); |
2863 | fschmid | 879 | scrMenuMgr->addMenuItem(scrActions["viewRulerMode"], "View"); |
3098 | cbradney | 880 | |
881 | //CB If this is viewNewView imeplemented, it should be on the windows menu |
||
1330 | fschmid | 882 | // scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View"); |
1485 | tsoots | 883 | |
1236 | cbradney | 884 | //Tool menu |
3097 | cbradney | 885 | /* |
1255 | cbradney | 886 | scrMenuMgr->createMenu("Tools", tr("&Tools")); |
887 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Tools"); |
||
888 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Tools"); |
||
889 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Tools"); |
||
890 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Tools"); |
||
891 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Tools"); |
||
892 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Tools"); |
||
1525 | cbradney | 893 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Tools"); |
1255 | cbradney | 894 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Tools"); |
895 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Tools"); |
||
2355 | cbradney | 896 | scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Tools"); |
1255 | cbradney | 897 | scrMenuMgr->addMenuSeparator("Tools"); |
898 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Tools"); |
||
1485 | tsoots | 899 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Tools"); |
3097 | cbradney | 900 | //scrActions["toolsPreflightVerifier"]->setEnabled(false);*/ |
1485 | tsoots | 901 | |
1236 | cbradney | 902 | //Extra menu |
1260 | cbradney | 903 | scrMenuMgr->createMenu("Extras", tr("E&xtras")); |
904 | scrMenuMgr->addMenuItem(scrActions["extrasManagePictures"], "Extras"); |
||
905 | scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras"); |
||
2621 | fschmid | 906 | scrMenuMgr->addMenuItem(scrActions["extrasDeHyphenateText"], "Extras"); |
1694 | cbradney | 907 | scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras"); |
2143 | subik | 908 | |
1260 | cbradney | 909 | scrMenuMgr->setMenuEnabled("Extras", false); |
910 | scrActions["extrasHyphenateText"]->setEnabled(false); |
||
2621 | fschmid | 911 | scrActions["extrasDeHyphenateText"]->setEnabled(false); |
1485 | tsoots | 912 | |
1236 | cbradney | 913 | //Window menu |
1260 | cbradney | 914 | scrMenuMgr->createMenu("Windows", tr("&Windows")); |
915 | connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
||
3097 | cbradney | 916 | addDefaultWindowMenuItems(); |
3172 | subik | 917 | |
1260 | cbradney | 918 | //Help menu |
1269 | cbradney | 919 | scrMenuMgr->createMenu("Help", tr("&Help")); |
920 | scrMenuMgr->addMenuItem(scrActions["helpAboutScribus"], "Help"); |
||
3247 | craig | 921 | scrMenuMgr->addMenuItem(scrActions["helpAboutPlugins"], "Help"); |
1269 | cbradney | 922 | scrMenuMgr->addMenuItem(scrActions["helpAboutQt"], "Help"); |
923 | scrMenuMgr->addMenuSeparator("Help"); |
||
924 | scrMenuMgr->addMenuItem(scrActions["helpTooltips"], "Help"); |
||
925 | scrMenuMgr->addMenuItem(scrActions["helpManual"], "Help"); |
||
1485 | tsoots | 926 | |
1208 | cbradney | 927 | scrMenuMgr->addMenuToMenuBar("File"); |
1227 | cbradney | 928 | scrMenuMgr->addMenuToMenuBar("Edit"); |
1325 | cbradney | 929 | scrMenuMgr->addMenuToMenuBar("Style"); |
930 | scrMenuMgr->setMenuEnabled("Style", false); |
||
1236 | cbradney | 931 | scrMenuMgr->addMenuToMenuBar("Item"); |
1801 | cbradney | 932 | scrMenuMgr->setMenuEnabled("Item", false); |
933 | scrMenuMgr->addMenuToMenuBar("Insert"); |
||
934 | scrMenuMgr->setMenuEnabled("Insert", false); |
||
1236 | cbradney | 935 | scrMenuMgr->addMenuToMenuBar("Page"); |
936 | scrMenuMgr->setMenuEnabled("Page", false); |
||
1246 | cbradney | 937 | scrMenuMgr->addMenuToMenuBar("View"); |
938 | scrMenuMgr->setMenuEnabled("View", false); |
||
3097 | cbradney | 939 | //scrMenuMgr->addMenuToMenuBar("Tools"); |
1260 | cbradney | 940 | scrMenuMgr->addMenuToMenuBar("Extras"); |
941 | scrMenuMgr->setMenuEnabled("Extras", false); |
||
942 | scrMenuMgr->addMenuToMenuBar("Windows"); |
||
3097 | cbradney | 943 | //scrMenuMgr->setMenuEnabled("Windows", false); |
3 | paul | 944 | menuBar()->insertSeparator(); |
1269 | cbradney | 945 | scrMenuMgr->addMenuToMenuBar("Help"); |
946 | |||
1236 | cbradney | 947 | //Alignment menu |
1325 | cbradney | 948 | scrMenuMgr->createMenu("Alignment", tr("&Alignment")); |
1337 | cbradney | 949 | scrMenuMgr->addMenuItem(scrActions["alignLeft"], "Alignment"); |
950 | scrMenuMgr->addMenuItem(scrActions["alignCenter"], "Alignment"); |
||
951 | scrMenuMgr->addMenuItem(scrActions["alignRight"], "Alignment"); |
||
952 | scrMenuMgr->addMenuItem(scrActions["alignBlock"], "Alignment"); |
||
953 | scrMenuMgr->addMenuItem(scrActions["alignForced"], "Alignment"); |
||
1443 | tsoots | 954 | |
801 | cbradney | 955 | connect(ColorMenC, SIGNAL(activated(int)), this, SLOT(setItemFarbe(int))); |
956 | connect(FontMenu, SIGNAL(activated(int)), this, SLOT(setItemFont(int))); |
||
3 | paul | 957 | } |
958 | |||
3097 | cbradney | 959 | void ScribusApp::addDefaultWindowMenuItems() |
960 | { |
||
961 | scrMenuMgr->clearMenu("Windows"); |
||
962 | scrMenuMgr->addMenuItem(scrActions["windowsCascade"], "Windows"); |
||
963 | scrMenuMgr->addMenuItem(scrActions["windowsTile"], "Windows"); |
||
964 | scrMenuMgr->addMenuSeparator("Windows"); |
||
965 | |||
966 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Windows"); |
||
967 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Windows"); |
||
968 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Windows"); |
||
969 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Windows"); |
||
970 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Windows"); |
||
971 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Windows"); |
||
972 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Windows"); |
||
973 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Windows"); |
||
974 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Windows"); |
||
975 | scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Windows"); |
||
976 | scrMenuMgr->addMenuSeparator("Windows"); |
||
977 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Windows"); |
||
978 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Windows"); |
||
979 | } |
||
980 | |||
981 | |||
3 | paul | 982 | void ScribusApp::initStatusBar() |
983 | { |
||
2433 | cbradney | 984 | mainWindowStatusLabel = new QLabel( " ", statusBar(), "ft"); |
985 | mainWindowProgressBar = new QProgressBar(statusBar(), "p"); |
||
986 | mainWindowProgressBar->setCenterIndicator(true); |
||
987 | mainWindowProgressBar->setFixedWidth( 100 ); |
||
988 | mainWindowProgressBar->reset(); |
||
989 | mainWindowXPosLabel = new QLabel( "X-Pos:", statusBar(), "xt"); |
||
990 | mainWindowYPosLabel = new QLabel( "Y-Pos:", statusBar(), "yt"); |
||
991 | mainWindowXPosDataLabel = new QLabel( " ", statusBar(), "dt"); |
||
992 | mainWindowYPosDataLabel = new QLabel( " ", statusBar(), "ydt"); |
||
809 | cbradney | 993 | |
2433 | cbradney | 994 | statusBar()->addWidget(mainWindowStatusLabel, 3, true); |
995 | statusBar()->addWidget(mainWindowProgressBar, 0, true); |
||
996 | statusBar()->addWidget(mainWindowXPosLabel, 0, true); |
||
997 | statusBar()->addWidget(mainWindowXPosDataLabel, 1, true); |
||
998 | statusBar()->addWidget(mainWindowYPosLabel, 0, true); |
||
999 | statusBar()->addWidget(mainWindowYPosDataLabel, 1, true); |
||
3 | paul | 1000 | } |
1001 | |||
2150 | cbradney | 1002 | void ScribusApp::setMousePositionOnStatusBar(double xp, double yp) |
3 | paul | 1003 | { |
2867 | fschmid | 1004 | double xn = xp; |
1005 | double yn = yp; |
||
1006 | if (doc->guidesSettings.rulerMode) |
||
1007 | { |
||
3200 | cbradney | 1008 | xn -= doc->currentPage->xOffset(); |
1009 | yn -= doc->currentPage->yOffset(); |
||
2867 | fschmid | 1010 | } |
1011 | xn -= doc->rulerXoffset; |
||
1012 | yn -= doc->rulerYoffset; |
||
2965 | cbradney | 1013 | QString suffix=unitGetSuffixFromIndex(doc->unitIndex()); |
1014 | int multiplier=unitGetDecimalsFromIndex(doc->unitIndex()); |
||
2150 | cbradney | 1015 | double divisor=static_cast<double>(multiplier); |
2965 | cbradney | 1016 | int precision=unitGetPrecisionFromIndex(doc->unitIndex()); |
809 | cbradney | 1017 | QString tmp; |
2965 | cbradney | 1018 | mainWindowXPosDataLabel->setText(tmp.setNum(qRound(xn*doc->unitRatio() * multiplier) / divisor, 'f', precision) + suffix); |
1019 | mainWindowYPosDataLabel->setText(tmp.setNum(qRound(yn*doc->unitRatio() * multiplier) / divisor, 'f', precision) + suffix); |
||
3 | paul | 1020 | } |
1021 | |||
2150 | cbradney | 1022 | void ScribusApp::deleteSelectedTextFromFrame(PageItem *currItem) |
3 | paul | 1023 | { |
2150 | cbradney | 1024 | int firstSelection = 0; |
238 | Franz | 1025 | bool first = false; |
1957 | cbradney | 1026 | for (ScText *it = currItem->itemText.first(); it != 0; it = currItem->itemText.next()) |
272 | Franz | 1027 | { |
1028 | if (it->cselect) |
||
1029 | { |
||
238 | Franz | 1030 | first = true; |
2434 | fschmid | 1031 | if ((it->ch == QChar(25)) && (it->cembedded != 0)) |
2499 | fschmid | 1032 | { |
2447 | fschmid | 1033 | doc->FrameItems.remove(it->cembedded); |
2499 | fschmid | 1034 | delete it->cembedded; |
1035 | } |
||
1957 | cbradney | 1036 | currItem->itemText.remove(); |
1037 | it = currItem->itemText.prev(); |
||
272 | Franz | 1038 | if (it == 0) |
1957 | cbradney | 1039 | it = currItem->itemText.first(); |
272 | Franz | 1040 | } |
238 | Franz | 1041 | if (!first) |
2150 | cbradney | 1042 | firstSelection++; |
272 | Franz | 1043 | } |
1957 | cbradney | 1044 | if (currItem->itemText.count() != 0) |
238 | Franz | 1045 | { |
1957 | cbradney | 1046 | if (currItem->itemText.first()->cselect) |
3 | paul | 1047 | { |
1957 | cbradney | 1048 | currItem->itemText.remove(); |
1049 | currItem->CPos = 0; |
||
238 | Franz | 1050 | } |
3 | paul | 1051 | else |
2150 | cbradney | 1052 | currItem->CPos = firstSelection; |
238 | Franz | 1053 | } |
3 | paul | 1054 | else |
1957 | cbradney | 1055 | currItem->CPos = 0; |
1056 | currItem->HasSel = false; |
||
2447 | fschmid | 1057 | for (uint a = 0; a < doc->FrameItems.count(); ++a) |
2443 | fschmid | 1058 | { |
2447 | fschmid | 1059 | doc->FrameItems.at(a)->ItemNr = a; |
2443 | fschmid | 1060 | } |
272 | Franz | 1061 | DisableTxEdit(); |
3 | paul | 1062 | } |
1063 | |||
1957 | cbradney | 1064 | void ScribusApp::setTBvals(PageItem *currItem) |
3 | paul | 1065 | { |
1957 | cbradney | 1066 | if (currItem->itemText.count() != 0) |
272 | Franz | 1067 | { |
1957 | cbradney | 1068 | int ChPos = QMIN(currItem->CPos, static_cast<int>(currItem->itemText.count()-1)); |
2185 | fschmid | 1069 | doc->CurrentStyle = currItem->itemText.at(ChPos)->cstyle & 1919; |
1957 | cbradney | 1070 | doc->currentParaStyle = currItem->itemText.at(ChPos)->cab; |
1065 | cbradney | 1071 | setAbsValue(doc->currentParaStyle); |
1545 | cbradney | 1072 | propertiesPalette->setAli(doc->currentParaStyle); |
1957 | cbradney | 1073 | doc->CurrFont = currItem->itemText.at(ChPos)->cfont->SCName; |
1074 | doc->CurrFontSize = currItem->itemText.at(ChPos)->csize; |
||
1075 | doc->CurrTextFill = currItem->itemText.at(ChPos)->ccolor; |
||
1076 | doc->CurrTextFillSh = currItem->itemText.at(ChPos)->cshade; |
||
1077 | doc->CurrTextStroke = currItem->itemText.at(ChPos)->cstroke; |
||
1078 | doc->CurrTextStrokeSh = currItem->itemText.at(ChPos)->cshade2; |
||
1079 | doc->CurrTextScale = currItem->itemText.at(ChPos)->cscale; |
||
2230 | fschmid | 1080 | doc->CurrTextScaleV = currItem->itemText.at(ChPos)->cscalev; |
2234 | fschmid | 1081 | doc->CurrTextBase = currItem->itemText.at(ChPos)->cbase; |
2247 | fschmid | 1082 | doc->CurrTextShadowX = currItem->itemText.at(ChPos)->cshadowx; |
1083 | doc->CurrTextShadowY = currItem->itemText.at(ChPos)->cshadowy; |
||
2257 | fschmid | 1084 | doc->CurrTextOutline = currItem->itemText.at(ChPos)->coutline; |
2262 | fschmid | 1085 | doc->CurrTextUnderPos = currItem->itemText.at(ChPos)->cunderpos; |
1086 | doc->CurrTextUnderWidth = currItem->itemText.at(ChPos)->cunderwidth; |
||
2272 | fschmid | 1087 | doc->CurrTextStrikePos = currItem->itemText.at(ChPos)->cstrikepos; |
1088 | doc->CurrTextStrikeWidth = currItem->itemText.at(ChPos)->cstrikewidth; |
||
2262 | fschmid | 1089 | emit TextUnderline(doc->CurrTextUnderPos, doc->CurrTextUnderWidth); |
2272 | fschmid | 1090 | emit TextStrike(doc->CurrTextStrikePos, doc->CurrTextStrikeWidth); |
2247 | fschmid | 1091 | emit TextShadow(doc->CurrTextShadowX, doc->CurrTextShadowY); |
68 | Franz | 1092 | emit TextFarben(doc->CurrTextStroke, doc->CurrTextFill, doc->CurrTextStrokeSh, doc->CurrTextFillSh); |
1093 | emit TextIFont(doc->CurrFont); |
||
272 | Franz | 1094 | emit TextISize(doc->CurrFontSize); |
1957 | cbradney | 1095 | emit TextUSval(currItem->itemText.at(ChPos)->cextra); |
272 | Franz | 1096 | emit TextStil(doc->CurrentStyle); |
68 | Franz | 1097 | emit TextScale(doc->CurrTextScale); |
2230 | fschmid | 1098 | emit TextScaleV(doc->CurrTextScaleV); |
2234 | fschmid | 1099 | emit TextBase(doc->CurrTextBase); |
2257 | fschmid | 1100 | emit TextOutline(doc->CurrTextOutline); |
272 | Franz | 1101 | } |
3 | paul | 1102 | } |
1103 | |||
1104 | void ScribusApp::wheelEvent(QWheelEvent *w) |
||
1105 | { |
||
1106 | if (HaveDoc) |
||
239 | Franz | 1107 | { |
2871 | cbradney | 1108 | int wheelVal=prefsManager->mouseWheelValue(); |
276 | Franz | 1109 | if ((w->orientation() != Qt::Vertical) || ( w->state() & ShiftButton )) |
3 | paul | 1110 | { |
239 | Franz | 1111 | if (w->delta() < 0) |
2871 | cbradney | 1112 | view->scrollBy(wheelVal, 0); |
239 | Franz | 1113 | else |
2871 | cbradney | 1114 | view->scrollBy(-wheelVal, 0); |
239 | Franz | 1115 | } |
3 | paul | 1116 | else |
239 | Franz | 1117 | { |
1118 | if (w->delta() < 0) |
||
2871 | cbradney | 1119 | view->scrollBy(0, wheelVal); |
239 | Franz | 1120 | else |
2871 | cbradney | 1121 | view->scrollBy(0, -wheelVal); |
239 | Franz | 1122 | } |
3 | paul | 1123 | w->accept(); |
239 | Franz | 1124 | } |
3 | paul | 1125 | } |
1126 | |||
1485 | tsoots | 1127 | //Special keys assigned to actions are stolen by the action and not passed to |
1445 | cbradney | 1128 | //keyPressEvent so process them here. |
1903 | cbradney | 1129 | void ScribusApp::specialActionKeyEvent(QString actionName, int unicodevalue) |
1445 | cbradney | 1130 | { |
1131 | if (HaveDoc) |
||
1132 | { |
||
2603 | cbradney | 1133 | if (doc->appMode==modeEdit) |
1445 | cbradney | 1134 | { |
1135 | if (view->SelItem.count() == 1) |
||
1136 | { |
||
1137 | struct ScText *hg = new ScText; |
||
1957 | cbradney | 1138 | PageItem *currItem = view->SelItem.at(0); |
1903 | cbradney | 1139 | if (unicodevalue!=-1) |
1445 | cbradney | 1140 | { |
1903 | cbradney | 1141 | hg->ch = QString(QChar(unicodevalue)); |
3179 | cbradney | 1142 | doc->setScTextDefaultsFromDoc(hg); |
1445 | cbradney | 1143 | hg->cselect = false; |
1144 | hg->cextra = 0; |
||
1145 | hg->xp = 0; |
||
1146 | hg->yp = 0; |
||
1147 | hg->PRot = 0; |
||
1148 | hg->PtransX = 0; |
||
1149 | hg->PtransY = 0; |
||
2434 | fschmid | 1150 | hg->cembedded = 0; |
1957 | cbradney | 1151 | currItem->itemText.insert(currItem->CPos, hg); |
1152 | currItem->CPos += 1; |
||
1153 | currItem->Tinput = true; |
||
1154 | view->RefreshItem(currItem); |
||
1445 | cbradney | 1155 | } |
1903 | cbradney | 1156 | else if (actionName=="specialSmartHyphen") //ignore the char as we use an attribute if the text item, for now. |
1445 | cbradney | 1157 | { |
1957 | cbradney | 1158 | currItem->itemText.at(QMAX(currItem->CPos-1,0))->cstyle ^= 128; |
1159 | currItem->Tinput = true; |
||
1160 | view->RefreshItem(currItem); |
||
1485 | tsoots | 1161 | } |
1445 | cbradney | 1162 | } |
1163 | } |
||
1164 | } |
||
1165 | } |
||
1166 | |||
1493 | cbradney | 1167 | /*! |
1168 | \brief Receive key events from palettes such as palette hiding events. Possibly eaier way but this is cleaner than before. No need to modify all those palettes and each new one in future. |
||
1169 | */ |
||
1525 | cbradney | 1170 | bool ScribusApp::eventFilter( QObject */*o*/, QEvent *e ) |
1493 | cbradney | 1171 | { |
1525 | cbradney | 1172 | bool retVal; |
1493 | cbradney | 1173 | if ( e->type() == QEvent::KeyPress ) { |
1174 | QKeyEvent *k = (QKeyEvent *)e; |
||
2357 | cbradney | 1175 | int keyMod=0; |
1176 | if (k->state() & ShiftButton) |
||
1177 | keyMod |= SHIFT; |
||
1178 | if (k->state() & ControlButton) |
||
1179 | keyMod |= CTRL; |
||
1180 | if (k->state() & AltButton) |
||
1181 | keyMod |= ALT; |
||
2369 | cbradney | 1182 | |
1493 | cbradney | 1183 | QKeySequence currKeySeq = QKeySequence(k->key() | keyMod); |
2878 | cbradney | 1184 | if (QString(currKeySeq).isNull()) |
2681 | cbradney | 1185 | return false; |
1525 | cbradney | 1186 | retVal=true; |
2357 | cbradney | 1187 | //Palette actions |
1493 | cbradney | 1188 | if (currKeySeq == scrActions["specialToggleAllPalettes"]->accel()) |
1189 | scrActions["specialToggleAllPalettes"]->activate(); |
||
1190 | else |
||
1191 | if (currKeySeq == scrActions["toolsProperties"]->accel()) |
||
1192 | scrActions["toolsProperties"]->toggle(); |
||
1193 | else |
||
1194 | if (currKeySeq == scrActions["toolsOutline"]->accel()) |
||
1195 | scrActions["toolsOutline"]->toggle(); |
||
1196 | else |
||
1197 | if (currKeySeq == scrActions["toolsScrapbook"]->accel()) |
||
1198 | scrActions["toolsScrapbook"]->toggle(); |
||
1199 | else |
||
1200 | if (currKeySeq == scrActions["toolsLayers"]->accel()) |
||
1201 | scrActions["toolsLayers"]->toggle(); |
||
1202 | else |
||
1203 | if (currKeySeq == scrActions["toolsPages"]->accel()) |
||
1204 | scrActions["toolsPages"]->toggle(); |
||
1205 | else |
||
1206 | if (currKeySeq == scrActions["toolsBookmarks"]->accel()) |
||
1207 | scrActions["toolsBookmarks"]->toggle(); |
||
1208 | else |
||
1209 | if (currKeySeq == scrActions["toolsActionHistory"]->accel()) |
||
1210 | scrActions["toolsActionHistory"]->toggle(); |
||
1211 | else |
||
1212 | if (currKeySeq == scrActions["toolsPreflightVerifier"]->accel()) |
||
1213 | scrActions["toolsPreflightVerifier"]->toggle(); |
||
1525 | cbradney | 1214 | else |
2355 | cbradney | 1215 | if (currKeySeq == scrActions["toolsAlignDistribute"]->accel()) |
1216 | scrActions["toolsAlignDistribute"]->toggle(); |
||
1217 | else |
||
2357 | cbradney | 1218 | //Undo actions |
1219 | if (currKeySeq == scrActions["editUndoAction"]->accel() && scrActions["editUndoAction"]->isEnabled()) |
||
1220 | scrActions["editUndoAction"]->activate(); |
||
1221 | else |
||
1222 | if (currKeySeq == scrActions["editRedoAction"]->accel() && scrActions["editRedoAction"]->isEnabled()) |
||
1223 | scrActions["editRedoAction"]->activate(); |
||
1224 | else |
||
1225 | //Other actions |
||
1565 | cbradney | 1226 | if (currKeySeq == scrActions["fileQuit"]->accel()) |
1227 | scrActions["fileQuit"]->activate(); |
||
2143 | subik | 1228 | else |
1525 | cbradney | 1229 | retVal=false; |
1493 | cbradney | 1230 | } |
1525 | cbradney | 1231 | else |
1232 | retVal=false; |
||
1493 | cbradney | 1233 | //Return false to pass event to object |
1234 | return retVal; |
||
1235 | } |
||
1236 | |||
3 | paul | 1237 | void ScribusApp::keyPressEvent(QKeyEvent *k) |
1238 | { |
||
146 | Franz | 1239 | QWidgetList windows; |
237 | Franz | 1240 | QWidget* w = NULL; |
1065 | cbradney | 1241 | struct ScText *hg; |
3 | paul | 1242 | int kk = k->key(); |
1243 | int as = k->ascii(); |
||
80 | Franz | 1244 | double altx, alty; |
3 | paul | 1245 | QString uc = k->text(); |
1246 | QString cr, Tcha, Twort; |
||
1247 | uint Tcoun; |
||
237 | Franz | 1248 | int len, pos, c; |
92 | Franz | 1249 | if (keyrep) |
1250 | return; |
||
1251 | keyrep = true; |
||
3 | paul | 1252 | switch (k->state()) |
272 | Franz | 1253 | { |
1254 | case ShiftButton: |
||
1554 | cbradney | 1255 | KeyMod = SHIFT; |
272 | Franz | 1256 | break; |
1257 | case AltButton: |
||
1554 | cbradney | 1258 | KeyMod = ALT; |
272 | Franz | 1259 | break; |
1260 | case ControlButton: |
||
1554 | cbradney | 1261 | KeyMod = CTRL; |
272 | Franz | 1262 | break; |
1263 | default: |
||
1264 | KeyMod = 0; |
||
1265 | break; |
||
1266 | } |
||
292 | Franz | 1267 | if ((kk == Key_Escape) && (HaveDoc)) |
1268 | { |
||
1269 | keyrep = false; |
||
1957 | cbradney | 1270 | PageItem *currItem; |
855 | fschmid | 1271 | if ((view->SelItem.count() != 0)) |
1272 | { |
||
1957 | cbradney | 1273 | currItem = view->SelItem.at(0); |
1065 | cbradney | 1274 | switch (doc->appMode) |
855 | fschmid | 1275 | { |
2603 | cbradney | 1276 | case modeNormal: |
1957 | cbradney | 1277 | currItem->Sizing = false; |
855 | fschmid | 1278 | if (doc->SubMode != -1) |
1279 | { |
||
1280 | view->Deselect(false); |
||
1957 | cbradney | 1281 | doc->Items.remove(currItem->ItemNr); |
855 | fschmid | 1282 | } |
1283 | break; |
||
2603 | cbradney | 1284 | case modeLinkFrames: |
1285 | case modeUnlinkFrames: |
||
1286 | case modeEdit: |
||
1287 | case modeRotation: |
||
1827 | fschmid | 1288 | view->Deselect(false); |
2603 | cbradney | 1289 | case modePanning: |
855 | fschmid | 1290 | break; |
2603 | cbradney | 1291 | case modeDrawBezierLine: |
1957 | cbradney | 1292 | currItem->PoLine.resize(currItem->PoLine.size()-2); |
1293 | if (currItem->PoLine.size() < 4) |
||
855 | fschmid | 1294 | { |
1295 | view->Deselect(false); |
||
1957 | cbradney | 1296 | doc->Items.remove(currItem->ItemNr); |
855 | fschmid | 1297 | } |
1298 | else |
||
1299 | { |
||
1957 | cbradney | 1300 | view->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false); |
1301 | view->SetPolyClip(currItem, qRound(QMAX(currItem->Pwidth / 2, 1))); |
||
1302 | view->AdjustItemSize(currItem); |
||
1303 | currItem->ContourLine = currItem->PoLine.copy(); |
||
1304 | currItem->ClipEdited = true; |
||
1305 | currItem->FrameType = 3; |
||
855 | fschmid | 1306 | slotDocCh(); |
1307 | } |
||
1308 | view->FirstPoly = true; |
||
1309 | break; |
||
1310 | default: |
||
1311 | view->Deselect(false); |
||
1957 | cbradney | 1312 | doc->Items.remove(currItem->ItemNr); |
855 | fschmid | 1313 | break; |
1314 | } |
||
1315 | } |
||
1316 | view->Mpressed = false; |
||
1317 | doc->DragP = false; |
||
1318 | doc->leaveDrag = false; |
||
1319 | view->Imoved = false; |
||
1320 | view->mCG = false; |
||
1321 | view->MidButt = false; |
||
1322 | doc->SubMode = -1; |
||
1827 | fschmid | 1323 | doc->ElemToLink = NULL; |
292 | Franz | 1324 | NoFrameEdit(); |
1325 | slotSelect(); |
||
1326 | return; |
||
1327 | } |
||
232 | Franz | 1328 | ButtonState buttonState = k->state(); |
3053 | avox | 1329 | if ((HaveDoc) && (!view->LE->hasFocus()) && (!view->PGS->focused())) |
272 | Franz | 1330 | { |
2603 | cbradney | 1331 | if ((doc->appMode != modeEdit) && (view->SelItem.count() == 0)) |
272 | Franz | 1332 | { |
1333 | switch (kk) |
||
146 | Franz | 1334 | { |
272 | Franz | 1335 | case Key_Space: |
1336 | keyrep = false; |
||
2603 | cbradney | 1337 | if (doc->appMode == modePanning) |
1338 | setAppMode(modeNormal); |
||
272 | Franz | 1339 | else |
1340 | { |
||
2603 | cbradney | 1341 | setAppMode(modePanning); |
272 | Franz | 1342 | qApp->setOverrideCursor(QCursor(loadIcon("HandC.xpm")), true); |
1343 | } |
||
1344 | return; |
||
1345 | break; |
||
1346 | case Key_Prior: |
||
2871 | cbradney | 1347 | view->scrollBy(0, -prefsManager->mouseWheelValue()); |
272 | Franz | 1348 | keyrep = false; |
1349 | return; |
||
1350 | break; |
||
1351 | case Key_Next: |
||
2871 | cbradney | 1352 | view->scrollBy(0, prefsManager->mouseWheelValue()); |
272 | Franz | 1353 | keyrep = false; |
1354 | return; |
||
1355 | break; |
||
1356 | case Key_Tab: |
||
1357 | keyrep = false; |
||
1358 | windows = wsp->windowList(); |
||
1359 | if (windows.count() > 1) |
||
1360 | { |
||
1361 | for (int i = 0; i < static_cast<int>(windows.count()); ++i) |
||
250 | Franz | 1362 | { |
272 | Franz | 1363 | if (wsp->activeWindow() == windows.at(i)) |
1364 | { |
||
1365 | if (i == static_cast<int>(windows.count()-1)) |
||
1366 | w = windows.at(0); |
||
1367 | else |
||
1368 | w = windows.at(i+1); |
||
1369 | break; |
||
1370 | } |
||
250 | Franz | 1371 | } |
1545 | cbradney | 1372 | doc->OpenNodes = outlinePalette->buildReopenVals(); |
1373 | docCheckerPalette->clearErrorList(); |
||
272 | Franz | 1374 | if ( w ) |
1375 | w->showNormal(); |
||
1376 | newActWin(w); |
||
1377 | } |
||
1378 | return; |
||
1379 | break; |
||
1380 | } |
||
1381 | } |
||
456 | fschmid | 1382 | if (view->SelItem.count() != 0) |
272 | Franz | 1383 | { |
1957 | cbradney | 1384 | PageItem *currItem = view->SelItem.at(0); |
1065 | cbradney | 1385 | switch (doc->appMode) |
272 | Franz | 1386 | { |
2603 | cbradney | 1387 | case modeNormal: |
272 | Franz | 1388 | switch (kk) |
1389 | { |
||
360 | Franz | 1390 | case Key_Backspace: |
272 | Franz | 1391 | case Key_Delete: |
1392 | if (!doc->EditClip) |
||
2148 | fschmid | 1393 | { |
997 | fschmid | 1394 | view->DeleteItem(); |
2148 | fschmid | 1395 | slotDocCh(); |
1396 | } |
||
272 | Franz | 1397 | break; |
360 | Franz | 1398 | case Key_Prior: |
1957 | cbradney | 1399 | if (!currItem->locked()) |
2148 | fschmid | 1400 | { |
456 | fschmid | 1401 | view->RaiseItem(); |
2148 | fschmid | 1402 | slotDocCh(); |
1403 | } |
||
360 | Franz | 1404 | break; |
1405 | case Key_Next: |
||
1957 | cbradney | 1406 | if (!currItem->locked()) |
2148 | fschmid | 1407 | { |
456 | fschmid | 1408 | view->LowerItem(); |
2148 | fschmid | 1409 | slotDocCh(); |
1410 | } |
||
360 | Franz | 1411 | break; |
272 | Franz | 1412 | case Key_Left: |
1957 | cbradney | 1413 | if (!currItem->locked()) |
272 | Franz | 1414 | { |
2664 | fschmid | 1415 | if ((doc->EditClip) && (view->ClRe != -1)) |
1416 | { |
||
1417 | FPoint np; |
||
1418 | if (view->EditContour) |
||
1419 | np = currItem->ContourLine.point(view->ClRe); |
||
1420 | else |
||
1421 | np = currItem->PoLine.point(view->ClRe); |
||
1422 | if ( buttonState & ShiftButton ) |
||
1423 | np = np - FPoint(10.0, 0); |
||
1424 | else if ( buttonState & ControlButton ) |
||
1425 | np = np - FPoint(0.1, 0); |
||
1426 | else |
||
1427 | np = np - FPoint(1.0, 0); |
||
1428 | view->MoveClipPoint(currItem, np); |
||
1429 | } |
||
272 | Franz | 1430 | else |
2664 | fschmid | 1431 | { |
1432 | if ( buttonState & ShiftButton ) |
||
1433 | view->moveGroup(-10, 0); |
||
1434 | else if ( buttonState & ControlButton ) |
||
1435 | view->moveGroup(-0.1, 0); |
||
1436 | else |
||
1437 | view->moveGroup(-1, 0); |
||
1438 | } |
||
2148 | fschmid | 1439 | slotDocCh(); |
272 | Franz | 1440 | } |
1441 | break; |
||
1442 | case Key_Right: |
||
1957 | cbradney | 1443 | if (!currItem->locked()) |
272 | Franz | 1444 | { |
2664 | fschmid | 1445 | if ((doc->EditClip) && (view->ClRe != -1)) |
1446 | { |
||
1447 | FPoint np; |
||
1448 | if (view->EditContour) |
||
1449 | np = currItem->ContourLine.point(view->ClRe); |
||
1450 | else |
||
1451 | np = currItem->PoLine.point(view->ClRe); |
||
1452 | if ( buttonState & ShiftButton ) |
||
1453 | np = np + FPoint(10.0, 0); |
||
1454 | else if ( buttonState & ControlButton ) |
||
1455 | np = np + FPoint(0.1, 0); |
||
1456 | else |
||
1457 | np = np + FPoint(1.0, 0); |
||
1458 | view->MoveClipPoint(currItem, np); |
||
1459 | } |
||
272 | Franz | 1460 | else |
2664 | fschmid | 1461 | { |
1462 | if ( buttonState & ShiftButton ) |
||
1463 | view->moveGroup(10, 0); |
||
1464 | else if ( buttonState & ControlButton ) |
||
1465 | view->moveGroup(0.1, 0); |
||
1466 | else |
||
1467 | view->moveGroup(1, 0); |
||
1468 | } |
||
2148 | fschmid | 1469 | slotDocCh(); |
272 | Franz | 1470 | } |
1471 | break; |
||
1472 | case Key_Up: |
||
1957 | cbradney | 1473 | if (!currItem->locked()) |
272 | Franz | 1474 | { |
2664 | fschmid | 1475 | if ((doc->EditClip) && (view->ClRe != -1)) |
1476 | { |
||
1477 | FPoint np; |
||
1478 | if (view->EditContour) |
||
1479 | np = currItem->ContourLine.point(view->ClRe); |
||
1480 | else |
||
1481 | np = currItem->PoLine.point(view->ClRe); |
||
1482 | if ( buttonState & ShiftButton ) |
||
1483 | np = np - FPoint(0, 10.0); |
||
1484 | else if ( buttonState & ControlButton ) |
||
1485 | np = np - FPoint(0, 0.1); |
||
1486 | else |
||
1487 | np = np - FPoint(0, 1.0); |
||
1488 | view->MoveClipPoint(currItem, np); |
||
1489 | } |
||
272 | Franz | 1490 | else |
2664 | fschmid | 1491 | { |
1492 | if ( buttonState & ShiftButton ) |
||
1493 | view->moveGroup(0, -10); |
||
1494 | else if ( buttonState & ControlButton ) |
||
1495 | view->moveGroup(0, -0.1); |
||
1496 | else |
||
1497 | view->moveGroup(0, -1); |
||
1498 | } |
||
2148 | fschmid | 1499 | slotDocCh(); |
272 | Franz | 1500 | } |
1501 | break; |
||
1502 | case Key_Down: |
||
1957 | cbradney | 1503 | if (!currItem->locked()) |
272 | Franz | 1504 | { |
2664 | fschmid | 1505 | if ((doc->EditClip) && (view->ClRe != -1)) |
1506 | { |
||
1507 | FPoint np; |
||
1508 | if (view->EditContour) |
||
1509 | np = currItem->ContourLine.point(view->ClRe); |
||
1510 | else |
||
1511 | np = currItem->PoLine.point(view->ClRe); |
||
1512 | if ( buttonState & ShiftButton ) |
||
1513 | np = np + FPoint(0, 10.0); |
||
1514 | else if ( buttonState & ControlButton ) |
||
1515 | np = np + FPoint(0, 0.1); |
||
1516 | else |
||
1517 | np = np + FPoint(0, 1.0); |
||
1518 | view->MoveClipPoint(currItem, np); |
||
1519 | } |
||
272 | Franz | 1520 | else |
2664 | fschmid | 1521 | { |
1522 | if ( buttonState & ShiftButton ) |
||
1523 | view->moveGroup(0, 10); |
||
1524 | else if ( buttonState & ControlButton ) |
||
1525 | view->moveGroup(0, 0.1); |
||
1526 | else |
||
1527 | view->moveGroup(0, 1); |
||
1528 | } |
||
2148 | fschmid | 1529 | slotDocCh(); |
272 | Franz | 1530 | } |
1531 | break; |
||
1532 | default: |
||
1533 | break; |
||
1534 | } |
||
1535 | break; |
||
2603 | cbradney | 1536 | case modeEdit: |
1957 | cbradney | 1537 | int oldPos = currItem->CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key |
1538 | view->oldCp = currItem->CPos; |
||
1539 | if (currItem->itemType() == PageItem::ImageFrame) |
||
1298 | fschmid | 1540 | { |
1541 | switch (kk) |
||
1542 | { |
||
1543 | case Key_Left: |
||
1957 | cbradney | 1544 | if (!currItem->locked()) |
1298 | fschmid | 1545 | { |
1546 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1547 | view->MoveItemI(-10, 0, currItem->ItemNr, true); |
1298 | fschmid | 1548 | else if ( buttonState & ControlButton ) |
1957 | cbradney | 1549 | view->MoveItemI(-0.1, 0, currItem->ItemNr, true); |
1298 | fschmid | 1550 | else |
1957 | cbradney | 1551 | view->MoveItemI(-1, 0, currItem->ItemNr, true); |
1298 | fschmid | 1552 | } |
1553 | break; |
||
1554 | case Key_Right: |
||
1957 | cbradney | 1555 | if (!currItem->locked()) |
1298 | fschmid | 1556 | { |
1557 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1558 | view->MoveItemI(10, 0, currItem->ItemNr, true); |
1298 | fschmid | 1559 | else if ( buttonState & ControlButton ) |
1957 | cbradney | 1560 | view->MoveItemI(0.1, 0, currItem->ItemNr, true); |
1298 | fschmid | 1561 | else |
1957 | cbradney | 1562 | view->MoveItemI(1, 0, currItem->ItemNr, true); |
1298 | fschmid | 1563 | } |
1564 | break; |
||
1565 | case Key_Up: |
||
1957 | cbradney | 1566 | if (!currItem->locked()) |
1298 | fschmid | 1567 | { |
1568 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1569 | view->MoveItemI(0, -10, currItem->ItemNr, true); |
1298 | fschmid | 1570 | else if ( buttonState & ControlButton ) |
1957 | cbradney | 1571 | view->MoveItemI(0, -0.1, currItem->ItemNr, true); |
1298 | fschmid | 1572 | else |
1957 | cbradney | 1573 | view->MoveItemI(0, -1, currItem->ItemNr, true); |
1298 | fschmid | 1574 | } |
1575 | break; |
||
1576 | case Key_Down: |
||
1957 | cbradney | 1577 | if (!currItem->locked()) |
1298 | fschmid | 1578 | { |
1579 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1580 | view->MoveItemI(0, 10, currItem->ItemNr, true); |
1298 | fschmid | 1581 | else if ( buttonState & ControlButton ) |
1957 | cbradney | 1582 | view->MoveItemI(0, 0.1, currItem->ItemNr, true); |
1298 | fschmid | 1583 | else |
1957 | cbradney | 1584 | view->MoveItemI(0, 1, currItem->ItemNr, true); |
1298 | fschmid | 1585 | } |
1586 | break; |
||
1587 | } |
||
1588 | } |
||
1957 | cbradney | 1589 | if (currItem->itemType() == PageItem::TextFrame) |
272 | Franz | 1590 | { |
456 | fschmid | 1591 | view->slotDoCurs(false); |
272 | Franz | 1592 | switch (kk) |
1593 | { |
||
1594 | case Key_Prior: |
||
1595 | case Key_Next: |
||
1596 | case Key_End: |
||
1597 | case Key_Home: |
||
1598 | case Key_Right: |
||
1599 | case Key_Left: |
||
1600 | case Key_Up: |
||
1601 | case Key_Down: |
||
1602 | if ( (buttonState & ShiftButton) == 0 ) |
||
1957 | cbradney | 1603 | view->deselectAll(currItem); |
272 | Franz | 1604 | } |
1903 | cbradney | 1605 | /* ISO 14755 |
1606 | if ((buttonState & ControlButton) && (buttonState & ShiftButton)) |
||
1607 | { |
||
3034 | cbradney | 1608 | if (!unicodeTextEditMode) |
1903 | cbradney | 1609 | { |
3034 | cbradney | 1610 | unicodeTextEditMode=true; |
1611 | unicodeInputCount = 0; |
||
1612 | unicodeInputString = ""; |
||
1903 | cbradney | 1613 | keyrep = false; |
1614 | } |
||
1615 | qDebug(QString("%1 %2 %3 %4 %5").arg("uni").arg("c+s").arg(uc).arg(kk).arg(as)); |
||
1616 | } |
||
1617 | */ |
||
3034 | cbradney | 1618 | if (unicodeTextEditMode) |
272 | Franz | 1619 | { |
1620 | int conv = 0; |
||
1621 | bool ok = false; |
||
3034 | cbradney | 1622 | unicodeInputString += uc; |
1623 | conv = unicodeInputString.toInt(&ok, 16); |
||
272 | Franz | 1624 | if (!ok) |
1625 | { |
||
3034 | cbradney | 1626 | unicodeTextEditMode = false; |
1627 | unicodeInputCount = 0; |
||
1628 | unicodeInputString = ""; |
||
272 | Franz | 1629 | keyrep = false; |
1630 | return; |
||
1631 | } |
||
3034 | cbradney | 1632 | unicodeInputCount++; |
1633 | if (unicodeInputCount == 4) |
||
272 | Franz | 1634 | { |
3034 | cbradney | 1635 | unicodeTextEditMode = false; |
1636 | unicodeInputCount = 0; |
||
1637 | unicodeInputString = ""; |
||
272 | Franz | 1638 | if (ok) |
146 | Franz | 1639 | { |
1957 | cbradney | 1640 | if (currItem->HasSel) |
2150 | cbradney | 1641 | deleteSelectedTextFromFrame(currItem); |
272 | Franz | 1642 | if (conv < 31) |
1643 | conv = 32; |
||
1065 | cbradney | 1644 | hg = new ScText; |
272 | Franz | 1645 | hg->ch = QString(QChar(conv)); |
3179 | cbradney | 1646 | doc->setScTextDefaultsFromDoc(hg); |
272 | Franz | 1647 | hg->cselect = false; |
1648 | hg->cextra = 0; |
||
1649 | hg->xp = 0; |
||
1650 | hg->yp = 0; |
||
1651 | hg->PRot = 0; |
||
1652 | hg->PtransX = 0; |
||
1653 | hg->PtransY = 0; |
||
2434 | fschmid | 1654 | hg->cembedded = 0; |
1957 | cbradney | 1655 | currItem->itemText.insert(currItem->CPos, hg); |
1656 | currItem->CPos += 1; |
||
1657 | currItem->Tinput = true; |
||
1658 | setTBvals(currItem); |
||
1659 | view->RefreshItem(currItem); |
||
272 | Franz | 1660 | keyrep = false; |
1661 | return; |
||
146 | Franz | 1662 | } |
1663 | } |
||
272 | Franz | 1664 | else |
1665 | { |
||
1666 | keyrep = false; |
||
1667 | return; |
||
1668 | } |
||
1669 | } |
||
1670 | switch (kk) |
||
1671 | { |
||
1672 | case Key_F12: |
||
3034 | cbradney | 1673 | unicodeTextEditMode = true; |
1674 | unicodeInputCount = 0; |
||
1675 | unicodeInputString = ""; |
||
272 | Franz | 1676 | keyrep = false; |
1677 | return; |
||
1678 | break; |
||
291 | Franz | 1679 | case Key_Home: |
272 | Franz | 1680 | // go to begin of line |
1957 | cbradney | 1681 | if ( (pos = currItem->CPos) == 0 ) |
272 | Franz | 1682 | break; // at begin of frame |
1957 | cbradney | 1683 | len = static_cast<int>(currItem->itemText.count()); |
272 | Franz | 1684 | if ( pos == len ) |
1685 | pos--; |
||
1686 | if ( (buttonState & ControlButton) == 0 ) |
||
1687 | { |
||
1957 | cbradney | 1688 | alty = currItem->itemText.at(pos)->yp; |
1689 | c = currItem->itemText.at(pos)->ch.at(0).latin1(); |
||
272 | Franz | 1690 | if ( c == 13 ) // new line, position is wrong |
1691 | if ( --pos > 0 ) |
||
1957 | cbradney | 1692 | alty = currItem->itemText.at(pos)->yp; |
272 | Franz | 1693 | // check for yp at actual position |
1694 | if ( pos < len ) |
||
1695 | { |
||
1957 | cbradney | 1696 | altx = currItem->itemText.at(pos)->yp; |
272 | Franz | 1697 | if ( altx > alty ) |
3 | paul | 1698 | { |
272 | Franz | 1699 | // we was at begin of line |
1700 | break; |
||
3 | paul | 1701 | } |
272 | Franz | 1702 | } |
1957 | cbradney | 1703 | while ( pos > 0 && currItem->itemText.at(pos-1)->yp == alty ) |
3034 | cbradney | 1704 | --pos; |
1957 | cbradney | 1705 | if ( currItem->itemText.at(pos)->ch.at(0).latin1() == 13 ) |
3034 | cbradney | 1706 | ++pos; |
272 | Franz | 1707 | } |
1708 | else |
||
1709 | { |
||
1710 | // paragraph begin |
||
1711 | if ( pos < len && |
||
1957 | cbradney | 1712 | currItem->itemText.at(pos)->ch.at(0).latin1() == 13 ) |
3034 | cbradney | 1713 | --pos; |
272 | Franz | 1714 | while(pos > 0 ) |
1957 | cbradney | 1715 | if ( currItem->itemText.at(pos)->ch.at(0).latin1() == 13 ) |
3 | paul | 1716 | { |
3034 | cbradney | 1717 | ++pos; |
272 | Franz | 1718 | break; |
3 | paul | 1719 | } |
272 | Franz | 1720 | else |
3034 | cbradney | 1721 | --pos; |
272 | Franz | 1722 | } |
1957 | cbradney | 1723 | currItem->CPos = pos; |
272 | Franz | 1724 | if ( buttonState & ShiftButton ) |
1957 | cbradney | 1725 | view->ExpandSel(currItem, -1, oldPos); |
272 | Franz | 1726 | break; |
291 | Franz | 1727 | case Key_End: |
272 | Franz | 1728 | // go to end of line |
1957 | cbradney | 1729 | len = static_cast<int>(currItem->itemText.count()); |
1730 | if ( currItem->CPos >= len ) |
||
272 | Franz | 1731 | break; // at end of frame |
1732 | if ( (buttonState & ControlButton) == 0 ) |
||
1733 | { |
||
1957 | cbradney | 1734 | if ((currItem->CPos < len) && ((currItem->itemText.at(currItem->CPos)->ch.at(0).latin1() == 13) || (currItem->itemText.at(currItem->CPos)->ch.at(0).latin1() == 28))) |
239 | Franz | 1735 | { |
272 | Franz | 1736 | // at end of paragraph and therefore line |
1737 | break; |
||
239 | Franz | 1738 | } |
1957 | cbradney | 1739 | QString nextCh = currItem->itemText.at(currItem->CPos)->ch; |
1740 | int nextChs = currItem->itemText.at(currItem->CPos)->csize; |
||
1741 | alty = currItem->itemText.at(currItem->CPos)->yp - currItem->SetZeichAttr(currItem->itemText.at(currItem->CPos), &nextChs, &nextCh); |
||
1827 | fschmid | 1742 | double nextY; |
1957 | cbradney | 1743 | while (currItem->CPos < len-1) |
1827 | fschmid | 1744 | { |
1957 | cbradney | 1745 | nextCh = currItem->itemText.at(currItem->CPos+1)->ch; |
1746 | nextChs = currItem->itemText.at(currItem->CPos+1)->csize; |
||
1747 | nextY = currItem->itemText.at(currItem->CPos+1)->yp - currItem->SetZeichAttr(currItem->itemText.at(currItem->CPos+1), &nextChs, &nextCh); |
||
1827 | fschmid | 1748 | if (fabs(nextY - alty) > 1.0) |
1749 | break; |
||
1957 | cbradney | 1750 | currItem->CPos++; |
1751 | if ( currItem->CPos == len-1) |
||
1827 | fschmid | 1752 | break; |
1753 | } |
||
1957 | cbradney | 1754 | if ( currItem->CPos < len -1 ) |
1755 | c = currItem->itemText.at(currItem->CPos+1)->ch.at(0).latin1(); |
||
1756 | else if ( currItem->CPos == len - 1 ) |
||
272 | Franz | 1757 | c = 13; |
1758 | else |
||
1759 | c = 0; |
||
1109 | fschmid | 1760 | if (( c == 13 ) || (c = 28)) |
1957 | cbradney | 1761 | currItem->CPos++; |
272 | Franz | 1762 | } |
1763 | else |
||
1764 | { |
||
1765 | // go to end of paragraph |
||
1957 | cbradney | 1766 | if ( currItem->itemText.at(currItem->CPos)->ch.at(0).latin1() == 13 ) |
239 | Franz | 1767 | { |
272 | Franz | 1768 | break; |
239 | Franz | 1769 | } |
1957 | cbradney | 1770 | pos = currItem->CPos; |
272 | Franz | 1771 | while ( pos < len ) |
239 | Franz | 1772 | { |
1957 | cbradney | 1773 | if ( currItem->itemText.at(pos)->ch.at(0).latin1() == 13 ) |
272 | Franz | 1774 | break; |
239 | Franz | 1775 | else |
3034 | cbradney | 1776 | ++pos; |
239 | Franz | 1777 | } |
1957 | cbradney | 1778 | currItem->CPos = pos; |
272 | Franz | 1779 | } |
1780 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1781 | view->ExpandSel(currItem, 1, oldPos); |
272 | Franz | 1782 | break; |
1783 | case Key_Down: |
||
1957 | cbradney | 1784 | if (currItem->CPos != static_cast<int>(currItem->itemText.count())) |
272 | Franz | 1785 | { |
1957 | cbradney | 1786 | alty = currItem->itemText.at(currItem->CPos)->yp; |
1787 | altx = currItem->itemText.at(currItem->CPos)->xp; |
||
272 | Franz | 1788 | do |
1789 | { |
||
1957 | cbradney | 1790 | currItem->CPos += 1; |
1791 | if (currItem->CPos == static_cast<int>(currItem->itemText.count())) |
||
272 | Franz | 1792 | break; |
1957 | cbradney | 1793 | if (currItem->itemText.at(currItem->CPos)->yp > alty) |
3 | paul | 1794 | { |
1957 | cbradney | 1795 | if (currItem->itemText.at(currItem->CPos)->xp >= altx) |
272 | Franz | 1796 | break; |
3 | paul | 1797 | } |
239 | Franz | 1798 | } |
1957 | cbradney | 1799 | while (currItem->CPos < static_cast<int>(currItem->itemText.count())); |
272 | Franz | 1800 | if ( buttonState & ShiftButton ) |
237 | Franz | 1801 | { |
272 | Franz | 1802 | if ( buttonState & AltButton ) |
1957 | cbradney | 1803 | currItem->CPos = currItem->itemText.count(); |
1804 | view->ExpandSel(currItem, 1, oldPos); |
||
237 | Franz | 1805 | } |
272 | Franz | 1806 | else |
1957 | cbradney | 1807 | if (currItem->CPos == static_cast<int>(currItem->itemText.count())) |
1808 | if (currItem->NextBox != 0) |
||
253 | Franz | 1809 | { |
1957 | cbradney | 1810 | if (currItem->NextBox->itemText.count() != 0) |
253 | Franz | 1811 | { |
456 | fschmid | 1812 | view->Deselect(true); |
1957 | cbradney | 1813 | currItem->NextBox->CPos = 0; |
1814 | view->SelectItemNr(currItem->NextBox->ItemNr); |
||
1815 | currItem = currItem->NextBox; |
||
253 | Franz | 1816 | } |
1817 | } |
||
272 | Franz | 1818 | } |
1819 | else |
||
1820 | { |
||
1957 | cbradney | 1821 | if (currItem->NextBox != 0) |
272 | Franz | 1822 | { |
1957 | cbradney | 1823 | if (currItem->NextBox->itemText.count( |