Rev 2026 | Rev 2039 | 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> |
3 | paul | 36 | #include <dlfcn.h> |
135 | Franz | 37 | #include <unistd.h> |
3 | paul | 38 | #include <iostream> |
119 | Franz | 39 | #include <signal.h> |
80 | Franz | 40 | #include <string> |
1208 | cbradney | 41 | |
42 | |||
3 | paul | 43 | #include "scribus.h" |
44 | #include "scribus.moc" |
||
45 | #include "newfile.h" |
||
46 | #include "page.h" |
||
47 | #include "query.h" |
||
48 | #include "mdup.h" |
||
49 | #include "docinfo.h" |
||
50 | #include "reformdoc.h" |
||
51 | #include "serializer.h" |
||
52 | #include "align.h" |
||
53 | #include "fmitem.h" |
||
54 | #include "fontprefs.h" |
||
1641 | cbradney | 55 | #include "prefs.h" |
1158 | cbradney | 56 | #include "prefstable.h" |
3 | paul | 57 | #include "pdfopts.h" |
58 | #include "inspage.h" |
||
59 | #include "delpages.h" |
||
60 | #include "movepage.h" |
||
61 | #include "helpbrowser.h" |
||
62 | #include "scribusXml.h" |
||
1641 | cbradney | 63 | #include "about.h" |
910 | fschmid | 64 | #include "libpostscript/pslib.h" |
3 | paul | 65 | #include "druck.h" |
66 | #include "editformats.h" |
||
67 | #include "muster.h" |
||
1806 | cbradney | 68 | #include "applytemplatedialog.h" |
3 | paul | 69 | #include "picstatus.h" |
70 | #include "customfdialog.h" |
||
71 | #include "cmsprefs.h" |
||
72 | #include "annot.h" |
||
73 | #include "annota.h" |
||
74 | #include "javadocs.h" |
||
151 | Franz | 75 | #include "colorm.h" |
265 | Franz | 76 | #include "mpalette.h" |
1525 | cbradney | 77 | #include "bookpalette.h" |
78 | #include "seiten.h" |
||
79 | #include "layers.h" |
||
80 | #include "frameedit.h" |
||
81 | #include "splash.h" |
||
284 | Franz | 82 | #include "measurements.h" |
364 | Franz | 83 | #include "gtgettext.h" |
506 | fschmid | 84 | #include "fileloader.h" |
740 | fschmid | 85 | #include "arrowchooser.h" |
788 | fschmid | 86 | #include "tabtypography.h" |
879 | fschmid | 87 | #include "tabguides.h" |
1194 | fschmid | 88 | #include "tabtools.h" |
1114 | tsoots | 89 | #include "undogui.h" |
1151 | fschmid | 90 | #include "filewatcher.h" |
1202 | fschmid | 91 | #include "charselect.h" |
1232 | fschmid | 92 | #include "checkDocument.h" |
1235 | fschmid | 93 | #include "tabcheckdoc.h" |
1307 | fschmid | 94 | #include "tabpdfoptions.h" |
1641 | cbradney | 95 | #include "docitemattrprefs.h" |
1644 | cbradney | 96 | #include "pageitemattributes.h" |
1694 | cbradney | 97 | #include "tocindexprefs.h" |
617 | cbradney | 98 | #ifdef _MSC_VER |
99 | #if (_MSC_VER >= 1200) |
||
100 | #include "win-config.h" |
||
101 | #endif |
||
128 | Franz | 102 | #else |
103 | #include "config.h" |
||
104 | #endif |
||
105 | |||
3 | paul | 106 | #include "fpoint.h" |
107 | #include "fpointarray.h" |
||
108 | #include "hysettings.h" |
||
109 | #include "guidemanager.h" |
||
284 | Franz | 110 | #include "keymanager.h" |
3 | paul | 111 | #include "mergedoc.h" |
27 | Franz | 112 | #include "lineformats.h" |
102 | Franz | 113 | #include "story.h" |
123 | Franz | 114 | #include "autoform.h" |
140 | Franz | 115 | #include "tabmanager.h" |
164 | Franz | 116 | #include "search.h" |
169 | Franz | 117 | #include "fontcombo.h" |
415 | Franz | 118 | #include "prefsfile.h" |
1114 | tsoots | 119 | #include "undomanager.h" |
731 | fschmid | 120 | #include "polygonwidget.h" |
766 | cbradney | 121 | #include "werktoolb.h" |
806 | cbradney | 122 | #include "units.h" |
838 | cbradney | 123 | #include "hruler.h" |
124 | #include "vruler.h" |
||
1208 | cbradney | 125 | #include "scraction.h" |
126 | #include "menumanager.h" |
||
1293 | tsoots | 127 | #include "undostate.h" |
1414 | fschmid | 128 | #include "tree.h" |
1500 | cbradney | 129 | #include "scrap.h" |
1549 | subik | 130 | #include "pluginmanager.h" |
1693 | craig | 131 | #include "scpaths.h" |
1972 | craig | 132 | #include "pdfoptions.h" |
1993 | cbradney | 133 | #include "actionmanager.h" |
2024 | cbradney | 134 | #include "documentinformation.h" |
134 | Franz | 135 | |
1702 | cbradney | 136 | //CB TODO include for toc testing for now |
137 | #include "gtwriter.h" |
||
138 | //CB |
||
139 | |||
3 | paul | 140 | extern QPixmap loadIcon(QString nam); |
90 | Franz | 141 | extern bool overwrite(QWidget *parent, QString filename); |
1957 | cbradney | 142 | extern void CopyPageItem(struct CopyPasteBuffer *Buffer, PageItem *currItem); |
203 | Franz | 143 | extern void ReOrderText(ScribusDoc *doc, ScribusView *view); |
204 | Franz | 144 | extern int copyFile(QString source, QString target); |
145 | extern int moveFile(QString source, QString target); |
||
3 | paul | 146 | |
147 | using namespace std; |
||
148 | |||
149 | #ifdef HAVE_CMS |
||
150 | cmsHPROFILE CMSoutputProf; |
||
151 | cmsHPROFILE CMSprinterProf; |
||
1781 | fschmid | 152 | cmsHTRANSFORM stdTransG; |
153 | cmsHTRANSFORM stdProofG; |
||
154 | cmsHTRANSFORM stdTransImgG; |
||
155 | cmsHTRANSFORM stdProofImgG; |
||
156 | cmsHTRANSFORM stdTransCMYKG; |
||
157 | cmsHTRANSFORM stdProofCMYKG; |
||
158 | cmsHTRANSFORM stdTransRGBG; |
||
1488 | fschmid | 159 | bool BlackPoint; |
3 | paul | 160 | bool SoftProofing; |
161 | bool Gamut; |
||
162 | bool CMSuse; |
||
163 | int IntentMonitor; |
||
164 | int IntentPrinter; |
||
165 | #endif |
||
166 | bool CMSavail; |
||
167 | ProfilesL InputProfiles; |
||
168 | QString DocDir; |
||
119 | Franz | 169 | ScribusApp* ScApp; |
415 | Franz | 170 | PrefsFile* prefsFile; |
3 | paul | 171 | |
188 | Franz | 172 | ScribusApp::ScribusApp() |
272 | Franz | 173 | {} // ScribusApp::ScribusApp() |
188 | Franz | 174 | |
767 | cbradney | 175 | /* |
176 | * retval 0 - ok, 1 - no fonts, ... |
||
177 | */ |
||
178 | int ScribusApp::initScribus(bool showSplash, const QString newGuiLanguage) |
||
188 | Franz | 179 | { |
767 | cbradney | 180 | int retVal=0; |
1155 | fschmid | 181 | ExternalApp = 0; |
770 | cbradney | 182 | guiLanguage = newGuiLanguage; |
767 | cbradney | 183 | initSplash(showSplash); |
1208 | cbradney | 184 | setUsesBigPixmaps(true); |
173 | Franz | 185 | ScApp = this; |
355 | Franz | 186 | CurrStED = NULL; |
272 | Franz | 187 | setCaption( tr("Scribus " VERSION)); |
118 | Franz | 188 | setKeyCompression(false); |
272 | Franz | 189 | setIcon(loadIcon("AppIcon.png")); |
1325 | cbradney | 190 | scrActionGroups.clear(); |
191 | scrActionGroups.setAutoDelete(true); |
||
1208 | cbradney | 192 | scrActions.clear(); |
193 | scrRecentFileActions.clear(); |
||
1260 | cbradney | 194 | scrWindowsActions.clear(); |
1208 | cbradney | 195 | scrMenuMgr = new MenuManager(this->menuBar()); |
766 | cbradney | 196 | |
1197 | tsoots | 197 | PrefsPfad = getPreferencesLocation(); |
1392 | cbradney | 198 | bool importingFrom12=convert12Preferences(PrefsPfad); |
1197 | tsoots | 199 | prefsFile = new PrefsFile(QDir::convertSeparators(PrefsPfad + "/prefs13.xml")); |
200 | |||
1247 | tsoots | 201 | undoManager = UndoManager::instance(); |
1443 | tsoots | 202 | objectSpecificUndo = false; |
1549 | subik | 203 | pluginManager = new PluginManager(); |
1780 | cbradney | 204 | initDefaultValues(); |
1995 | cbradney | 205 | |
1993 | cbradney | 206 | actionManager = new ActionManager(this, "actionManager"); |
272 | Franz | 207 | initMenuBar(); |
208 | initStatusBar(); |
||
766 | cbradney | 209 | initToolBars(); |
490 | cbradney | 210 | qApp->processEvents(); |
675 | cbradney | 211 | |
3 | paul | 212 | BuFromApp = false; |
1485 | tsoots | 213 | |
767 | cbradney | 214 | initFonts(); |
215 | |||
272 | Franz | 216 | if (NoFonts) |
767 | cbradney | 217 | retVal=1; |
272 | Franz | 218 | else |
219 | { |
||
777 | fschmid | 220 | buildFontMenu(); |
221 | initDefaultPrefs(); |
||
801 | cbradney | 222 | initArrowStyles(); |
3 | paul | 223 | resize(610, 600); |
272 | Franz | 224 | QVBox* vb = new QVBox( this ); |
225 | vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); |
||
226 | wsp = new QWorkspace( vb ); |
||
227 | setCentralWidget( vb ); |
||
3 | paul | 228 | connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *))); |
770 | cbradney | 229 | |
801 | cbradney | 230 | initPalettes(); |
770 | cbradney | 231 | |
1155 | fschmid | 232 | fileWatcher = new FileWatcher(this); |
1485 | tsoots | 233 | |
1550 | cbradney | 234 | if (splashScreen != NULL) |
235 | splashScreen->setStatus( tr("Initializing Plugins")); |
||
236 | qApp->processEvents(); |
||
237 | pluginManager->initPlugs(); |
||
1596 | subik | 238 | |
1437 | cbradney | 239 | initKeyboardShortcuts(); |
1485 | tsoots | 240 | |
1437 | cbradney | 241 | if (splashScreen != NULL) |
669 | cbradney | 242 | splashScreen->setStatus( tr("Reading Preferences")); |
490 | cbradney | 243 | qApp->processEvents(); |
1823 | cbradney | 244 | //<<CB TODO Reset keyboard shortcuts of all 1.3 users as too many |
245 | // have conflicts if they dont nuke their settings. muhahahhaha |
||
246 | importingFrom12=true; |
||
247 | //>>CB |
||
1392 | cbradney | 248 | ReadPrefs(importingFrom12); |
801 | cbradney | 249 | |
831 | cbradney | 250 | HaveGS = system(Prefs.gs_exe+" -h > /dev/null 2>&1"); |
251 | HavePngAlpha = system(Prefs.gs_exe+" -sDEVICE=pngalpha -c quit > /dev/null 2>&1"); |
||
252 | DocDir = Prefs.DocDir; |
||
801 | cbradney | 253 | |
669 | cbradney | 254 | if (splashScreen != NULL) |
255 | splashScreen->setStatus( tr("Getting ICC Profiles")); |
||
831 | cbradney | 256 | CMSavail = false; |
3 | paul | 257 | GetCMSProfiles(); |
803 | cbradney | 258 | initCMS(); |
831 | cbradney | 259 | |
669 | cbradney | 260 | if (splashScreen != NULL) |
261 | splashScreen->setStatus( tr("Init Hyphenator")); |
||
490 | cbradney | 262 | qApp->processEvents(); |
766 | cbradney | 263 | initHyphenator(); |
801 | cbradney | 264 | |
669 | cbradney | 265 | if (splashScreen != NULL) |
266 | splashScreen->setStatus( tr("Reading Scrapbook")); |
||
801 | cbradney | 267 | initScrapbook(); |
268 | |||
669 | cbradney | 269 | if (splashScreen != NULL) |
1230 | cbradney | 270 | splashScreen->setStatus( tr("Setting up Shortcuts")); |
271 | qApp->processEvents(); |
||
272 | SetShortCut(); |
||
1485 | tsoots | 273 | |
1441 | cbradney | 274 | emit prefsChanged(); |
1485 | tsoots | 275 | |
1208 | cbradney | 276 | connect(fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecent(QString))); |
3 | paul | 277 | connect(this, SIGNAL(TextIFont(QString)), this, SLOT(AdjustFontMenu(QString))); |
278 | connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int))); |
||
1545 | cbradney | 279 | connect(this, SIGNAL(TextISize(int)), propertiesPalette, SLOT(setSize(int))); |
280 | connect(this, SIGNAL(TextUSval(double)), propertiesPalette, SLOT(setExtra(double))); |
||
281 | connect(this, SIGNAL(TextStil(int)), propertiesPalette, SLOT(setStil(int))); |
||
282 | connect(this, SIGNAL(TextScale(int)), propertiesPalette, SLOT(setTScale(int))); |
||
283 | connect(this, SIGNAL(TextFarben(QString, QString, int, int)), propertiesPalette, SLOT(setActFarben(QString, QString, int, int))); |
||
766 | cbradney | 284 | |
801 | cbradney | 285 | initCrashHandler(); |
3 | paul | 286 | } |
767 | cbradney | 287 | closeSplash(); |
288 | return retVal; |
||
3 | paul | 289 | } |
290 | |||
767 | cbradney | 291 | void ScribusApp::initSplash(bool showSplash) |
292 | { |
||
293 | if (showSplash) |
||
294 | { |
||
295 | splashScreen = new SplashScreen(); |
||
296 | splashScreen->setStatus(QObject::tr("Initializing...")); |
||
297 | } |
||
298 | else |
||
299 | splashScreen = NULL; |
||
300 | } |
||
301 | |||
302 | void ScribusApp::closeSplash() |
||
303 | { |
||
304 | if (splashScreen!=NULL) |
||
305 | { |
||
306 | splashScreen->close(); |
||
307 | delete splashScreen; |
||
308 | splashScreen = NULL; |
||
309 | } |
||
310 | } |
||
311 | |||
766 | cbradney | 312 | void ScribusApp::initToolBars() |
313 | { |
||
314 | WerkTools2 = new QToolBar( tr("File"), this); |
||
1208 | cbradney | 315 | scrActions["fileNew"]->addTo(WerkTools2); |
316 | scrActions["fileOpen"]->addTo(WerkTools2); |
||
1210 | cbradney | 317 | scrMenuMgr->addMenuToWidgetOfAction("FileOpenRecent", scrActions["fileOpen"]); |
1208 | cbradney | 318 | scrActions["fileSave"]->addTo(WerkTools2); |
319 | scrActions["fileClose"]->addTo(WerkTools2); |
||
320 | scrActions["filePrint"]->addTo(WerkTools2); |
||
1255 | cbradney | 321 | scrActions["toolsPreflightVerifier"]->addTo(WerkTools2); |
1208 | cbradney | 322 | scrActions["fileExportAsPDF"]->addTo(WerkTools2); |
1485 | tsoots | 323 | |
1114 | tsoots | 324 | editToolBar = new QToolBar(tr("Edit"), this); |
325 | UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget"); |
||
1247 | tsoots | 326 | undoManager->registerGui(uWidget); |
1485 | tsoots | 327 | |
766 | cbradney | 328 | WerkTools = new WerkToolB(this); |
329 | setDockEnabled(WerkTools, DockLeft, false); |
||
330 | setDockEnabled(WerkTools, DockRight, false); |
||
331 | WerkTools->Sichtbar = true; |
||
332 | WerkTools->setEnabled(false); |
||
333 | WerkToolsP = new WerkToolBP(this); |
||
334 | setDockEnabled(WerkToolsP, DockLeft, false); |
||
335 | setDockEnabled(WerkToolsP, DockRight, false); |
||
336 | WerkToolsP->setEnabled(false); |
||
337 | WerkToolsP->Sichtbar = true; |
||
801 | cbradney | 338 | |
339 | connect(WerkTools, SIGNAL(Schliessen()), this, SLOT(ToggleTools())); |
||
1770 | cbradney | 340 | connect(WerkToolsP, SIGNAL(NewMode(int)), this, SLOT(setAppMode(int))); |
801 | cbradney | 341 | connect(WerkToolsP, SIGNAL(Schliessen()), this, SLOT(TogglePDFTools())); |
766 | cbradney | 342 | } |
343 | |||
767 | cbradney | 344 | void ScribusApp::initFonts() |
345 | { |
||
346 | if (splashScreen!=NULL) { |
||
347 | splashScreen->setStatus( tr("Searching for Fonts")); |
||
348 | qApp->processEvents(); |
||
349 | } |
||
350 | NoFonts=GetAllFonts(); |
||
351 | if (NoFonts) |
||
352 | { |
||
353 | if (splashScreen!=NULL) |
||
354 | splashScreen->close(); // 10/10/2004 pv fix #1200 |
||
1801 | cbradney | 355 | QString mess = tr("There are no fonts found on your system."); |
356 | mess += "\n" + tr("Exiting now."); |
||
767 | cbradney | 357 | QMessageBox::critical(this, tr("Fatal Error"), mess, 1, 0, 0); |
358 | } |
||
829 | cbradney | 359 | else |
1485 | tsoots | 360 | if (splashScreen!=NULL) |
829 | cbradney | 361 | { |
362 | splashScreen->setStatus( tr("Font System Initialized")); |
||
363 | qApp->processEvents(); |
||
364 | } |
||
767 | cbradney | 365 | } |
766 | cbradney | 366 | |
770 | cbradney | 367 | void ScribusApp::initDefaultPrefs() |
368 | { |
||
369 | /** Default font and size **/ |
||
370 | SCFontsIterator it(Prefs.AvailFonts); |
||
1194 | fschmid | 371 | Prefs.toolSettings.defFont = it.currentKey(); |
372 | Prefs.toolSettings.defSize = 120; |
||
770 | cbradney | 373 | Prefs.AppFontSize = qApp->font().pointSize(); |
374 | |||
375 | /** Default colours **/ |
||
376 | Prefs.DColors.clear(); |
||
1693 | craig | 377 | QString pfadC = ScPaths::instance().libDir(); |
872 | cbradney | 378 | QString pfadC2 = pfadC + "rgbscribus.txt"; |
770 | cbradney | 379 | QFile fiC(pfadC2); |
380 | if (!fiC.exists()) |
||
381 | { |
||
382 | Prefs.DColors.insert("White", CMYKColor(0, 0, 0, 0)); |
||
383 | Prefs.DColors.insert("Black", CMYKColor(0, 0, 0, 255)); |
||
384 | Prefs.DColors.insert("Blue", CMYKColor(255, 255, 0, 0)); |
||
385 | Prefs.DColors.insert("Cyan", CMYKColor(255, 0, 0, 0)); |
||
386 | Prefs.DColors.insert("Green", CMYKColor(255, 0, 255, 0)); |
||
387 | Prefs.DColors.insert("Red", CMYKColor(0, 255, 255, 0)); |
||
388 | Prefs.DColors.insert("Yellow", CMYKColor(0, 0, 255, 0)); |
||
389 | Prefs.DColors.insert("Magenta", CMYKColor(0, 255, 0, 0)); |
||
390 | Prefs.DColorSet = "Scribus-Small"; |
||
391 | } |
||
392 | else |
||
393 | { |
||
394 | if (fiC.open(IO_ReadOnly)) |
||
395 | { |
||
396 | QString ColorEn, Cname; |
||
397 | int Rval, Gval, Bval; |
||
398 | QTextStream tsC(&fiC); |
||
399 | ColorEn = tsC.readLine(); |
||
400 | while (!tsC.atEnd()) |
||
401 | { |
||
402 | ColorEn = tsC.readLine(); |
||
403 | QTextStream CoE(&ColorEn, IO_ReadOnly); |
||
404 | CoE >> Rval; |
||
405 | CoE >> Gval; |
||
406 | CoE >> Bval; |
||
407 | CoE >> Cname; |
||
408 | CMYKColor tmp; |
||
409 | tmp.setColorRGB(Rval, Gval, Bval); |
||
410 | Prefs.DColors.insert(Cname, tmp); |
||
411 | } |
||
412 | fiC.close(); |
||
413 | } |
||
414 | Prefs.DColorSet = "X11 RGB-Set"; |
||
415 | } |
||
416 | |||
417 | Prefs.Wheelval = 40; |
||
879 | fschmid | 418 | Prefs.guidesSettings.marginsShown = true; |
419 | Prefs.guidesSettings.framesShown = true; |
||
420 | Prefs.guidesSettings.gridShown = false; |
||
421 | Prefs.guidesSettings.guidesShown = false; |
||
422 | Prefs.guidesSettings.baseShown = false; |
||
423 | Prefs.guidesSettings.showPic = true; |
||
424 | Prefs.guidesSettings.linkShown = false; |
||
425 | Prefs.guidesSettings.grabRad = 4; |
||
426 | Prefs.guidesSettings.guideRad = 10; |
||
427 | Prefs.guidesSettings.minorGrid = 20; |
||
428 | Prefs.guidesSettings.majorGrid = 100; |
||
429 | Prefs.guidesSettings.minorColor = QColor(green); |
||
430 | Prefs.guidesSettings.majorColor = QColor(green); |
||
431 | Prefs.guidesSettings.margColor = QColor(blue); |
||
432 | Prefs.guidesSettings.guideColor = QColor(darkBlue); |
||
433 | Prefs.guidesSettings.baseColor = QColor(lightGray); |
||
823 | fschmid | 434 | Prefs.typographicSetttings.valueSuperScript = 33; |
435 | Prefs.typographicSetttings.scalingSuperScript = 100; |
||
436 | Prefs.typographicSetttings.valueSubScript = 33; |
||
437 | Prefs.typographicSetttings.scalingSubScript = 100; |
||
438 | Prefs.typographicSetttings.valueSmallCaps = 75; |
||
439 | Prefs.typographicSetttings.autoLineSpacing = 20; |
||
440 | Prefs.typographicSetttings.valueBaseGrid = 14.4; |
||
441 | Prefs.typographicSetttings.offsetBaseGrid = 0.0; |
||
770 | cbradney | 442 | Prefs.GUI = "Default"; |
1194 | fschmid | 443 | Prefs.toolSettings.dPen = "Black"; |
444 | Prefs.toolSettings.dBrush = "Black"; |
||
445 | Prefs.toolSettings.dShade = 100; |
||
446 | Prefs.toolSettings.dShade2 = 100; |
||
447 | Prefs.toolSettings.dLineArt = SolidLine; |
||
448 | Prefs.toolSettings.dWidth = 1; |
||
449 | Prefs.toolSettings.dPenLine = "Black"; |
||
450 | Prefs.toolSettings.dPenText = "Black"; |
||
451 | Prefs.toolSettings.dStrokeText = "Black"; |
||
1120 | fschmid | 452 | Prefs.DpapColor = QColor(white); |
1194 | fschmid | 453 | Prefs.toolSettings.dCols = 1; |
454 | Prefs.toolSettings.dGap = 0.0; |
||
455 | Prefs.toolSettings.dShadeLine = 100; |
||
456 | Prefs.toolSettings.dLstyleLine = SolidLine; |
||
457 | Prefs.toolSettings.dWidthLine = 1; |
||
458 | Prefs.toolSettings.dStartArrow = 0; |
||
459 | Prefs.toolSettings.dEndArrow = 0; |
||
460 | Prefs.toolSettings.magMin = 10; |
||
461 | Prefs.toolSettings.magMax = 3200; |
||
462 | Prefs.toolSettings.magStep = 25; |
||
463 | Prefs.toolSettings.dBrushPict = "White"; |
||
464 | Prefs.toolSettings.shadePict = 100; |
||
465 | Prefs.toolSettings.scaleX = 1; |
||
466 | Prefs.toolSettings.scaleY = 1; |
||
1187 | fschmid | 467 | Prefs.guidesSettings.before = true; |
1065 | cbradney | 468 | Prefs.docUnitIndex = 0; |
1194 | fschmid | 469 | Prefs.toolSettings.polyC = 4; |
470 | Prefs.toolSettings.polyF = 0.5; |
||
471 | Prefs.toolSettings.polyS = false; |
||
472 | Prefs.toolSettings.polyFd = 0; |
||
473 | Prefs.toolSettings.polyR = 0; |
||
844 | fschmid | 474 | Prefs.mainToolBarSettings.visible = true; |
475 | Prefs.pdfToolBarSettings.visible = true; |
||
770 | cbradney | 476 | Prefs.PSize = 40; |
477 | Prefs.SaveAtQ = true; |
||
478 | Prefs.ClipMargin = true; |
||
479 | Prefs.GCRMode = true; |
||
480 | Prefs.RecentDocs.clear(); |
||
481 | Prefs.RecentDCount = 5; |
||
1065 | cbradney | 482 | Prefs.marginColored = false; |
1542 | cbradney | 483 | Prefs.pageSize = "A4"; |
1545 | cbradney | 484 | Prefs.pageOrientation = 0; |
485 | Prefs.PageWidth = 595; |
||
486 | Prefs.PageHeight = 842; |
||
1975 | mrdocs | 487 | Prefs.RandOben = 40; |
770 | cbradney | 488 | Prefs.RandUnten = 40; |
1975 | mrdocs | 489 | Prefs.RandLinks = 40; |
490 | Prefs.RandRechts = 40; |
||
1545 | cbradney | 491 | Prefs.FacingPages = false; |
492 | Prefs.LeftPageFirst = false; |
||
1194 | fschmid | 493 | Prefs.toolSettings.scaleType = true; |
494 | Prefs.toolSettings.aspectRatio = true; |
||
2025 | fschmid | 495 | Prefs.toolSettings.lowResType = 1; |
770 | cbradney | 496 | Prefs.MinWordLen = 3; |
497 | Prefs.HyCount = 2; |
||
498 | Prefs.Language = ""; |
||
499 | Prefs.Automatic = true; |
||
500 | Prefs.AutoCheck = false; |
||
501 | Prefs.AutoSave = false; |
||
502 | Prefs.AutoSaveTime = 600000; |
||
503 | Prefs.DisScale = 1.0; |
||
504 | Prefs.DocDir = QDir::homeDirPath(); |
||
505 | Prefs.ProfileDir = ""; |
||
506 | Prefs.ScriptDir = ""; |
||
507 | Prefs.TemplateDir = ""; |
||
508 | Prefs.CustomColorSets.clear(); |
||
509 | Prefs.PrPr_Mode = false; |
||
510 | Prefs.Gcr_Mode = true; |
||
511 | Prefs.PrPr_AlphaText = false; |
||
512 | Prefs.PrPr_AlphaGraphics = false; |
||
513 | Prefs.PrPr_Transparency = false; |
||
514 | Prefs.PrPr_C = true; |
||
515 | Prefs.PrPr_M = true; |
||
516 | Prefs.PrPr_Y = true; |
||
517 | Prefs.PrPr_K = true; |
||
518 | Prefs.gimp_exe = "gimp"; |
||
1545 | cbradney | 519 | Prefs.gs_AntiAliasGraphics = true; |
520 | Prefs.gs_AntiAliasText = true; |
||
770 | cbradney | 521 | Prefs.gs_exe = "gs"; |
522 | Prefs.STEcolor = QColor(white); |
||
523 | Prefs.STEfont = font().toString(); |
||
524 | Prefs.DCMSset.DefaultMonitorProfile = ""; |
||
525 | Prefs.DCMSset.DefaultPrinterProfile = ""; |
||
526 | Prefs.DCMSset.DefaultInputProfile = ""; |
||
527 | Prefs.DCMSset.DefaultInputProfile2 = ""; |
||
528 | Prefs.DCMSset.CMSinUse = false; |
||
529 | Prefs.DCMSset.SoftProofOn = false; |
||
530 | Prefs.DCMSset.GamutCheck = false; |
||
531 | Prefs.DCMSset.BlackPoint = true; |
||
532 | Prefs.DCMSset.DefaultIntentMonitor = 1; |
||
533 | Prefs.DCMSset.DefaultIntentMonitor2 = 1; |
||
534 | Prefs.DCMSset.DefaultIntentPrinter = 0; |
||
535 | Prefs.GFontSub.clear(); |
||
801 | cbradney | 536 | Prefs.ScratchLeft = 100; |
537 | Prefs.ScratchRight = 100; |
||
538 | Prefs.ScratchTop = 20; |
||
539 | Prefs.ScratchBottom = 20; |
||
1468 | fschmid | 540 | Prefs.askBeforeSubstituite = true; |
1261 | fschmid | 541 | struct checkerPrefs checkerSettings; |
542 | checkerSettings.ignoreErrors = false; |
||
543 | checkerSettings.autoCheck = true; |
||
544 | checkerSettings.checkGlyphs = true; |
||
545 | checkerSettings.checkOrphans = true; |
||
546 | checkerSettings.checkOverflow = true; |
||
547 | checkerSettings.checkPictures = true; |
||
548 | checkerSettings.checkResolution = true; |
||
549 | checkerSettings.checkTransparency = true; |
||
1284 | fschmid | 550 | checkerSettings.checkAnnotations = false; |
551 | checkerSettings.checkRasterPDF = true; |
||
1261 | fschmid | 552 | checkerSettings.minResolution = 72.0; |
553 | Prefs.checkerProfiles.insert( tr("Postscript"), checkerSettings); |
||
1926 | cbradney | 554 | Prefs.checkerProfiles.insert( tr("PDF 1.3"), checkerSettings); |
1261 | fschmid | 555 | checkerSettings.checkTransparency = false; |
1926 | cbradney | 556 | Prefs.checkerProfiles.insert( tr("PDF 1.4"), checkerSettings); |
1261 | fschmid | 557 | checkerSettings.checkTransparency = true; |
1284 | fschmid | 558 | checkerSettings.checkAnnotations = true; |
1261 | fschmid | 559 | checkerSettings.minResolution = 144.0; |
560 | Prefs.checkerProfiles.insert( tr("PDF/X-3"), checkerSettings); |
||
561 | Prefs.curCheckProfile = tr("Postscript"); |
||
1545 | cbradney | 562 | Prefs.PDF_Options.Thumbnails = false; |
563 | Prefs.PDF_Options.Articles = false; |
||
564 | Prefs.PDF_Options.Compress = true; |
||
565 | Prefs.PDF_Options.CompressMethod = 0; |
||
566 | Prefs.PDF_Options.Quality = 0; |
||
567 | Prefs.PDF_Options.RecalcPic = false; |
||
568 | Prefs.PDF_Options.Bookmarks = false; |
||
569 | Prefs.PDF_Options.PicRes = 300; |
||
1973 | craig | 570 | Prefs.PDF_Options.Version = PDFOptions::PDFVersion_14; |
1545 | cbradney | 571 | Prefs.PDF_Options.Resolution = 300; |
572 | Prefs.PDF_Options.Binding = 0; |
||
573 | Prefs.PDF_Options.EmbedList.clear(); |
||
574 | Prefs.PDF_Options.SubsetList.clear(); |
||
575 | Prefs.PDF_Options.MirrorH = false; |
||
576 | Prefs.PDF_Options.MirrorV = false; |
||
577 | Prefs.PDF_Options.RotateDeg = 0; |
||
578 | Prefs.PDF_Options.PresentMode = false; |
||
579 | Prefs.PDF_Options.Datei = ""; |
||
580 | Prefs.PDF_Options.PresentVals.clear(); |
||
581 | Prefs.PDF_Options.isGrayscale = false; |
||
582 | Prefs.PDF_Options.UseRGB = true; |
||
583 | Prefs.PDF_Options.UseProfiles = false; |
||
584 | Prefs.PDF_Options.UseProfiles2 = false; |
||
585 | Prefs.PDF_Options.SolidProf = ""; |
||
586 | Prefs.PDF_Options.SComp = 3; |
||
587 | Prefs.PDF_Options.ImageProf = ""; |
||
588 | Prefs.PDF_Options.PrintProf = ""; |
||
589 | Prefs.PDF_Options.Info = ""; |
||
590 | Prefs.PDF_Options.Intent = 0; |
||
591 | Prefs.PDF_Options.Intent2 = 0; |
||
592 | Prefs.PDF_Options.BleedTop = 0; |
||
593 | Prefs.PDF_Options.BleedLeft = 0; |
||
594 | Prefs.PDF_Options.BleedRight = 0; |
||
595 | Prefs.PDF_Options.BleedBottom = 0; |
||
596 | Prefs.PDF_Options.EmbeddedI = false; |
||
597 | Prefs.PDF_Options.Encrypt = false; |
||
598 | Prefs.PDF_Options.PassOwner = ""; |
||
599 | Prefs.PDF_Options.PassUser = ""; |
||
600 | Prefs.PDF_Options.Permissions = -4; |
||
601 | Prefs.PDF_Options.UseLPI = false; |
||
602 | Prefs.PDF_Options.LPISettings.clear(); |
||
1641 | cbradney | 603 | |
1642 | cbradney | 604 | //Attribute setup |
1641 | cbradney | 605 | Prefs.defaultItemAttributes.clear(); |
1701 | cbradney | 606 | Prefs.defaultToCSetups.clear(); |
801 | cbradney | 607 | } |
770 | cbradney | 608 | |
801 | cbradney | 609 | |
610 | void ScribusApp::initDefaultValues() |
||
611 | { |
||
831 | cbradney | 612 | dirs = prefsFile->getContext("dirs"); |
1780 | cbradney | 613 | HaveDoc = false; |
801 | cbradney | 614 | singleClose = false; |
615 | ScriptRunning = false; |
||
616 | view = NULL; |
||
617 | doc = NULL; |
||
618 | Buffer2 = ""; |
||
619 | UniCinp = false; |
||
620 | UniCinC = 0; |
||
621 | UniCinS = ""; |
||
622 | DispX = 10; |
||
623 | DispY = 10; |
||
624 | DocNr = 1; |
||
625 | PrinterUsed = false; |
||
626 | PDef.Pname = ""; |
||
627 | PDef.Dname = ""; |
||
628 | PDef.Command = ""; |
||
629 | keyrep = false; |
||
1204 | tsoots | 630 | _arrowKeyDown = false; |
801 | cbradney | 631 | ClipB = QApplication::clipboard(); |
632 | PalettesStat[0] = false; |
||
633 | GuidesStat[0] = false; |
||
634 | |||
635 | connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange())); |
||
770 | cbradney | 636 | } |
637 | |||
801 | cbradney | 638 | void ScribusApp::initKeyboardShortcuts() |
639 | { |
||
1478 | cbradney | 640 | for( QMap<QString, QGuardedPtr<ScrAction> >::Iterator it = scrActions.begin(); it!=scrActions.end(); ++it ) |
1525 | cbradney | 641 | { |
1478 | cbradney | 642 | SetKeyEntry(it.key(), it.data()->cleanMenuText(), QString(it.data()->accel()),0); |
1525 | cbradney | 643 | //qDebug(QString("|-\n|%1||%2||%3").arg(it.key()).arg(it.data()->cleanMenuText()).arg(QString(it.data()->accel()))); |
644 | } |
||
801 | cbradney | 645 | } |
646 | |||
647 | void ScribusApp::initArrowStyles() |
||
648 | { |
||
1065 | cbradney | 649 | struct ArrowDesc arrow; |
801 | cbradney | 650 | FPointArray points; |
651 | QWMatrix arrowScaling; |
||
652 | arrowScaling.scale(0.5, 0.5); |
||
653 | arrow.name = "Arrow1L"; |
||
654 | arrow.userArrow = false; |
||
655 | points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0); |
||
656 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
657 | points.addQuadPoint(12, 0, 12, 0, 12, 0, 12, 0); |
||
658 | points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5); |
||
659 | points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0); |
||
660 | arrow.points = points.copy(); |
||
661 | Prefs.arrowStyles.append(arrow); |
||
662 | arrow.name = "Arrow1M"; |
||
663 | points.map(arrowScaling); |
||
664 | arrow.points = points.copy(); |
||
665 | Prefs.arrowStyles.append(arrow); |
||
666 | arrow.name = "Arrow1S"; |
||
667 | points.map(arrowScaling); |
||
668 | arrow.points = points.copy(); |
||
669 | Prefs.arrowStyles.append(arrow); |
||
670 | arrow.name = "SquareL"; |
||
671 | points.resize(0); |
||
672 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
673 | points.addQuadPoint(5, -5, 5, -5, 5, -5, 5, -5); |
||
674 | points.addQuadPoint(5, 5, 5, 5, 5, 5, 5, 5); |
||
675 | points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5); |
||
676 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
677 | arrow.points = points.copy(); |
||
678 | Prefs.arrowStyles.append(arrow); |
||
679 | arrow.name = "SquareM"; |
||
680 | points.map(arrowScaling); |
||
681 | arrow.points = points.copy(); |
||
682 | Prefs.arrowStyles.append(arrow); |
||
683 | arrow.name = "SquareS"; |
||
684 | points.map(arrowScaling); |
||
685 | arrow.points = points.copy(); |
||
686 | Prefs.arrowStyles.append(arrow); |
||
687 | arrow.name = "TriangleInL"; |
||
688 | points.resize(0); |
||
689 | points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0); |
||
690 | points.addQuadPoint(-2.88, 5, -2.88, 5, -2.88, 5, -2.88, 5); |
||
691 | points.addQuadPoint(-2.88, -5, -2.88, -5, -2.88, -5, -2.88, -5); |
||
692 | points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0); |
||
693 | arrow.points = points.copy(); |
||
694 | Prefs.arrowStyles.append(arrow); |
||
695 | arrow.name = "TriangleInM"; |
||
696 | points.map(arrowScaling); |
||
697 | arrow.points = points.copy(); |
||
698 | Prefs.arrowStyles.append(arrow); |
||
699 | arrow.name = "TriangleInS"; |
||
700 | points.map(arrowScaling); |
||
701 | arrow.points = points.copy(); |
||
702 | Prefs.arrowStyles.append(arrow); |
||
703 | arrow.name = "TriangleOutL"; |
||
704 | points.resize(0); |
||
705 | points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0); |
||
706 | points.addQuadPoint(2.88, 5, 2.88, 5, 2.88, 5, 2.88, 5); |
||
707 | points.addQuadPoint(2.88, -5, 2.88, -5, 2.88, -5, 2.88, -5); |
||
708 | points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0); |
||
709 | arrow.points = points.copy(); |
||
710 | Prefs.arrowStyles.append(arrow); |
||
711 | arrow.name = "TriangleOutM"; |
||
712 | points.map(arrowScaling); |
||
713 | arrow.points = points.copy(); |
||
714 | Prefs.arrowStyles.append(arrow); |
||
715 | arrow.name = "TriangleOutS"; |
||
716 | points.map(arrowScaling); |
||
717 | arrow.points = points.copy(); |
||
718 | Prefs.arrowStyles.append(arrow); |
||
719 | } |
||
720 | |||
721 | void ScribusApp::initPalettes() |
||
722 | { |
||
1493 | cbradney | 723 | //CB TODO hide the publicly available members of some palettes |
724 | // these must be filtered too as they take control of the palettes events |
||
1545 | cbradney | 725 | outlinePalette = new Tree(this, this); |
726 | connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool)) ); |
||
727 | connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setOn(bool))); |
||
728 | outlinePalette->setPrefsContext("OutlinePalette"); |
||
729 | outlinePalette->reportDisplay->installEventFilter(this); |
||
730 | propertiesPalette = new Mpalette(this, &Prefs); |
||
731 | connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool)) ); |
||
732 | connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setOn(bool))); |
||
733 | propertiesPalette->setPrefsContext("PropertiesPalette"); |
||
734 | propertiesPalette->Cpal->SetColors(Prefs.DColors); |
||
735 | propertiesPalette->Cpal->UseTrans(true); |
||
736 | propertiesPalette->Fonts->RebuildList(&Prefs, 0); |
||
737 | propertiesPalette->installEventFilter(this); |
||
738 | nodePalette = new NodePalette(this); |
||
739 | nodePalette->setPrefsContext("NodePalette"); |
||
740 | nodePalette->installEventFilter(this); |
||
1549 | subik | 741 | |
1545 | cbradney | 742 | layerPalette = new LayerPalette(this); |
743 | connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) ); |
||
744 | connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setOn(bool))); |
||
745 | layerPalette->setPrefsContext("LayerPalette"); |
||
746 | layerPalette->installEventFilter(this); |
||
747 | layerPalette->Table->installEventFilter(this); |
||
748 | scrapbookPalette = new Biblio(this, &Prefs); |
||
749 | connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) ); |
||
750 | connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setOn(bool))); |
||
751 | scrapbookPalette->setPrefsContext("ScrapbookPalette"); |
||
752 | scrapbookPalette->installEventFilter(this); |
||
753 | scrapbookPalette->BibWin->installEventFilter(this); |
||
754 | pagePalette = new SeitenPal(this); |
||
755 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) ); |
||
756 | connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , this, SLOT(setPagePalette(bool)) ); |
||
757 | connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setOn(bool))); |
||
758 | pagePalette->setPrefsContext("PagePalette"); |
||
759 | pagePalette->installEventFilter(this); |
||
760 | bookmarkPalette = new BookPalette(this); |
||
761 | connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) ); |
||
762 | connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setOn(bool))); |
||
763 | bookmarkPalette->setPrefsContext("BookmarkPalette"); |
||
764 | bookmarkPalette->installEventFilter(this); |
||
765 | measurementPalette = new Measurements(this); |
||
766 | connect( scrActions["toolsMeasurements"], SIGNAL(toggled(bool)) , measurementPalette, SLOT(setPaletteShown(bool)) ); |
||
1525 | cbradney | 767 | connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool, int)) , this, SLOT(setAppModeByToggle(bool, int)) ); |
1545 | cbradney | 768 | connect( measurementPalette, SIGNAL(paletteShown(bool)), scrActions["toolsMeasurements"], SLOT(setOn(bool))); |
769 | measurementPalette->setPrefsContext("MeasurementPalette"); |
||
770 | measurementPalette->installEventFilter(this); |
||
771 | measurementPalette->hide(); |
||
772 | docCheckerPalette = new CheckDocument(this, false); |
||
773 | connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) ); |
||
774 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setOn(bool))); |
||
1825 | fschmid | 775 | connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool))); |
1545 | cbradney | 776 | docCheckerPalette->setPrefsContext("DocCheckerPalette"); |
777 | docCheckerPalette->installEventFilter(this); |
||
778 | docCheckerPalette->hide(); |
||
1448 | cbradney | 779 | |
780 | undoPalette = new UndoPalette(this, "undoPalette"); |
||
1493 | cbradney | 781 | undoPalette->installEventFilter(this); |
1448 | cbradney | 782 | undoManager->registerGui(undoPalette); |
1493 | cbradney | 783 | connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); |
1448 | cbradney | 784 | connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); |
1485 | tsoots | 785 | |
1545 | cbradney | 786 | connect(propertiesPalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
787 | connect(propertiesPalette, SIGNAL(NewAbStyle(int)), this, SLOT(setNewAbStyle(int))); |
||
788 | connect(propertiesPalette, SIGNAL(BackHome()), this, SLOT(Aktiv())); |
||
789 | connect(propertiesPalette, SIGNAL(Stellung(int)), this, SLOT(setItemHoch(int))); |
||
790 | connect(propertiesPalette, SIGNAL(EditCL()), this, SLOT(ToggleFrameEdit())); |
||
791 | connect(propertiesPalette, SIGNAL(NewTF(QString)), this, SLOT(SetNewFont(QString))); |
||
792 | connect(propertiesPalette, SIGNAL(UpdtGui(int)), this, SLOT(HaveNewSel(int))); |
||
793 | connect(propertiesPalette->Cpal, SIGNAL(NewPen(QString)), this, SLOT(setPenFarbe(QString))); |
||
794 | connect(propertiesPalette->Cpal, SIGNAL(NewBrush(QString)), this, SLOT(setBrushFarbe(QString))); |
||
795 | connect(propertiesPalette->Cpal, SIGNAL(NewPenShade(int)), this, SLOT(setPenShade(int))); |
||
796 | connect(propertiesPalette->Cpal, SIGNAL(NewBrushShade(int)), this, SLOT(setBrushShade(int))); |
||
2026 | cbradney | 797 | connect(propertiesPalette->Cpal, SIGNAL(NewTrans(double)), this, SLOT(setItemFillTransparency(double))); |
798 | connect(propertiesPalette->Cpal, SIGNAL(NewTransS(double)), this, SLOT(setItemLineTransparency(double))); |
||
1545 | cbradney | 799 | connect(propertiesPalette->Cpal, SIGNAL(NewGradient(int)), this, SLOT(setGradFill(int))); |
800 | connect(propertiesPalette->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), this, SLOT(updtGradFill())); |
||
801 | connect(propertiesPalette->Cpal, SIGNAL(gradientChanged()), this, SLOT(updtGradFill())); |
||
802 | connect(propertiesPalette->Cpal, SIGNAL(QueryItem()), this, SLOT(GetBrushPen())); |
||
803 | connect(docCheckerPalette, SIGNAL(rescan()), this, SLOT(slotCheckDoc())); |
||
804 | connect(docCheckerPalette, SIGNAL(selectElement(int, int)), this, SLOT(SelectFromOutl(int, int))); |
||
805 | connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(SelectFromOutlS(int))); |
||
806 | connect(docCheckerPalette, SIGNAL(selectTemplatePage(QString)), this, SLOT(ManageTemp(QString))); |
||
807 | connect(outlinePalette, SIGNAL(selectElement(int, int, bool)), this, SLOT(SelectFromOutl(int, int, bool))); |
||
808 | connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(SelectFromOutlS(int))); |
||
809 | connect(outlinePalette, SIGNAL(selectTemplatePage(QString)), this, SLOT(ManageTemp(QString))); |
||
810 | connect(propertiesPalette->Spal, SIGNAL(newStyle(int)), this, SLOT(setNewAbStyle(int))); |
||
811 | connect(propertiesPalette, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles())); |
||
812 | connect(nodePalette, SIGNAL(Schliessen()), this, SLOT(NoFrameEdit())); |
||
813 | connect(layerPalette, SIGNAL(LayerActivated(int)), this, SLOT(changeLayer(int))); |
||
814 | connect(layerPalette, SIGNAL(LayerRemoved(int, bool)), this, SLOT(LayerRemove(int, bool))); |
||
815 | connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
||
816 | connect(pagePalette, SIGNAL(EditTemp(QString)), this, SLOT(ManageTemp(QString))); |
||
817 | connect(pagePalette->PageView, SIGNAL(UseTemp(QString, int)), this, SLOT(Apply_Temp(QString, int))); |
||
818 | connect(pagePalette->PageView, SIGNAL(NewPage(int, QString)), this, SLOT(slotNewPageP(int, QString))); |
||
819 | connect(pagePalette->Trash, SIGNAL(DelPage(int)), this, SLOT(DeletePage2(int))); |
||
820 | connect(pagePalette, SIGNAL(GotoSeite(int)), this, SLOT(SelectFromOutlS(int))); |
||
821 | connect(bookmarkPalette->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks())); |
||
822 | connect(bookmarkPalette->BView, SIGNAL(ChangeBMNr(int, int, int)), this, SLOT(ChBookmarks(int, int, int))); |
||
823 | connect(bookmarkPalette->BView, SIGNAL(SelectElement(int, int)), this, SLOT(SelectFromOutl(int, int))); |
||
801 | cbradney | 824 | } |
825 | |||
826 | void ScribusApp::initScrapbook() |
||
827 | { |
||
1554 | cbradney | 828 | QString scrapbookFile = QDir::convertSeparators(PrefsPfad+"/scrap13.scs"); |
801 | cbradney | 829 | QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile); |
830 | if (scrapbookFileInfo.exists()) |
||
1545 | cbradney | 831 | scrapbookPalette->BibWin->ReadContents(scrapbookFile); |
832 | scrapbookPalette->ScFilename = scrapbookFile; |
||
833 | scrapbookPalette->AdjustMenu(); |
||
801 | cbradney | 834 | } |
835 | |||
836 | void ScribusApp::initCrashHandler() |
||
837 | { |
||
838 | typedef void (*HandlerType)(int); |
||
839 | HandlerType handler = 0; |
||
840 | handler = ScribusApp::defaultCrashHandler; |
||
841 | if (!handler) |
||
842 | handler = SIG_DFL; |
||
843 | sigset_t mask; |
||
844 | sigemptyset(&mask); |
||
845 | #ifdef SIGSEGV |
||
846 | signal (SIGSEGV, handler); |
||
847 | sigaddset(&mask, SIGSEGV); |
||
848 | #endif |
||
849 | #ifdef SIGFPE |
||
850 | signal (SIGFPE, handler); |
||
851 | sigaddset(&mask, SIGFPE); |
||
852 | #endif |
||
853 | #ifdef SIGILL |
||
854 | signal (SIGILL, handler); |
||
855 | sigaddset(&mask, SIGILL); |
||
856 | #endif |
||
857 | #ifdef SIGABRT |
||
858 | signal (SIGABRT, handler); |
||
859 | sigaddset(&mask, SIGABRT); |
||
860 | #endif |
||
861 | sigprocmask(SIG_UNBLOCK, &mask, 0); |
||
862 | } |
||
863 | |||
770 | cbradney | 864 | const QString ScribusApp::getGuiLanguage() |
865 | { |
||
866 | return guiLanguage; |
||
867 | } |
||
868 | |||
1525 | cbradney | 869 | bool ScribusApp::warningVersion(QWidget *parent) |
870 | { |
||
871 | bool retval = false; |
||
872 | int t = QMessageBox::warning(parent, QObject::tr("Scribus Development Version"), |
||
1554 | cbradney | 873 | QObject::tr("You are running a development version of Scribus 1.3.x.\nThe process of saving will make files originating from versions of\nScribus of 1.2.x or lower unusable again in those versions.\nAre you sure you wish to proceed with this operation?"), |
1525 | cbradney | 874 | QObject::tr("&Cancel"), QObject::tr("&Proceed"), "", 1, 0); |
875 | if (t == 1) |
||
876 | retval = true; |
||
877 | return retval; |
||
878 | } |
||
879 | |||
675 | cbradney | 880 | /*! |
881 | \fn QString ScribusApp::getPreferencesLocation() |
||
882 | \author Craig Bradney |
||
883 | \date Thu 18 Nov 2004 |
||
884 | \brief Get the user's preference file location. Rename any existing old preferences files |
||
885 | \param None |
||
886 | \retval QString Location of the user's preferences |
||
887 | */ |
||
888 | |||
889 | QString ScribusApp::getPreferencesLocation() |
||
890 | { |
||
891 | QString Pff = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus"); |
||
892 | QFileInfo Pffi = QFileInfo(Pff); |
||
893 | QString PrefsPfad; |
||
1144 | cbradney | 894 | //If we are using ~/.scribus |
675 | cbradney | 895 | if (Pffi.exists()) |
896 | { |
||
897 | if (Pffi.isDir()) |
||
898 | PrefsPfad = Pff; |
||
899 | else |
||
900 | PrefsPfad = QDir::homeDirPath(); |
||
901 | } |
||
1144 | cbradney | 902 | else // Move to using ~/.scribus/scribus.* from ~/.scribus.* |
675 | cbradney | 903 | { |
1144 | cbradney | 904 | QDir prefsDirectory = QDir(); |
905 | prefsDirectory.mkdir(Pff); |
||
675 | cbradney | 906 | PrefsPfad = Pff; |
1144 | cbradney | 907 | QString oldPR = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus.rc"); |
908 | QFileInfo oldPi = QFileInfo(oldPR); |
||
909 | if (oldPi.exists()) |
||
910 | moveFile(oldPR, Pff+"/scribus.rc"); |
||
911 | QString oldPR2 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusfont.rc"); |
||
912 | QFileInfo oldPi2 = QFileInfo(oldPR2); |
||
913 | if (oldPi2.exists()) |
||
914 | moveFile(oldPR2, Pff+"/scribusfont.rc"); |
||
915 | QString oldPR3 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusscrap.scs"); |
||
916 | QFileInfo oldPi3 = QFileInfo(oldPR3); |
||
917 | if (oldPi3.exists()) |
||
918 | moveFile(oldPR3, Pff+"/scrap.scs"); |
||
675 | cbradney | 919 | } |
1392 | cbradney | 920 | return PrefsPfad; |
921 | } |
||
922 | |||
923 | /*! |
||
924 | \fn QString ScribusApp::convertToXMLPreferences(QString prefsLocation) |
||
925 | \author Craig Bradney |
||
926 | \date Sun 09 Jan 2005 |
||
927 | \brief Convert 1.2 prefs to 1.3 prefs |
||
928 | \param prefsLocation Location of user preferences |
||
929 | \retval None |
||
930 | */ |
||
931 | bool ScribusApp::convert12Preferences(const QString prefsLocation) |
||
932 | { |
||
1144 | cbradney | 933 | //Now make copies for 1.3 use and leave the old ones alone for <1.3.0 usage |
1554 | cbradney | 934 | QString oldPR[5], newPR[5]; |
935 | oldPR[0]=QDir::convertSeparators(prefsLocation+"/scribus.rc"); |
||
936 | oldPR[1]=QDir::convertSeparators(prefsLocation+"/scribusfont.rc"); |
||
937 | oldPR[2]=QDir::convertSeparators(prefsLocation+"/scrap.scs"); |
||
938 | oldPR[3]=QDir::convertSeparators(prefsLocation+"/prefs.xml"); |
||
939 | oldPR[4]=QDir::convertSeparators(prefsLocation+"/scripter.rc"); |
||
940 | newPR[0]=QDir::convertSeparators(prefsLocation+"/scribus13.rc"); |
||
941 | newPR[1]=QDir::convertSeparators(prefsLocation+"/scribusfont13.rc"); |
||
942 | newPR[2]=QDir::convertSeparators(prefsLocation+"/scrap13.scs"); |
||
943 | newPR[3]=QDir::convertSeparators(prefsLocation+"/prefs13.xml"); |
||
944 | newPR[4]=QDir::convertSeparators(prefsLocation+"/scripter13.rc"); |
||
1485 | tsoots | 945 | |
1554 | cbradney | 946 | bool existsOldPR[5], existsNewPR[5]; |
947 | for (uint i=0;i<5;++i) |
||
948 | { |
||
949 | existsOldPR[i] =QFile::exists(oldPR[i]); |
||
950 | existsNewPR[i] =QFile::exists(newPR[i]); |
||
951 | } |
||
1485 | tsoots | 952 | |
1392 | cbradney | 953 | bool retVal=false; |
1144 | cbradney | 954 | //Only check for these two as they will be autocreated if they dont exist. |
1554 | cbradney | 955 | if( (existsOldPR[0] && !existsNewPR[0]) || (existsOldPR[3] && !existsNewPR[3]) ) |
1144 | cbradney | 956 | { |
1392 | cbradney | 957 | retVal=true; // converting from 1.2 prefs |
1144 | cbradney | 958 | if (splashScreen) |
959 | splashScreen->hide(); |
||
960 | if ( (QMessageBox::question( this, tr("Migrate Old Scribus Settings?"), |
||
1392 | cbradney | 961 | tr("Scribus has detected existing Scribus 1.2 preferences files.\n" |
962 | "Do you want to migrate them to the new Scribus version?"), |
||
963 | QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::NoButton))==QMessageBox::Yes ) |
||
1144 | cbradney | 964 | { |
1554 | cbradney | 965 | for (uint i=0;i<5;++i) |
966 | { |
||
967 | if (existsOldPR[i] && !existsNewPR[i]) |
||
968 | copyFile(oldPR[i], newPR[i]); |
||
969 | } |
||
1144 | cbradney | 970 | } |
971 | if (splashScreen) |
||
972 | splashScreen->show(); |
||
973 | } |
||
1392 | cbradney | 974 | return retVal; |
675 | cbradney | 975 | } |
976 | |||
3 | paul | 977 | void ScribusApp::initMenuBar() |
978 | { |
||
979 | QFont tmp; |
||
980 | RecentDocs.clear(); |
||
1208 | cbradney | 981 | |
982 | scrMenuMgr->createMenu("File", tr("&File")); |
||
983 | scrMenuMgr->addMenuItem(scrActions["fileNew"], "File"); |
||
984 | scrMenuMgr->addMenuItem(scrActions["fileOpen"], "File"); |
||
985 | recentFileMenuName="FileOpenRecent"; |
||
986 | scrMenuMgr->createMenu(recentFileMenuName, tr("Open &Recent"), "File"); |
||
987 | scrMenuMgr->addMenuSeparator("File"); |
||
988 | scrMenuMgr->addMenuItem(scrActions["fileClose"], "File"); |
||
989 | scrMenuMgr->addMenuItem(scrActions["fileSave"], "File"); |
||
990 | scrMenuMgr->addMenuItem(scrActions["fileSaveAs"], "File"); |
||
991 | scrMenuMgr->addMenuItem(scrActions["fileRevert"], "File"); |
||
992 | scrMenuMgr->addMenuItem(scrActions["fileCollect"], "File"); |
||
993 | scrMenuMgr->addMenuSeparator("File"); |
||
994 | scrMenuMgr->createMenu("FileImport", tr("&Import"), "File"); |
||
995 | scrMenuMgr->addMenuItem(scrActions["fileImportText"], "FileImport"); |
||
996 | scrMenuMgr->addMenuItem(scrActions["fileImportAppendText"], "FileImport"); |
||
997 | scrMenuMgr->addMenuItem(scrActions["fileImportImage"], "FileImport"); |
||
998 | scrMenuMgr->addMenuItem(scrActions["fileImportPage"], "FileImport"); |
||
999 | scrMenuMgr->createMenu("FileExport", tr("&Export"), "File"); |
||
1000 | scrMenuMgr->addMenuItem(scrActions["fileExportText"], "FileExport"); |
||
1001 | scrMenuMgr->addMenuItem(scrActions["fileExportAsEPS"], "FileExport"); |
||
1002 | scrMenuMgr->addMenuItem(scrActions["fileExportAsPDF"], "FileExport"); |
||
1003 | scrMenuMgr->addMenuSeparator("File"); |
||
1004 | scrMenuMgr->addMenuItem(scrActions["fileDocInfo"], "File"); |
||
1005 | scrMenuMgr->addMenuItem(scrActions["fileDocSetup"], "File"); |
||
1006 | scrMenuMgr->addMenuItem(scrActions["filePrint"], "File"); |
||
1007 | scrMenuMgr->addMenuSeparator("File"); |
||
1008 | scrMenuMgr->addMenuItem(scrActions["fileQuit"], "File"); |
||
1009 | |||
1485 | tsoots | 1010 | scrActions["fileClose"]->setEnabled(false); |
1208 | cbradney | 1011 | scrActions["fileSave"]->setEnabled(false); |
1012 | scrActions["fileSaveAs"]->setEnabled(false); |
||
1013 | scrActions["fileRevert"]->setEnabled(false); |
||
1014 | scrActions["fileCollect"]->setEnabled(false); |
||
1015 | scrActions["fileImportText"]->setEnabled(false); |
||
1016 | scrActions["fileImportImage"]->setEnabled(false); |
||
1017 | scrActions["fileImportAppendText"]->setEnabled(false); |
||
1018 | scrActions["fileImportPage"]->setEnabled(false); |
||
1019 | scrActions["fileExportText"]->setEnabled(false); |
||
1020 | scrActions["fileExportAsEPS"]->setEnabled(false); |
||
1021 | scrActions["fileExportAsPDF"]->setEnabled(false); |
||
1022 | scrMenuMgr->setMenuEnabled("FileExport", false); |
||
1023 | scrActions["fileDocInfo"]->setEnabled(false); |
||
1024 | scrActions["fileDocSetup"]->setEnabled(false); |
||
1025 | scrActions["filePrint"]->setEnabled(false); |
||
1485 | tsoots | 1026 | |
1227 | cbradney | 1027 | scrMenuMgr->createMenu("Edit", tr("&Edit")); |
1028 | scrMenuMgr->addMenuItem(scrActions["editUndoAction"], "Edit"); |
||
1029 | scrMenuMgr->addMenuItem(scrActions["editRedoAction"], "Edit"); |
||
1030 | scrMenuMgr->addMenuItem(scrActions["editActionMode"], "Edit"); |
||
1031 | scrMenuMgr->addMenuSeparator("Edit"); |
||
1032 | scrMenuMgr->addMenuItem(scrActions["editCut"], "Edit"); |
||
1033 | scrMenuMgr->addMenuItem(scrActions["editCopy"], "Edit"); |
||
1034 | scrMenuMgr->addMenuItem(scrActions["editPaste"], "Edit"); |
||
1963 | cbradney | 1035 | scrMenuMgr->addMenuItem(scrActions["editClearContents"], "Edit"); |
1227 | cbradney | 1036 | scrMenuMgr->addMenuItem(scrActions["editSelectAll"], "Edit"); |
1837 | cbradney | 1037 | scrMenuMgr->addMenuItem(scrActions["editDeselectAll"], "Edit"); |
1227 | cbradney | 1038 | scrMenuMgr->addMenuSeparator("Edit"); |
1039 | scrMenuMgr->addMenuItem(scrActions["editSearchReplace"], "Edit"); |
||
1981 | cbradney | 1040 | scrMenuMgr->addMenuItem(scrActions["toolsEditWithStoryEditor"], "Edit"); |
1227 | cbradney | 1041 | scrMenuMgr->addMenuSeparator("Edit"); |
1042 | scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit"); |
||
1043 | scrMenuMgr->addMenuItem(scrActions["editParaStyles"], "Edit"); |
||
1044 | scrMenuMgr->addMenuItem(scrActions["editLineStyles"], "Edit"); |
||
1045 | scrMenuMgr->addMenuItem(scrActions["editTemplates"], "Edit"); |
||
1046 | scrMenuMgr->addMenuItem(scrActions["editJavascripts"], "Edit"); |
||
1047 | scrMenuMgr->addMenuSeparator("Edit"); |
||
1048 | scrMenuMgr->addMenuItem(scrActions["editPreferences"], "Edit"); |
||
1049 | scrActions["editUndoAction"]->setEnabled(false); |
||
1050 | scrActions["editRedoAction"]->setEnabled(false); |
||
1446 | tsoots | 1051 | scrActions["editActionMode"]->setEnabled(true); |
1227 | cbradney | 1052 | scrActions["editCut"]->setEnabled(false); |
1053 | scrActions["editCopy"]->setEnabled(false); |
||
1054 | scrActions["editPaste"]->setEnabled(false); |
||
1963 | cbradney | 1055 | scrActions["editClearContents"]->setEnabled(false); |
1227 | cbradney | 1056 | scrActions["editSelectAll"]->setEnabled(false); |
1837 | cbradney | 1057 | scrActions["editDeselectAll"]->setEnabled(false); |
1227 | cbradney | 1058 | scrActions["editSearchReplace"]->setEnabled(false); |
1059 | scrActions["editParaStyles"]->setEnabled(false); |
||
1060 | scrActions["editLineStyles"]->setEnabled(false); |
||
1061 | scrActions["editTemplates"]->setEnabled(false); |
||
1062 | scrActions["editJavascripts"]->setEnabled(false); |
||
1996 | cbradney | 1063 | scrActions["toolsEditWithStoryEditor"]->setEnabled(false); |
1227 | cbradney | 1064 | |
1065 | //Style Menu |
||
1325 | cbradney | 1066 | scrMenuMgr->createMenu("Style", tr("St&yle")); |
1437 | cbradney | 1067 | //Color menu |
1068 | // CB TODO |
||
1069 | scrMenuMgr->createMenu("Color", tr("&Color")); |
||
1070 | ColorMenC = new QComboBox(false); |
||
1071 | ColorMenC->setEditable(false); |
||
1072 | scrMenuMgr->addMenuItem(ColorMenC, "Color"); |
||
1485 | tsoots | 1073 | |
1437 | cbradney | 1074 | //Text size menu |
1075 | scrMenuMgr->createMenu("FontSize", tr("&Size")); |
||
1076 | scrActionGroups["fontSize"]->addTo(scrMenuMgr->getLocalPopupMenu("FontSize")); |
||
1485 | tsoots | 1077 | |
1437 | cbradney | 1078 | //Shade menu |
1079 | scrMenuMgr->createMenu("Shade", tr("&Shade")); |
||
1080 | scrActionGroups["shade"]->addTo(scrMenuMgr->getLocalPopupMenu("Shade")); |
||
1485 | tsoots | 1081 | |
1437 | cbradney | 1082 | //Font menu |
1083 | scrMenuMgr->createMenu("Font", tr("&Font")); |
||
1084 | FontMenu = scrMenuMgr->getLocalPopupMenu("Font"); |
||
1485 | tsoots | 1085 | |
1437 | cbradney | 1086 | //Type style menu |
1087 | scrMenuMgr->createMenu("TypeEffects", tr("&Effects")); |
||
1088 | scrActionGroups["typeEffects"]->addTo(scrMenuMgr->getLocalPopupMenu("TypeEffects")); |
||
1485 | tsoots | 1089 | |
1236 | cbradney | 1090 | //Item Menu |
1091 | scrMenuMgr->createMenu("Item", tr("&Item")); |
||
1092 | scrMenuMgr->addMenuItem(scrActions["itemDuplicate"], "Item"); |
||
1093 | scrMenuMgr->addMenuItem(scrActions["itemMulDuplicate"], "Item"); |
||
1094 | scrMenuMgr->addMenuItem(scrActions["itemDelete"], "Item"); |
||
1095 | scrMenuMgr->addMenuSeparator("Item"); |
||
1096 | scrMenuMgr->addMenuItem(scrActions["itemGroup"], "Item"); |
||
1097 | scrMenuMgr->addMenuItem(scrActions["itemUngroup"], "Item"); |
||
1098 | scrMenuMgr->addMenuItem(scrActions["itemLock"], "Item"); |
||
1858 | cbradney | 1099 | scrMenuMgr->addMenuItem(scrActions["itemLockSize"], "Item"); |
2026 | cbradney | 1100 | scrMenuMgr->addMenuItem(scrActions["itemImageIsVisible"], "Item"); |
1236 | cbradney | 1101 | scrMenuMgr->addMenuSeparator("Item"); |
1858 | cbradney | 1102 | scrMenuMgr->createMenu("ItemLevel", tr("&Level")); |
1103 | scrMenuMgr->addMenuToMenu("ItemLevel", "Item"); |
||
1104 | scrMenuMgr->addMenuItem(scrActions["itemSendToBack"], "ItemLevel"); |
||
1105 | scrMenuMgr->addMenuItem(scrActions["itemBringToFront"], "ItemLevel"); |
||
1106 | scrMenuMgr->addMenuItem(scrActions["itemLower"], "ItemLevel"); |
||
1107 | scrMenuMgr->addMenuItem(scrActions["itemRaise"], "ItemLevel"); |
||
1236 | cbradney | 1108 | scrMenuMgr->addMenuItem(scrActions["itemAlignDist"], "Item"); |
1981 | cbradney | 1109 | scrMenuMgr->addMenuItem(scrActions["itemSendToScrapbook"], "Item"); |
1236 | cbradney | 1110 | scrMenuMgr->addMenuSeparator("Item"); |
1981 | cbradney | 1111 | scrMenuMgr->addMenuItem(scrActions["itemAttributes"], "ItemPDFOptions"); |
1112 | scrMenuMgr->createMenu("ItemPDFOptions", tr("&PDF Options")); |
||
1113 | scrMenuMgr->addMenuToMenu("ItemPDFOptions", "Item"); |
||
1114 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsBookmark"], "ItemPDFOptions"); |
||
1115 | scrMenuMgr->addMenuItem(scrActions["itemPDFIsAnnotation"], "ItemPDFOptions"); |
||
1116 | scrMenuMgr->addMenuItem(scrActions["itemPDFAnnotationProps"], "ItemPDFOptions"); |
||
1117 | scrMenuMgr->addMenuItem(scrActions["itemPDFFieldProps"], "ItemPDFOptions"); |
||
1236 | cbradney | 1118 | scrMenuMgr->createMenu("ItemShapes", tr("&Shape"), "Item"); |
1119 | // CB TODO |
||
1120 | //Shape menu |
||
169 | Franz | 1121 | SCustom = new Autoforms(0); |
1236 | cbradney | 1122 | scrMenuMgr->addMenuItem(SCustom, "ItemShapes"); |
272 | Franz | 1123 | connect(SCustom, SIGNAL(FormSel(int, int, double *)), this, SLOT(MakeFrame(int, int, double *))); |
1236 | cbradney | 1124 | scrMenuMgr->addMenuItem(scrActions["itemShapeEdit"], "ItemShapes"); |
1858 | cbradney | 1125 | scrMenuMgr->createMenu("ItemConvertTo", tr("C&onvert To")); |
1126 | scrMenuMgr->addMenuToMenu("ItemConvertTo", "Item"); |
||
1127 | scrMenuMgr->addMenuItem(scrActions["itemConvertToBezierCurve"], "ItemConvertTo"); |
||
1128 | scrMenuMgr->addMenuItem(scrActions["itemConvertToImageFrame"], "ItemConvertTo"); |
||
1129 | scrMenuMgr->addMenuItem(scrActions["itemConvertToOutlines"], "ItemConvertTo"); |
||
1130 | scrMenuMgr->addMenuItem(scrActions["itemConvertToPolygon"], "ItemConvertTo"); |
||
1131 | scrMenuMgr->addMenuItem(scrActions["itemConvertToTextFrame"], "ItemConvertTo"); |
||
1132 | |||
1236 | cbradney | 1133 | scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item"); |
1134 | scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item"); |
||
1135 | scrMenuMgr->addMenuItem(scrActions["itemCombinePolygons"], "Item"); |
||
1136 | scrMenuMgr->addMenuItem(scrActions["itemSplitPolygons"], "Item"); |
||
1137 | scrMenuMgr->setMenuEnabled("ItemShapes", false); |
||
1138 | scrActions["itemAlignDist"]->setEnabled(false); |
||
1139 | scrActions["itemGroup"]->setEnabled(false); |
||
1140 | scrActions["itemUngroup"]->setEnabled(false); |
||
1141 | scrActions["itemAttachTextToPath"]->setEnabled(false); |
||
1142 | scrActions["itemDetachTextFromPath"]->setEnabled(false); |
||
1143 | scrActions["itemCombinePolygons"]->setEnabled(false); |
||
1144 | scrActions["itemSplitPolygons"]->setEnabled(false); |
||
1145 | scrActions["itemLock"]->setEnabled(false); |
||
1858 | cbradney | 1146 | scrActions["itemLockSize"]->setEnabled(false); |
2026 | cbradney | 1147 | scrActions["itemImageIsVisible"]->setEnabled(false); |
1858 | cbradney | 1148 | scrMenuMgr->setMenuEnabled("ItemConvertTo", false); |
1149 | scrActions["itemConvertToBezierCurve"]->setEnabled(false); |
||
1150 | scrActions["itemConvertToImageFrame"]->setEnabled(false); |
||
1236 | cbradney | 1151 | scrActions["itemConvertToOutlines"]->setEnabled(false); |
1858 | cbradney | 1152 | scrActions["itemConvertToPolygon"]->setEnabled(false); |
1153 | scrActions["itemConvertToTextFrame"]->setEnabled(false); |
||
1485 | tsoots | 1154 | |
1801 | cbradney | 1155 | //Insert menu |
1156 | scrMenuMgr->createMenu("Insert", tr("I&nsert")); |
||
1157 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTextFrame"], "Insert"); |
||
1158 | scrMenuMgr->addMenuItem(scrActions["toolsInsertImageFrame"], "Insert"); |
||
1159 | scrMenuMgr->addMenuItem(scrActions["toolsInsertTableFrame"], "Insert"); |
||
1160 | scrMenuMgr->addMenuItem(scrActions["toolsInsertShape"], "Insert"); |
||
1161 | scrMenuMgr->addMenuItem(scrActions["toolsInsertPolygon"], "Insert"); |
||
1162 | scrMenuMgr->addMenuItem(scrActions["toolsInsertLine"], "Insert"); |
||
1163 | scrMenuMgr->addMenuItem(scrActions["toolsInsertBezier"], "Insert"); |
||
1164 | scrMenuMgr->addMenuItem(scrActions["toolsInsertFreehandLine"], "Insert"); |
||
1165 | scrMenuMgr->addMenuSeparator("Insert"); |
||
1903 | cbradney | 1166 | scrMenuMgr->addMenuItem(scrActions["insertGlyph"], "Insert"); |
1167 | |||
1168 | scrMenuMgr->createMenu("InsertChar", tr("Character")); |
||
1169 | scrMenuMgr->addMenuToMenu("InsertChar", "Insert"); |
||
1170 | scrMenuMgr->addMenuItem(scrActions["specialPageNumber"], "InsertChar"); |
||
1818 | cbradney | 1171 | scrMenuMgr->addMenuSeparator("Insert"); |
1903 | cbradney | 1172 | scrMenuMgr->addMenuItem(scrActions["specialSmartHyphen"], "InsertChar"); |
1173 | scrMenuMgr->addMenuItem(scrActions["specialCopyRight"], "InsertChar"); |
||
1174 | scrMenuMgr->addMenuItem(scrActions["specialRegdTM"], "InsertChar"); |
||
1175 | scrMenuMgr->addMenuItem(scrActions["specialTM"], "InsertChar"); |
||
1176 | scrMenuMgr->addMenuItem(scrActions["specialBullet"], "InsertChar"); |
||
1177 | scrMenuMgr->addMenuSeparator("InsertChar"); |
||
1178 | scrMenuMgr->addMenuItem(scrActions["specialDashEm"], "InsertChar"); |
||
1179 | scrMenuMgr->addMenuItem(scrActions["specialDashEn"], "InsertChar"); |
||
1180 | scrMenuMgr->addMenuItem(scrActions["specialDashFigure"], "InsertChar"); |
||
1181 | scrMenuMgr->addMenuItem(scrActions["specialDashQuotation"], "InsertChar"); |
||
1926 | cbradney | 1182 | scrMenuMgr->addMenuSeparator("InsertChar"); |
1183 | scrMenuMgr->addMenuItem(scrActions["specialQuoteDoubleLeft"], "InsertChar"); |
||
1184 | scrMenuMgr->addMenuItem(scrActions["specialQuoteDoubleRight"], "InsertChar"); |
||
1185 | scrMenuMgr->addMenuItem(scrActions["specialQuoteSingleLeft"], "InsertChar"); |
||
1186 | scrMenuMgr->addMenuItem(scrActions["specialQuoteSingleRight"], "InsertChar"); |
||
1903 | cbradney | 1187 | |
1188 | scrMenuMgr->createMenu("InsertSpace", tr("Space")); |
||
1189 | scrMenuMgr->addMenuToMenu("InsertSpace", "Insert"); |
||
1190 | scrMenuMgr->addMenuItem(scrActions["specialNonBreakingSpace"], "InsertSpace"); |
||
1191 | scrMenuMgr->addMenuSeparator("Insert"); |
||
1818 | cbradney | 1192 | scrMenuMgr->addMenuItem(scrActions["insertSampleText"], "Insert"); |
1903 | cbradney | 1193 | scrActions["insertGlyph"]->setEnabled(false); |
1801 | cbradney | 1194 | |
1236 | cbradney | 1195 | //Page menu |
1196 | scrMenuMgr->createMenu("Page", tr("&Page")); |
||
1197 | scrMenuMgr->addMenuItem(scrActions["pageInsert"], "Page"); |
||
1198 | scrMenuMgr->addMenuItem(scrActions["pageDelete"], "Page"); |
||
1199 | scrMenuMgr->addMenuItem(scrActions["pageCopy"], "Page"); |
||
1200 | scrMenuMgr->addMenuItem(scrActions["pageMove"], "Page"); |
||
1201 | scrMenuMgr->addMenuItem(scrActions["pageApplyTemplate"], "Page"); |
||
1202 | scrMenuMgr->addMenuItem(scrActions["pageManageGuides"], "Page"); |
||
1203 | scrActions["pageDelete"]->setEnabled(false); |
||
1204 | scrActions["pageMove"]->setEnabled(false); |
||
1485 | tsoots | 1205 | |
1236 | cbradney | 1206 | //View menu |
1246 | cbradney | 1207 | scrMenuMgr->createMenu("View", tr("&View")); |
1208 | scrMenuMgr->addMenuItem(scrActions["viewFitInWindow"], "View"); |
||
1209 | scrMenuMgr->addMenuItem(scrActions["viewFit50"], "View"); |
||
1210 | scrMenuMgr->addMenuItem(scrActions["viewFit75"], "View"); |
||
1211 | scrMenuMgr->addMenuItem(scrActions["viewFit100"], "View"); |
||
1212 | scrMenuMgr->addMenuItem(scrActions["viewFit200"], "View"); |
||
1213 | scrMenuMgr->addMenuItem(scrActions["viewFit20"], "View"); |
||
1214 | scrMenuMgr->addMenuSeparator("View"); |
||
1215 | scrMenuMgr->addMenuItem(scrActions["viewShowMargins"], "View"); |
||
1216 | scrMenuMgr->addMenuItem(scrActions["viewShowFrames"], "View"); |
||
1217 | scrMenuMgr->addMenuItem(scrActions["viewShowImages"], "View"); |
||
1218 | scrMenuMgr->addMenuItem(scrActions["viewShowGrid"], "View"); |
||
1219 | scrMenuMgr->addMenuItem(scrActions["viewShowGuides"], "View"); |
||
1334 | cbradney | 1220 | scrMenuMgr->addMenuItem(scrActions["viewShowBaseline"], "View"); |
1246 | cbradney | 1221 | scrMenuMgr->addMenuItem(scrActions["viewShowTextChain"], "View"); |
1222 | scrMenuMgr->addMenuSeparator("View"); |
||
1223 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "View"); |
||
1224 | scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "View"); |
||
1330 | fschmid | 1225 | // scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View"); |
1485 | tsoots | 1226 | |
1236 | cbradney | 1227 | //Tool menu |
1255 | cbradney | 1228 | scrMenuMgr->createMenu("Tools", tr("&Tools")); |
1229 | scrMenuMgr->addMenuItem(scrActions["toolsProperties"], "Tools"); |
||
1230 | scrMenuMgr->addMenuItem(scrActions["toolsOutline"], "Tools"); |
||
1231 | scrMenuMgr->addMenuItem(scrActions["toolsScrapbook"], "Tools"); |
||
1232 | scrMenuMgr->addMenuItem(scrActions["toolsLayers"], "Tools"); |
||
1233 | scrMenuMgr->addMenuItem(scrActions["toolsPages"], "Tools"); |
||
1234 | scrMenuMgr->addMenuItem(scrActions["toolsBookmarks"], "Tools"); |
||
1525 | cbradney | 1235 | scrMenuMgr->addMenuItem(scrActions["toolsMeasurements"], "Tools"); |
1255 | cbradney | 1236 | scrMenuMgr->addMenuItem(scrActions["toolsActionHistory"], "Tools"); |
1237 | scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Tools"); |
||
1238 | scrMenuMgr->addMenuSeparator("Tools"); |
||
1239 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Tools"); |
||
1485 | tsoots | 1240 | scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Tools"); |
1265 | cbradney | 1241 | //scrActions["toolsPreflightVerifier"]->setEnabled(false); |
1485 | tsoots | 1242 | |
1236 | cbradney | 1243 | //Extra menu |
1260 | cbradney | 1244 | scrMenuMgr->createMenu("Extras", tr("E&xtras")); |
1245 | scrMenuMgr->addMenuItem(scrActions["extrasManagePictures"], "Extras"); |
||
1246 | scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras"); |
||
1694 | cbradney | 1247 | scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras"); |
1248 | |||
1260 | cbradney | 1249 | scrMenuMgr->setMenuEnabled("Extras", false); |
1250 | scrActions["extrasHyphenateText"]->setEnabled(false); |
||
1485 | tsoots | 1251 | |
1236 | cbradney | 1252 | //Window menu |
1260 | cbradney | 1253 | scrMenuMgr->createMenu("Windows", tr("&Windows")); |
1254 | connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
||
1485 | tsoots | 1255 | |
1260 | cbradney | 1256 | //Help menu |
1269 | cbradney | 1257 | scrMenuMgr->createMenu("Help", tr("&Help")); |
1258 | scrMenuMgr->addMenuItem(scrActions["helpAboutScribus"], "Help"); |
||
1259 | scrMenuMgr->addMenuItem(scrActions["helpAboutQt"], "Help"); |
||
1260 | scrMenuMgr->addMenuSeparator("Help"); |
||
1261 | scrMenuMgr->addMenuItem(scrActions["helpTooltips"], "Help"); |
||
1262 | scrMenuMgr->addMenuItem(scrActions["helpManual"], "Help"); |
||
1485 | tsoots | 1263 | |
1208 | cbradney | 1264 | scrMenuMgr->addMenuToMenuBar("File"); |
1227 | cbradney | 1265 | scrMenuMgr->addMenuToMenuBar("Edit"); |
1325 | cbradney | 1266 | scrMenuMgr->addMenuToMenuBar("Style"); |
1267 | scrMenuMgr->setMenuEnabled("Style", false); |
||
1236 | cbradney | 1268 | scrMenuMgr->addMenuToMenuBar("Item"); |
1801 | cbradney | 1269 | scrMenuMgr->setMenuEnabled("Item", false); |
1270 | scrMenuMgr->addMenuToMenuBar("Insert"); |
||
1271 | scrMenuMgr->setMenuEnabled("Insert", false); |
||
1236 | cbradney | 1272 | scrMenuMgr->addMenuToMenuBar("Page"); |
1273 | scrMenuMgr->setMenuEnabled("Page", false); |
||
1246 | cbradney | 1274 | scrMenuMgr->addMenuToMenuBar("View"); |
1275 | scrMenuMgr->setMenuEnabled("View", false); |
||
1255 | cbradney | 1276 | scrMenuMgr->addMenuToMenuBar("Tools"); |
1260 | cbradney | 1277 | scrMenuMgr->addMenuToMenuBar("Extras"); |
1278 | scrMenuMgr->setMenuEnabled("Extras", false); |
||
1279 | scrMenuMgr->addMenuToMenuBar("Windows"); |
||
1280 | scrMenuMgr->setMenuEnabled("Windows", false); |
||
3 | paul | 1281 | menuBar()->insertSeparator(); |
1269 | cbradney | 1282 | scrMenuMgr->addMenuToMenuBar("Help"); |
1283 | |||
1236 | cbradney | 1284 | //Alignment menu |
1325 | cbradney | 1285 | scrMenuMgr->createMenu("Alignment", tr("&Alignment")); |
1337 | cbradney | 1286 | scrMenuMgr->addMenuItem(scrActions["alignLeft"], "Alignment"); |
1287 | scrMenuMgr->addMenuItem(scrActions["alignCenter"], "Alignment"); |
||
1288 | scrMenuMgr->addMenuItem(scrActions["alignRight"], "Alignment"); |
||
1289 | scrMenuMgr->addMenuItem(scrActions["alignBlock"], "Alignment"); |
||
1290 | scrMenuMgr->addMenuItem(scrActions["alignForced"], "Alignment"); |
||
1443 | tsoots | 1291 | |
801 | cbradney | 1292 | connect(ColorMenC, SIGNAL(activated(int)), this, SLOT(setItemFarbe(int))); |
1293 | connect(FontMenu, SIGNAL(activated(int)), this, SLOT(setItemFont(int))); |
||
3 | paul | 1294 | } |
1295 | |||
1296 | void ScribusApp::initStatusBar() |
||
1297 | { |
||
809 | cbradney | 1298 | FMess = new QLabel( " ", statusBar(), "ft"); |
3 | paul | 1299 | FProg = new QProgressBar(statusBar(), "p"); |
272 | Franz | 1300 | FProg->setCenterIndicator(true); |
3 | paul | 1301 | FProg->setFixedWidth( 100 ); |
809 | cbradney | 1302 | FProg->reset(); |
1303 | XMess = new QLabel( tr("X-Pos:"), statusBar(), "xt"); |
||
1304 | YMess = new QLabel( tr("Y-Pos:"), statusBar(), "yt"); |
||
1305 | XDat = new QLabel( " ", statusBar(), "dt"); |
||
1306 | YDat = new QLabel( " ", statusBar(), "ydt"); |
||
1307 | |||
1308 | statusBar()->addWidget(FMess, 3, true); |
||
3 | paul | 1309 | statusBar()->addWidget(FProg, 0, true); |
1310 | statusBar()->addWidget(XMess, 0, true); |
||
1311 | statusBar()->addWidget(XDat, 1, true); |
||
1312 | statusBar()->addWidget(YMess, 0, true); |
||
1313 | statusBar()->addWidget(YDat, 1, true); |
||
1314 | } |
||
1315 | |||
80 | Franz | 1316 | void ScribusApp::ReportMP(double xp, double yp) |
3 | paul | 1317 | { |
1065 | cbradney | 1318 | QString suffix=unitGetSuffixFromIndex(doc->docUnitIndex); |
1319 | int multiplier=unitGetDecimalsFromIndex(doc->docUnitIndex); |
||
806 | cbradney | 1320 | double divisor = static_cast<double>(multiplier); |
1065 | cbradney | 1321 | int precision=precision = unitGetPrecisionFromIndex(doc->docUnitIndex); |
809 | cbradney | 1322 | QString tmp; |
1843 | cbradney | 1323 | XDat->setText(tmp.setNum(qRound(xp*doc->unitRatio * multiplier) / divisor, 'f', precision) + suffix); |
1324 | YDat->setText(tmp.setNum(qRound(yp*doc->unitRatio * multiplier) / divisor, 'f', precision) + suffix); |
||
3 | paul | 1325 | } |
1326 | |||
1437 | cbradney | 1327 | void ScribusApp::SetKeyEntry(QString actName, QString cleanMenuText, QString keyseq, int rowNumber) |
3 | paul | 1328 | { |
1329 | Keys ke; |
||
1230 | cbradney | 1330 | if (actName!="") |
1331 | { |
||
1332 | if (scrActions[actName]) |
||
1392 | cbradney | 1333 | { |
1230 | cbradney | 1334 | ke.actionName=actName; |
1392 | cbradney | 1335 | ke.keySequence = keyseq; |
1336 | ke.cleanMenuText=cleanMenuText; |
||
1437 | cbradney | 1337 | ke.tableRow=rowNumber; |
1392 | cbradney | 1338 | Prefs.KeyActions.insert(actName, ke); |
1339 | } |
||
1230 | cbradney | 1340 | else |
1748 | craig | 1341 | qDebug("%s", QString("Action Name: %1 does not exist").arg(actName).ascii()); |
1230 | cbradney | 1342 | } |
3 | paul | 1343 | } |
1344 | |||
1957 | cbradney | 1345 | void ScribusApp::DeleteSel(PageItem *currItem) |
3 | paul | 1346 | { |
238 | Franz | 1347 | int FirstSel = 0; |
1348 | bool first = false; |
||
1957 | cbradney | 1349 | for (ScText *it = currItem->itemText.first(); it != 0; it = currItem->itemText.next()) |
272 | Franz | 1350 | { |
1351 | if (it->cselect) |
||
1352 | { |
||
238 | Franz | 1353 | first = true; |
1957 | cbradney | 1354 | currItem->itemText.remove(); |
1355 | it = currItem->itemText.prev(); |
||
272 | Franz | 1356 | if (it == 0) |
1957 | cbradney | 1357 | it = currItem->itemText.first(); |
272 | Franz | 1358 | } |
238 | Franz | 1359 | if (!first) |
1360 | FirstSel++; |
||
272 | Franz | 1361 | } |
1957 | cbradney | 1362 | if (currItem->itemText.count() != 0) |
238 | Franz | 1363 | { |
1957 | cbradney | 1364 | if (currItem->itemText.first()->cselect) |
3 | paul | 1365 | { |
1957 | cbradney | 1366 | currItem->itemText.remove(); |
1367 | currItem->CPos = 0; |
||
238 | Franz | 1368 | } |
3 | paul | 1369 | else |
1957 | cbradney | 1370 | currItem->CPos = FirstSel; |
238 | Franz | 1371 | } |
3 | paul | 1372 | else |
1957 | cbradney | 1373 | currItem->CPos = 0; |
1374 | currItem->HasSel = false; |
||
272 | Franz | 1375 | DisableTxEdit(); |
3 | paul | 1376 | } |
1377 | |||
1957 | cbradney | 1378 | void ScribusApp::setTBvals(PageItem *currItem) |
3 | paul | 1379 | { |
1957 | cbradney | 1380 | if (currItem->itemText.count() != 0) |
272 | Franz | 1381 | { |
1957 | cbradney | 1382 | int ChPos = QMIN(currItem->CPos, static_cast<int>(currItem->itemText.count()-1)); |
1383 | doc->CurrentStyle = currItem->itemText.at(ChPos)->cstyle & 127; |
||
1384 | doc->currentParaStyle = currItem->itemText.at(ChPos)->cab; |
||
1065 | cbradney | 1385 | setAbsValue(doc->currentParaStyle); |
1545 | cbradney | 1386 | propertiesPalette->setAli(doc->currentParaStyle); |
1957 | cbradney | 1387 | doc->CurrFont = currItem->itemText.at(ChPos)->cfont->SCName; |
1388 | doc->CurrFontSize = currItem->itemText.at(ChPos)->csize; |
||
1389 | doc->CurrTextFill = currItem->itemText.at(ChPos)->ccolor; |
||
1390 | doc->CurrTextFillSh = currItem->itemText.at(ChPos)->cshade; |
||
1391 | doc->CurrTextStroke = currItem->itemText.at(ChPos)->cstroke; |
||
1392 | doc->CurrTextStrokeSh = currItem->itemText.at(ChPos)->cshade2; |
||
1393 | doc->CurrTextScale = currItem->itemText.at(ChPos)->cscale; |
||
68 | Franz | 1394 | emit TextFarben(doc->CurrTextStroke, doc->CurrTextFill, doc->CurrTextStrokeSh, doc->CurrTextFillSh); |
1395 | emit TextIFont(doc->CurrFont); |
||
272 | Franz | 1396 | emit TextISize(doc->CurrFontSize); |
1957 | cbradney | 1397 | emit TextUSval(currItem->itemText.at(ChPos)->cextra); |
272 | Franz | 1398 | emit TextStil(doc->CurrentStyle); |
68 | Franz | 1399 | emit TextScale(doc->CurrTextScale); |
272 | Franz | 1400 | } |
3 | paul | 1401 | } |
1402 | |||
1403 | void ScribusApp::wheelEvent(QWheelEvent *w) |
||
1404 | { |
||
1405 | if (HaveDoc) |
||
239 | Franz | 1406 | { |
276 | Franz | 1407 | if ((w->orientation() != Qt::Vertical) || ( w->state() & ShiftButton )) |
3 | paul | 1408 | { |
239 | Franz | 1409 | if (w->delta() < 0) |
240 | Franz | 1410 | view->scrollBy(Prefs.Wheelval, 0); |
239 | Franz | 1411 | else |
240 | Franz | 1412 | view->scrollBy(-Prefs.Wheelval, 0); |
239 | Franz | 1413 | } |
3 | paul | 1414 | else |
239 | Franz | 1415 | { |
1416 | if (w->delta() < 0) |
||
240 | Franz | 1417 | view->scrollBy(0, Prefs.Wheelval); |
239 | Franz | 1418 | else |
240 | Franz | 1419 | view->scrollBy(0, -Prefs.Wheelval); |
239 | Franz | 1420 | } |
3 | paul | 1421 | w->accept(); |
239 | Franz | 1422 | } |
3 | paul | 1423 | } |
1424 | |||
1485 | tsoots | 1425 | //Special keys assigned to actions are stolen by the action and not passed to |
1445 | cbradney | 1426 | //keyPressEvent so process them here. |
1903 | cbradney | 1427 | void ScribusApp::specialActionKeyEvent(QString actionName, int unicodevalue) |
1445 | cbradney | 1428 | { |
1429 | if (HaveDoc) |
||
1430 | { |
||
1431 | if (doc->appMode==EditMode) |
||
1432 | { |
||
1433 | if (view->SelItem.count() == 1) |
||
1434 | { |
||
1435 | struct ScText *hg = new ScText; |
||
1957 | cbradney | 1436 | PageItem *currItem = view->SelItem.at(0); |
1903 | cbradney | 1437 | if (unicodevalue!=-1) |
1445 | cbradney | 1438 | { |
1903 | cbradney | 1439 | hg->ch = QString(QChar(unicodevalue)); |
1789 | fschmid | 1440 | hg->cfont = (*doc->AllFonts)[doc->CurrFont]; |
1445 | cbradney | 1441 | hg->csize = doc->CurrFontSize; |
1442 | hg->ccolor = doc->CurrTextFill; |
||
1443 | hg->cshade = doc->CurrTextFillSh; |
||
1444 | hg->cstroke = doc->CurrTextStroke; |
||
1445 | hg->cshade2 = doc->CurrTextStrokeSh; |
||
1446 | hg->cscale = doc->CurrTextScale; |
||
1447 | hg->cselect = false; |
||
1448 | hg->cstyle = doc->CurrentStyle; |
||
1449 | hg->cab = doc->currentParaStyle; |
||
1450 | if (doc->docParagraphStyles[doc->currentParaStyle].Font != "") |
||
1451 | { |
||
1789 | fschmid | 1452 | hg->cfont = (*doc->AllFonts)[doc->docParagraphStyles[doc->currentParaStyle].Font]; |
1445 | cbradney | 1453 | hg->csize = doc->docParagraphStyles[doc->currentParaStyle].FontSize; |
1454 | } |
||
1455 | hg->cextra = 0; |
||
1456 | hg->xp = 0; |
||
1457 | hg->yp = 0; |
||
1458 | hg->PRot = 0; |
||
1459 | hg->PtransX = 0; |
||
1460 | hg->PtransY = 0; |
||
1957 | cbradney | 1461 | currItem->itemText.insert(currItem->CPos, hg); |
1462 | currItem->CPos += 1; |
||
1463 | currItem->Tinput = true; |
||
1464 | view->RefreshItem(currItem); |
||
1445 | cbradney | 1465 | } |
1903 | cbradney | 1466 | else if (actionName=="specialSmartHyphen") //ignore the char as we use an attribute if the text item, for now. |
1445 | cbradney | 1467 | { |
1957 | cbradney | 1468 | currItem->itemText.at(QMAX(currItem->CPos-1,0))->cstyle ^= 128; |
1469 | currItem->Tinput = true; |
||
1470 | view->RefreshItem(currItem); |
||
1485 | tsoots | 1471 | } |
1445 | cbradney | 1472 | } |
1473 | } |
||
1474 | } |
||
1475 | } |
||
1476 | |||
1493 | cbradney | 1477 | /*! |
1478 | \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. |
||
1479 | */ |
||
1525 | cbradney | 1480 | bool ScribusApp::eventFilter( QObject */*o*/, QEvent *e ) |
1493 | cbradney | 1481 | { |
1525 | cbradney | 1482 | bool retVal; |
1493 | cbradney | 1483 | if ( e->type() == QEvent::KeyPress ) { |
1484 | QKeyEvent *k = (QKeyEvent *)e; |
||
1485 | int keyMod; |
||
1486 | switch (k->state()) |
||
1487 | { |
||
1488 | case ShiftButton: |
||
1489 | keyMod = SHIFT; |
||
1490 | break; |
||
1491 | case AltButton: |
||
1492 | keyMod = ALT; |
||
1493 | break; |
||
1494 | case ControlButton: |
||
1495 | keyMod = CTRL; |
||
1496 | break; |
||
1497 | default: |
||
1498 | keyMod = 0; |
||
1499 | break; |
||
1500 | } |
||
1501 | QKeySequence currKeySeq = QKeySequence(k->key() | keyMod); |
||
1525 | cbradney | 1502 | retVal=true; |
1493 | cbradney | 1503 | if (currKeySeq == scrActions["specialToggleAllPalettes"]->accel()) |
1504 | scrActions["specialToggleAllPalettes"]->activate(); |
||
1505 | else |
||
1506 | if (currKeySeq == scrActions["toolsProperties"]->accel()) |
||
1507 | scrActions["toolsProperties"]->toggle(); |
||
1508 | else |
||
1509 | if (currKeySeq == scrActions["toolsOutline"]->accel()) |
||
1510 | scrActions["toolsOutline"]->toggle(); |
||
1511 | else |
||
1512 | if (currKeySeq == scrActions["toolsScrapbook"]->accel()) |
||
1513 | scrActions["toolsScrapbook"]->toggle(); |
||
1514 | else |
||
1515 | if (currKeySeq == scrActions["toolsLayers"]->accel()) |
||
1516 | scrActions["toolsLayers"]->toggle(); |
||
1517 | else |
||
1518 | if (currKeySeq == scrActions["toolsPages"]->accel()) |
||
1519 | scrActions["toolsPages"]->toggle(); |
||
1520 | else |
||
1521 | if (currKeySeq == scrActions["toolsBookmarks"]->accel()) |
||
1522 | scrActions["toolsBookmarks"]->toggle(); |
||
1523 | else |
||
1524 | if (currKeySeq == scrActions["toolsActionHistory"]->accel()) |
||
1525 | scrActions["toolsActionHistory"]->toggle(); |
||
1526 | else |
||
1527 | if (currKeySeq == scrActions["toolsPreflightVerifier"]->accel()) |
||
1528 | scrActions["toolsPreflightVerifier"]->toggle(); |
||
1525 | cbradney | 1529 | else |
1565 | cbradney | 1530 | if (currKeySeq == scrActions["fileQuit"]->accel()) |
1531 | scrActions["fileQuit"]->activate(); |
||
1532 | else |
||
1525 | cbradney | 1533 | retVal=false; |
1493 | cbradney | 1534 | } |
1525 | cbradney | 1535 | else |
1536 | retVal=false; |
||
1493 | cbradney | 1537 | //Return false to pass event to object |
1538 | return retVal; |
||
1539 | } |
||
1540 | |||
3 | paul | 1541 | void ScribusApp::keyPressEvent(QKeyEvent *k) |
1542 | { |
||
146 | Franz | 1543 | QWidgetList windows; |
237 | Franz | 1544 | QWidget* w = NULL; |
1065 | cbradney | 1545 | struct ScText *hg; |
3 | paul | 1546 | int kk = k->key(); |
1547 | int as = k->ascii(); |
||
80 | Franz | 1548 | double altx, alty; |
3 | paul | 1549 | QString uc = k->text(); |
1550 | QString cr, Tcha, Twort; |
||
1551 | uint Tcoun; |
||
237 | Franz | 1552 | int len, pos, c; |
92 | Franz | 1553 | if (keyrep) |
1554 | return; |
||
1555 | keyrep = true; |
||
3 | paul | 1556 | switch (k->state()) |
272 | Franz | 1557 | { |
1558 | case ShiftButton: |
||
1554 | cbradney | 1559 | KeyMod = SHIFT; |
272 | Franz | 1560 | break; |
1561 | case AltButton: |
||
1554 | cbradney | 1562 | KeyMod = ALT; |
272 | Franz | 1563 | break; |
1564 | case ControlButton: |
||
1554 | cbradney | 1565 | KeyMod = CTRL; |
272 | Franz | 1566 | break; |
1567 | default: |
||
1568 | KeyMod = 0; |
||
1569 | break; |
||
1570 | } |
||
292 | Franz | 1571 | if ((kk == Key_Escape) && (HaveDoc)) |
1572 | { |
||
1573 | keyrep = false; |
||
1957 | cbradney | 1574 | PageItem *currItem; |
855 | fschmid | 1575 | if ((view->SelItem.count() != 0)) |
1576 | { |
||
1957 | cbradney | 1577 | currItem = view->SelItem.at(0); |
1065 | cbradney | 1578 | switch (doc->appMode) |
855 | fschmid | 1579 | { |
1065 | cbradney | 1580 | case NormalMode: |
1957 | cbradney | 1581 | currItem->Sizing = false; |
855 | fschmid | 1582 | if (doc->SubMode != -1) |
1583 | { |
||
1584 | view->Deselect(false); |
||
1957 | cbradney | 1585 | doc->Items.remove(currItem->ItemNr); |
855 | fschmid | 1586 | } |
1587 | break; |
||
1229 | fschmid | 1588 | case LinkFrames: |
1589 | case UnlinkFrames: |
||
1065 | cbradney | 1590 | case EditMode: |
1827 | fschmid | 1591 | case Rotation: |
1592 | view->Deselect(false); |
||
1593 | case PanningMode: |
||
855 | fschmid | 1594 | break; |
1065 | cbradney | 1595 | case DrawBezierLine: |
1957 | cbradney | 1596 | currItem->PoLine.resize(currItem->PoLine.size()-2); |
1597 | if (currItem->PoLine.size() < 4) |
||
855 | fschmid | 1598 | { |
1599 | view->Deselect(false); |
||
1957 | cbradney | 1600 | doc->Items.remove(currItem->ItemNr); |
855 | fschmid | 1601 | } |
1602 | else |
||
1603 | { |
||
1957 | cbradney | 1604 | view->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false); |
1605 | view->SetPolyClip(currItem, qRound(QMAX(currItem->Pwidth / 2, 1))); |
||
1606 | view->AdjustItemSize(currItem); |
||
1607 | currItem->ContourLine = currItem->PoLine.copy(); |
||
1608 | currItem->ClipEdited = true; |
||
1609 | currItem->FrameType = 3; |
||
855 | fschmid | 1610 | slotDocCh(); |
1611 | } |
||
1612 | view->FirstPoly = true; |
||
1613 | break; |
||
1614 | default: |
||
1615 | view->Deselect(false); |
||
1957 | cbradney | 1616 | doc->Items.remove(currItem->ItemNr); |
855 | fschmid | 1617 | break; |
1618 | } |
||
1619 | } |
||
1620 | view->Mpressed = false; |
||
1621 | doc->DragP = false; |
||
1622 | doc->leaveDrag = false; |
||
1623 | view->Imoved = false; |
||
1624 | view->mCG = false; |
||
1625 | view->MidButt = false; |
||
1626 | doc->SubMode = -1; |
||
1827 | fschmid | 1627 | doc->ElemToLink = NULL; |
292 | Franz | 1628 | NoFrameEdit(); |
1629 | slotSelect(); |
||
1630 | return; |
||
1631 | } |
||
232 | Franz | 1632 | ButtonState buttonState = k->state(); |
272 | Franz | 1633 | if ((HaveDoc) && (!view->LE->hasFocus()) && (!view->PGS->PageCombo->hasFocus())) |
1634 | { |
||
1065 | cbradney | 1635 | if ((doc->appMode != EditMode) && (view->SelItem.count() == 0)) |
272 | Franz | 1636 | { |
1637 | switch (kk) |
||
146 | Franz | 1638 | { |
272 | Franz | 1639 | case Key_Space: |
1640 | keyrep = false; |
||
1065 | cbradney | 1641 | if (doc->appMode == PanningMode) |
1642 | setAppMode(NormalMode); |
||
272 | Franz | 1643 | else |
1644 | { |
||
1065 | cbradney | 1645 | setAppMode(PanningMode); |
272 | Franz | 1646 | qApp->setOverrideCursor(QCursor(loadIcon("HandC.xpm")), true); |
1647 | } |
||
1648 | return; |
||
1649 | break; |
||
1650 | case Key_Prior: |
||
1651 | view->scrollBy(0, -Prefs.Wheelval); |
||
1652 | keyrep = false; |
||
1653 | return; |
||
1654 | break; |
||
1655 | case Key_Next: |
||
1656 | view->scrollBy(0, Prefs.Wheelval); |
||
1657 | keyrep = false; |
||
1658 | return; |
||
1659 | break; |
||
1660 | case Key_Tab: |
||
1661 | keyrep = false; |
||
1662 | windows = wsp->windowList(); |
||
1663 | if (windows.count() > 1) |
||
1664 | { |
||
1665 | for (int i = 0; i < static_cast<int>(windows.count()); ++i) |
||
250 | Franz | 1666 | { |
272 | Franz | 1667 | if (wsp->activeWindow() == windows.at(i)) |
1668 | { |
||
1669 | if (i == static_cast<int>(windows.count()-1)) |
||
1670 | w = windows.at(0); |
||
1671 | else |
||
1672 | w = windows.at(i+1); |
||
1673 | break; |
||
1674 | } |
||
250 | Franz | 1675 | } |
1545 | cbradney | 1676 | doc->OpenNodes = outlinePalette->buildReopenVals(); |
1677 | docCheckerPalette->clearErrorList(); |
||
272 | Franz | 1678 | if ( w ) |
1679 | w->showNormal(); |
||
1680 | newActWin(w); |
||
1681 | } |
||
1682 | return; |
||
1683 | break; |
||
1684 | } |
||
1685 | } |
||
456 | fschmid | 1686 | if (view->SelItem.count() != 0) |
272 | Franz | 1687 | { |
1957 | cbradney | 1688 | PageItem *currItem = view->SelItem.at(0); |
1596 | subik | 1689 | |
1065 | cbradney | 1690 | switch (doc->appMode) |
272 | Franz | 1691 | { |
1065 | cbradney | 1692 | case NormalMode: |
272 | Franz | 1693 | switch (kk) |
1694 | { |
||
360 | Franz | 1695 | case Key_Backspace: |
272 | Franz | 1696 | case Key_Delete: |
1697 | if (!doc->EditClip) |
||
997 | fschmid | 1698 | view->DeleteItem(); |
272 | Franz | 1699 | break; |
360 | Franz | 1700 | case Key_Prior: |
1957 | cbradney | 1701 | if (!currItem->locked()) |
456 | fschmid | 1702 | view->RaiseItem(); |
360 | Franz | 1703 | break; |
1704 | case Key_Next: |
||
1957 | cbradney | 1705 | if (!currItem->locked()) |
456 | fschmid | 1706 | view->LowerItem(); |
360 | Franz | 1707 | break; |
272 | Franz | 1708 | case Key_Left: |
1957 | cbradney | 1709 | if (!currItem->locked()) |
272 | Franz | 1710 | { |
1711 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1712 | view->moveGroup(-10, 0); |
272 | Franz | 1713 | else if ( buttonState & ControlButton ) |
456 | fschmid | 1714 | view->moveGroup(-0.1, 0); |
272 | Franz | 1715 | else |
456 | fschmid | 1716 | view->moveGroup(-1, 0); |
272 | Franz | 1717 | } |
1718 | break; |
||
1719 | case Key_Right: |
||
1957 | cbradney | 1720 | if (!currItem->locked()) |
272 | Franz | 1721 | { |
1722 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1723 | view->moveGroup(10, 0); |
272 | Franz | 1724 | else if ( buttonState & ControlButton ) |
456 | fschmid | 1725 | view->moveGroup(0.1, 0); |
272 | Franz | 1726 | else |
456 | fschmid | 1727 | view->moveGroup(1, 0); |
272 | Franz | 1728 | } |
1729 | break; |
||
1730 | case Key_Up: |
||
1957 | cbradney | 1731 | if (!currItem->locked()) |
272 | Franz | 1732 | { |
1733 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1734 | view->moveGroup(0, -10); |
272 | Franz | 1735 | else if ( buttonState & ControlButton ) |
456 | fschmid | 1736 | view->moveGroup(0, -0.1); |
272 | Franz | 1737 | else |
456 | fschmid | 1738 | view->moveGroup(0, -1); |
272 | Franz | 1739 | } |
1740 | break; |
||
1741 | case Key_Down: |
||
1957 | cbradney | 1742 | if (!currItem->locked()) |
272 | Franz | 1743 | { |
1744 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1745 | view->moveGroup(0, 10); |
272 | Franz | 1746 | else if ( buttonState & ControlButton ) |
456 | fschmid | 1747 | view->moveGroup(0, 0.1); |
272 | Franz | 1748 | else |
456 | fschmid | 1749 | view->moveGroup(0, 1); |
272 | Franz | 1750 | } |
1751 | break; |
||
1752 | default: |
||
1753 | break; |
||
1754 | } |
||
1755 | slotDocCh(); |
||
1756 | break; |
||
1065 | cbradney | 1757 | case EditMode: |
1957 | cbradney | 1758 | int oldPos = currItem->CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key |
1759 | view->oldCp = currItem->CPos; |
||
1760 | if (currItem->itemType() == PageItem::ImageFrame) |
||
1298 | fschmid | 1761 | { |
1762 | switch (kk) |
||
1763 | { |
||
1764 | case Key_Left: |
||
1957 | cbradney | 1765 | if (!currItem->locked()) |
1298 | fschmid | 1766 | { |
1767 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1768 | view->MoveItemI(-10, 0, currItem->ItemNr, true); |
1298 | fschmid | 1769 | else if ( buttonState & ControlButton ) |
1957 | cbradney | 1770 | view->MoveItemI(-0.1, 0, currItem->ItemNr, true); |
1298 | fschmid | 1771 | else |
1957 | cbradney | 1772 | view->MoveItemI(-1, 0, currItem->ItemNr, true); |
1298 | fschmid | 1773 | } |
1774 | break; |
||
1775 | case Key_Right: |
||
1957 | cbradney | 1776 | if (!currItem->locked()) |
1298 | fschmid | 1777 | { |
1778 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1779 | view->MoveItemI(10, 0, currItem->ItemNr, true); |
1298 | fschmid | 1780 | else if ( buttonState & ControlButton ) |
1957 | cbradney | 1781 | view->MoveItemI(0.1, 0, currItem->ItemNr, true); |
1298 | fschmid | 1782 | else |
1957 | cbradney | 1783 | view->MoveItemI(1, 0, currItem->ItemNr, true); |
1298 | fschmid | 1784 | } |
1785 | break; |
||
1786 | case Key_Up: |
||
1957 | cbradney | 1787 | if (!currItem->locked()) |
1298 | fschmid | 1788 | { |
1789 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1790 | view->MoveItemI(0, -10, currItem->ItemNr, true); |
1298 | fschmid | 1791 | else if ( buttonState & ControlButton ) |
1957 | cbradney | 1792 | view->MoveItemI(0, -0.1, currItem->ItemNr, true); |
1298 | fschmid | 1793 | else |
1957 | cbradney | 1794 | view->MoveItemI(0, -1, currItem->ItemNr, true); |
1298 | fschmid | 1795 | } |
1796 | break; |
||
1797 | case Key_Down: |
||
1957 | cbradney | 1798 | if (!currItem->locked()) |
1298 | fschmid | 1799 | { |
1800 | if ( buttonState & ShiftButton ) |
||
1957 | cbradney | 1801 | view->MoveItemI(0, 10, currItem->ItemNr, true); |
1298 | fschmid | 1802 | else if ( buttonState & ControlButton ) |
1957 | cbradney | 1803 | view->MoveItemI(0, 0.1, currItem->ItemNr, true); |
1298 | fschmid | 1804 | else |
1957 | cbradney | 1805 | view->MoveItemI(0, 1, currItem->ItemNr, true); |
1298 | fschmid | 1806 | } |
1807 | break; |
||
1808 | } |
||
1809 | } |
||
1957 | cbradney | 1810 | if (currItem->itemType() == PageItem::TextFrame) |
272 | Franz | 1811 | { |
456 | fschmid | 1812 | view->slotDoCurs(false); |
272 | Franz | 1813 | switch (kk) |
1814 | { |
||
1815 | case Key_Prior: |
||
1816 | case Key_Next: |
||
1817 | case Key_End: |
||
1818 | case Key_Home: |
||
1819 | case Key_Right: |
||
1820 | case Key_Left: |
||
1821 | case Key_Up: |
||
1822 | case Key_Down: |
||
1823 | if ( (buttonState & ShiftButton) == 0 ) |
||
1957 | cbradney | 1824 | view->deselectAll(currItem); |
272 | Franz | 1825 | } |
1903 | cbradney | 1826 | /* ISO 14755 |
1827 | if ((buttonState & ControlButton) && (buttonState & ShiftButton)) |
||
1828 | { |
||
1829 | if (!UniCinp) |
||
1830 | { |
||
1831 | UniCinp=true; |
||
1832 | UniCinC = 0; |
||
1833 | UniCinS = ""; |
||
1834 | keyrep = false; |
||
1835 | } |
||
1836 | qDebug(QString("%1 %2 %3 %4 %5").arg("uni").arg("c+s").arg(uc).arg(kk).arg(as)); |
||
1837 | } |
||
1838 | */ |
||
272 | Franz | 1839 | if (UniCinp) |
1840 | { |
||
1841 | int conv = 0; |
||
1842 | bool ok = false; |
||
1843 | UniCinS += uc; |
||
1844 | conv = UniCinS.toInt(&ok, 16); |
||
1845 | if (!ok) |
||
1846 | { |
||
1847 | UniCinp = false; |
||
1848 | UniCinC = 0; |
||
1849 | UniCinS = ""; |
||
1850 | keyrep = false; |
||
1851 | return; |
||
1852 | } |
||
1853 | UniCinC++; |
||
1854 | if (UniCinC == 4) |
||
1855 | { |
||
1856 | UniCinp = false; |
||
1857 | UniCinC = 0; |
||
1858 | UniCinS = ""; |
||
1859 | if (ok) |
||
146 | Franz | 1860 | { |
1957 | cbradney | 1861 | if (currItem->HasSel) |
1862 | DeleteSel(currItem); |
||
272 | Franz | 1863 | if (conv < 31) |
1864 | conv = 32; |
||
1065 | cbradney | 1865 | hg = new ScText; |
272 | Franz | 1866 | hg->ch = QString(QChar(conv)); |
1789 | fschmid | 1867 | hg->cfont = (*doc->AllFonts)[doc->CurrFont]; |
272 | Franz | 1868 | hg->csize = doc->CurrFontSize; |
1869 | hg->ccolor = doc->CurrTextFill; |
||
1870 | hg->cshade = doc->CurrTextFillSh; |
||
1871 | hg->cstroke = doc->CurrTextStroke; |
||
1872 | hg->cshade2 = doc->CurrTextStrokeSh; |
||
1873 | hg->cscale = doc->CurrTextScale; |
||
1874 | hg->cselect = false; |
||
1875 | hg->cstyle = doc->CurrentStyle; |
||
1065 | cbradney | 1876 | hg->cab = doc->currentParaStyle; |
1877 | if (doc->docParagraphStyles[doc->currentParaStyle].Font != "") |
||
146 | Franz | 1878 | { |
1789 | fschmid | 1879 | hg->cfont = (*doc->AllFonts)[doc->docParagraphStyles[doc->currentParaStyle].Font]; |
1065 | cbradney | 1880 | hg->csize = doc->docParagraphStyles[doc->currentParaStyle].FontSize; |
146 | Franz | 1881 | } |
272 | Franz | 1882 | hg->cextra = 0; |
1883 | hg->xp = 0; |
||
1884 | hg->yp = 0; |
||
1885 | hg->PRot = 0; |
||
1886 | hg->PtransX = 0; |
||
1887 | hg->PtransY = 0; |
||
1957 | cbradney | 1888 | currItem->itemText.insert(currItem->CPos, hg); |
1889 | currItem->CPos += 1; |
||
1890 | currItem->Tinput = true; |
||
1891 | setTBvals(currItem); |
||
1892 | view->RefreshItem(currItem); |
||
272 | Franz | 1893 | keyrep = false; |
1894 | return; |
||
146 | Franz | 1895 | } |
1896 | } |
||
272 | Franz | 1897 | else |
1898 | { |
||
1899 | keyrep = false; |
||
1900 | return; |
||
1901 | } |
||
1902 | } |
||
1903 | switch (kk) |
||
1904 | { |
||
1905 | case Key_F12: |
||
1906 | UniCinp = true; |
||
1907 | UniCinC = 0; |
||
1908 | UniCinS = ""; |
||
1909 | keyrep = false; |
||
1910 | return; |
||
1911 | break; |
||
291 | Franz | 1912 | case Key_Home: |
272 | Franz | 1913 | // go to begin of line |
1957 | cbradney | 1914 | if ( (pos = currItem->CPos) == 0 ) |
272 | Franz | 1915 | break; // at begin of frame |
1957 | cbradney | 1916 | len = static_cast<int>(currItem->itemText.count()); |
272 | Franz | 1917 | if ( pos == len ) |
1918 | pos--; |
||
1919 | if ( (buttonState & ControlButton) == 0 ) |
||
1920 | { |
||
1957 | cbradney | 1921 | alty = currItem->itemText.at(pos)->yp; |
1922 | c = currItem->itemText.at(pos)->ch.at(0).latin1(); |
||
272 | Franz | 1923 | if ( c == 13 ) // new line, position is wrong |
1924 | if ( --pos > 0 ) |
||
1957 | cbradney | 1925 | alty = currItem->itemText.at(pos)->yp; |
272 | Franz | 1926 | // check for yp at actual position |
1927 | if ( pos < len ) |
||
1928 | { |
||
1957 | cbradney | 1929 | altx = currItem->itemText.at(pos)->yp; |
272 | Franz | 1930 | if ( altx > alty ) |
3 | paul | 1931 | { |
272 | Franz | 1932 | // we was at begin of line |
1933 | break; |
||
3 | paul | 1934 | } |
272 | Franz | 1935 | } |
1957 | cbradney | 1936 | while ( pos > 0 && currItem->itemText.at(pos-1)->yp == alty ) |
272 | Franz | 1937 | pos--; |
1957 | cbradney | 1938 | if ( currItem->itemText.at(pos)->ch.at(0).latin1() == 13 ) |
272 | Franz | 1939 | pos++; |
1940 | } |
||
1941 | else |
||
1942 | { |
||
1943 | // paragraph begin |
||
1944 | if ( pos < len && |
||
1957 | cbradney | 1945 | currItem->itemText.at(pos)->ch.at(0).latin1() == 13 ) |
272 | Franz | 1946 | pos--; |
1947 | while(pos > 0 ) |
||
1957 | cbradney | 1948 | if ( currItem->itemText.at(pos)->ch.at(0).latin1() == 13 ) |
3 | paul | 1949 | { |
272 | Franz | 1950 | pos++; |
1951 | break; |
||
3 | paul | 1952 | } |
272 | Franz | 1953 | else |
1954 | pos--; |
||
1955 | } |
||
1957 | cbradney | 1956 | currItem->CPos = pos; |
272 | Franz | 1957 | if ( buttonState & ShiftButton ) |
1957 | cbradney | 1958 | view->ExpandSel(currItem, -1, oldPos); |
272 | Franz | 1959 | break |