Rev 701 | Rev 705 | 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> |
||
30 | #include <cstdio> |
||
31 | #include <cstdlib> |
||
391 | Franz | 32 | #include <cmath> |
3 | paul | 33 | #include <dlfcn.h> |
135 | Franz | 34 | #include <unistd.h> |
3 | paul | 35 | #include <iostream> |
119 | Franz | 36 | #include <signal.h> |
80 | Franz | 37 | #include <string> |
3 | paul | 38 | #include "scribus.h" |
39 | #include "scribus.moc" |
||
40 | #include "newfile.h" |
||
41 | #include "page.h" |
||
42 | #include "query.h" |
||
43 | #include "mdup.h" |
||
44 | #include "docinfo.h" |
||
45 | #include "reformdoc.h" |
||
46 | #include "serializer.h" |
||
47 | #include "align.h" |
||
48 | #include "fmitem.h" |
||
49 | #include "fontprefs.h" |
||
50 | #include "libprefs/prefs.h" |
||
51 | #include "pdfopts.h" |
||
52 | #include "inspage.h" |
||
53 | #include "delpages.h" |
||
54 | #include "movepage.h" |
||
55 | #include "helpbrowser.h" |
||
56 | #include "scribusXml.h" |
||
57 | #include "libabout/about.h" |
||
58 | #include "druck.h" |
||
59 | #include "editformats.h" |
||
60 | #include "muster.h" |
||
61 | #include "applytemplate.h" |
||
62 | #include "picstatus.h" |
||
63 | #include "customfdialog.h" |
||
64 | #include "cmsprefs.h" |
||
65 | #include "annot.h" |
||
66 | #include "annota.h" |
||
67 | #include "javadocs.h" |
||
151 | Franz | 68 | #include "colorm.h" |
265 | Franz | 69 | #include "mpalette.h" |
284 | Franz | 70 | #include "measurements.h" |
364 | Franz | 71 | #include "gtgettext.h" |
506 | fschmid | 72 | #include "fileloader.h" |
128 | Franz | 73 | |
617 | cbradney | 74 | #ifdef _MSC_VER |
75 | #if (_MSC_VER >= 1200) |
||
76 | #include "win-config.h" |
||
77 | #endif |
||
128 | Franz | 78 | #else |
79 | #include "config.h" |
||
80 | #endif |
||
81 | |||
3 | paul | 82 | #include "fpoint.h" |
83 | #include "fpointarray.h" |
||
84 | #include "hysettings.h" |
||
85 | #include "guidemanager.h" |
||
284 | Franz | 86 | #include "keymanager.h" |
3 | paul | 87 | #include "mergedoc.h" |
27 | Franz | 88 | #include "lineformats.h" |
102 | Franz | 89 | #include "story.h" |
123 | Franz | 90 | #include "autoform.h" |
140 | Franz | 91 | #include "tabmanager.h" |
164 | Franz | 92 | #include "search.h" |
169 | Franz | 93 | #include "fontcombo.h" |
415 | Franz | 94 | #include "prefsfile.h" |
134 | Franz | 95 | |
3 | paul | 96 | extern QPixmap loadIcon(QString nam); |
90 | Franz | 97 | extern bool overwrite(QWidget *parent, QString filename); |
124 | Franz | 98 | extern void CopyPageItem(struct CLBuf *Buffer, PageItem *b); |
203 | Franz | 99 | extern void ReOrderText(ScribusDoc *doc, ScribusView *view); |
204 | Franz | 100 | extern int copyFile(QString source, QString target); |
101 | extern int moveFile(QString source, QString target); |
||
3 | paul | 102 | |
103 | using namespace std; |
||
104 | |||
105 | #ifdef HAVE_CMS |
||
106 | cmsHPROFILE CMSoutputProf; |
||
107 | cmsHPROFILE CMSprinterProf; |
||
108 | cmsHTRANSFORM stdTrans; |
||
109 | cmsHTRANSFORM stdProof; |
||
110 | cmsHTRANSFORM stdTransImg; |
||
272 | Franz | 111 | cmsHTRANSFORM stdProofImg; |
3 | paul | 112 | bool SoftProofing; |
113 | bool Gamut; |
||
114 | bool CMSuse; |
||
115 | int IntentMonitor; |
||
116 | int IntentPrinter; |
||
117 | #endif |
||
118 | bool CMSavail; |
||
119 | ProfilesL InputProfiles; |
||
120 | int PolyC; |
||
121 | int PolyFd; |
||
80 | Franz | 122 | double PolyF; |
3 | paul | 123 | bool PolyS; |
80 | Franz | 124 | double PolyR; |
125 | double UmReFaktor; |
||
3 | paul | 126 | QString DocDir; |
119 | Franz | 127 | ScribusApp* ScApp; |
415 | Franz | 128 | PrefsFile* prefsFile; |
3 | paul | 129 | |
188 | Franz | 130 | ScribusApp::ScribusApp() |
272 | Franz | 131 | {} // ScribusApp::ScribusApp() |
188 | Franz | 132 | |
669 | cbradney | 133 | void ScribusApp::initGui(bool showSplash) |
188 | Franz | 134 | { |
669 | cbradney | 135 | if (showSplash) |
136 | { |
||
137 | splashScreen = new SplashScreen(); |
||
138 | splashScreen->setStatus(QObject::tr("Initializing...")); |
||
139 | } |
||
140 | else |
||
141 | splashScreen = NULL; |
||
142 | |||
272 | Franz | 143 | initScribus(); |
669 | cbradney | 144 | |
145 | if (splashScreen!=NULL) |
||
146 | { |
||
147 | splashScreen->close(); |
||
148 | delete splashScreen; |
||
149 | splashScreen = NULL; |
||
150 | } |
||
188 | Franz | 151 | } |
152 | |||
153 | void ScribusApp::initScribus() |
||
154 | { |
||
173 | Franz | 155 | ScApp = this; |
355 | Franz | 156 | CurrStED = NULL; |
272 | Franz | 157 | setCaption( tr("Scribus " VERSION)); |
118 | Franz | 158 | setKeyCompression(false); |
272 | Franz | 159 | setIcon(loadIcon("AppIcon.png")); |
160 | MenuItemsFile.clear(); |
||
161 | initMenuBar(); |
||
162 | initStatusBar(); |
||
490 | cbradney | 163 | qApp->processEvents(); |
272 | Franz | 164 | WerkTools2 = new QToolBar( tr("File"), this); |
165 | DatNeu = new QToolButton(loadIcon("DateiNeu.xpm"), tr("Create a new Document"), QString::null, this, SLOT(slotFileNew()), WerkTools2); |
||
166 | DatOpe = new QToolButton(loadIcon("DateiOpen.xpm"), tr("Open a Document"), QString::null, this, SLOT(slotDocOpen()), WerkTools2); |
||
348 | Franz | 167 | DatSav = new QToolButton(loadIcon("DateiSave2.png"), tr("Save the current Document"), QString::null, this, SLOT(slotFileSave()), WerkTools2); |
168 | DatClo = new QToolButton(loadIcon("DateiClose.png"), tr("Close the current Document"), QString::null, this, SLOT(slotFileClose()), WerkTools2); |
||
272 | Franz | 169 | DatPri = new QToolButton(loadIcon("DateiPrint.xpm"), tr("Print the current Document"), QString::null, this, SLOT(slotFilePrint()), WerkTools2); |
170 | DatPDF = new QToolButton(loadIcon("acrobat.png"), tr("Save the current Document as PDF"), QString::null, this, SLOT(SaveAsPDF()), WerkTools2); |
||
171 | DatSav->setEnabled(false); |
||
172 | DatClo->setEnabled(false); |
||
173 | DatPri->setEnabled(false); |
||
174 | DatPDF->setEnabled(false); |
||
175 | DatOpe->setPopup(recentMenu); |
||
176 | WerkTools = new WerkToolB(this); |
||
177 | setDockEnabled(WerkTools, DockLeft, false); |
||
178 | setDockEnabled(WerkTools, DockRight, false); |
||
179 | WerkTools->Sichtbar = true; |
||
180 | WerkTools->setEnabled(false); |
||
181 | WerkToolsP = new WerkToolBP(this); |
||
182 | setDockEnabled(WerkToolsP, DockLeft, false); |
||
183 | setDockEnabled(WerkToolsP, DockRight, false); |
||
184 | WerkToolsP->setEnabled(false); |
||
185 | WerkToolsP->Sichtbar = true; |
||
675 | cbradney | 186 | |
187 | PrefsPfad = getPreferencesLocation(); |
||
415 | Franz | 188 | prefsFile = new PrefsFile(QDir::convertSeparators(PrefsPfad + "/prefs.xml")); |
189 | dirs = prefsFile->getContext("dirs"); |
||
3 | paul | 190 | /** Erstelle Fontliste */ |
272 | Franz | 191 | NoFonts = false; |
3 | paul | 192 | BuFromApp = false; |
669 | cbradney | 193 | if (splashScreen!=NULL) |
194 | splashScreen->setStatus( tr("Searching for Fonts")); |
||
490 | cbradney | 195 | qApp->processEvents(); |
272 | Franz | 196 | GetAllFonts(); |
197 | if (NoFonts) |
||
198 | { |
||
669 | cbradney | 199 | if (splashScreen!=NULL) |
200 | splashScreen->close(); // 10/10/2004 pv fix #1200 |
||
675 | cbradney | 201 | QString mess = tr("There are no Postscript fonts on your system"); |
3 | paul | 202 | mess += "\n" + tr("Exiting now"); |
203 | QMessageBox::critical(this, tr("Fatal Error"), mess, 1, 0, 0); |
||
272 | Franz | 204 | } |
205 | else |
||
206 | { |
||
207 | HaveDoc = 0; |
||
135 | Franz | 208 | singleClose = false; |
173 | Franz | 209 | ScriptRunning = false; |
253 | Franz | 210 | DLLReturn = ""; |
211 | DLLinput = ""; |
||
95 | Franz | 212 | view = NULL; |
213 | doc = NULL; |
||
249 | Franz | 214 | Buffer2 = ""; |
253 | Franz | 215 | UniCinp = false; |
216 | UniCinC = 0; |
||
217 | UniCinS = ""; |
||
272 | Franz | 218 | BuildFontMenu(); |
3 | paul | 219 | SCFontsIterator it(Prefs.AvailFonts); |
220 | Prefs.DefFont = it.currentKey(); |
||
272 | Franz | 221 | Prefs.DefSize = 120; |
222 | Prefs.AppFontSize = qApp->font().pointSize(); |
||
223 | /** Default Farbenliste */ |
||
224 | Prefs.DColors.clear(); |
||
225 | QString pfadC = PREL; |
||
226 | QString pfadC2 = pfadC + "/lib/scribus/rgbscribus.txt"; |
||
227 | QFile fiC(pfadC2); |
||
228 | if (!fiC.exists()) |
||
229 | { |
||
230 | Prefs.DColors.insert("White", CMYKColor(0, 0, 0, 0)); |
||
231 | Prefs.DColors.insert("Black", CMYKColor(0, 0, 0, 255)); |
||
147 | Franz | 232 | Prefs.DColors.insert("Blue", CMYKColor(255, 255, 0, 0)); |
233 | Prefs.DColors.insert("Cyan", CMYKColor(255, 0, 0, 0)); |
||
234 | Prefs.DColors.insert("Green", CMYKColor(255, 0, 255, 0)); |
||
235 | Prefs.DColors.insert("Red", CMYKColor(0, 255, 255, 0)); |
||
236 | Prefs.DColors.insert("Yellow", CMYKColor(0, 0, 255, 0)); |
||
237 | Prefs.DColors.insert("Magenta", CMYKColor(0, 255, 0, 0)); |
||
238 | Franz | 238 | Prefs.DColorSet = "Scribus-Small"; |
272 | Franz | 239 | } |
147 | Franz | 240 | else |
272 | Franz | 241 | { |
242 | if (fiC.open(IO_ReadOnly)) |
||
147 | Franz | 243 | { |
244 | QString ColorEn, Cname; |
||
245 | int Rval, Gval, Bval; |
||
246 | QTextStream tsC(&fiC); |
||
247 | ColorEn = tsC.readLine(); |
||
248 | while (!tsC.atEnd()) |
||
272 | Franz | 249 | { |
147 | Franz | 250 | ColorEn = tsC.readLine(); |
251 | QTextStream CoE(&ColorEn, IO_ReadOnly); |
||
252 | CoE >> Rval; |
||
253 | CoE >> Gval; |
||
254 | CoE >> Bval; |
||
255 | CoE >> Cname; |
||
256 | CMYKColor tmp; |
||
257 | tmp.setColorRGB(Rval, Gval, Bval); |
||
258 | Prefs.DColors.insert(Cname, tmp); |
||
272 | Franz | 259 | } |
147 | Franz | 260 | fiC.close(); |
272 | Franz | 261 | } |
238 | Franz | 262 | Prefs.DColorSet = "X11 RGB-Set"; |
272 | Franz | 263 | } |
3 | paul | 264 | DispX = 10; |
265 | DispY = 10; |
||
266 | Prefs.Wheelval = 40; |
||
267 | Prefs.GrabRad = 4; |
||
268 | Prefs.GuideRad = 10; |
||
269 | Prefs.DminGrid = 20; |
||
272 | Franz | 270 | Prefs.DmajGrid = 100; |
271 | DocNr = 1; |
||
272 | Prefs.DminColor = QColor(green); |
||
273 | Prefs.DmajColor = QColor(green); |
||
274 | Prefs.DpapColor = QColor(white); |
||
275 | Prefs.DmargColor = QColor(blue); |
||
3 | paul | 276 | Prefs.guideColor = QColor(darkBlue); |
338 | Franz | 277 | Prefs.baseColor = QColor(lightGray); |
272 | Franz | 278 | Prefs.DVHoch = 33; |
279 | Prefs.DVHochSc = 100; |
||
280 | Prefs.DVTief = 33; |
||
281 | Prefs.DVTiefSc = 100; |
||
282 | Prefs.DVKapit = 75; |
||
283 | Prefs.GUI = "Default"; |
||
284 | Prefs.Dpen = "Black"; |
||
285 | Prefs.Dbrush = "Black"; |
||
286 | Prefs.Dshade = 100; |
||
287 | Prefs.Dshade2 = 100; |
||
288 | Prefs.DLineArt = SolidLine; |
||
289 | Prefs.Dwidth = 1; |
||
290 | Prefs.DpenLine = "Black"; |
||
291 | Prefs.DpenText = "Black"; |
||
139 | Franz | 292 | Prefs.DCols = 1; |
293 | Prefs.DGap = 0.0; |
||
272 | Franz | 294 | Prefs.DshadeLine = 100; |
295 | Prefs.DLstyleLine = SolidLine; |
||
296 | Prefs.DwidthLine = 1; |
||
297 | Prefs.MagMin = 10; |
||
298 | Prefs.MagMax = 800; |
||
299 | Prefs.MagStep = 25; |
||
300 | Prefs.DbrushPict = "White"; |
||
301 | Prefs.ShadePict = 100; |
||
302 | Prefs.ScaleX = 1; |
||
303 | Prefs.ScaleY = 1; |
||
304 | Prefs.Before = true; |
||
305 | Prefs.Einheit = 0; |
||
3 | paul | 306 | UmReFaktor = 1.0; |
307 | PolyC = 4; |
||
308 | PolyF = 0.5; |
||
309 | PolyS = false; |
||
310 | PolyFd = 0; |
||
311 | PolyR = 0; |
||
312 | Prefs.PolyC = PolyC; |
||
313 | Prefs.PolyF = PolyF; |
||
314 | Prefs.PolyFd = PolyFd; |
||
315 | Prefs.PolyS = PolyS; |
||
316 | Prefs.PolyR = PolyR; |
||
272 | Franz | 317 | Prefs.Werkv = true; |
318 | Prefs.WerkvP = true; |
||
319 | Prefs.Mpalv = false; |
||
310 | Franz | 320 | Prefs.Mapalv = false; |
272 | Franz | 321 | Prefs.Tpalv = false; |
322 | Prefs.SCpalv = false; |
||
323 | Prefs.Lpalv = false; |
||
3 | paul | 324 | Prefs.Bopalv = false; |
272 | Franz | 325 | Prefs.Mpalx = 0; |
326 | Prefs.Mpaly = 0; |
||
310 | Franz | 327 | Prefs.Mapalx = 0; |
328 | Prefs.Mapaly = 0; |
||
87 | Franz | 329 | Prefs.Tpalx = 0; |
330 | Prefs.Tpaly = 0; |
||
331 | Prefs.SCpalx = 0; |
||
332 | Prefs.SCpaly = 0; |
||
333 | Prefs.SCpalw = 100; |
||
334 | Prefs.SCpalh = 200; |
||
335 | Prefs.Sepalx = 0; |
||
336 | Prefs.Sepaly = 0; |
||
337 | Prefs.Bopalx = 0; |
||
338 | Prefs.Bopaly = 0; |
||
339 | Prefs.Lpalx = 0; |
||
340 | Prefs.Lpaly = 0; |
||
272 | Franz | 341 | Prefs.PSize = 40; |
342 | Prefs.SaveAtQ = true; |
||
343 | Prefs.FramesShown = true; |
||
344 | Prefs.GridShown = false; |
||
345 | Prefs.MarginsShown = true; |
||
346 | Prefs.GuidesShown = true; |
||
332 | Franz | 347 | Prefs.BaseShown = false; |
272 | Franz | 348 | Prefs.ClipMargin = true; |
344 | Franz | 349 | Prefs.GCRMode = true; |
272 | Franz | 350 | Prefs.PagesSbS = true; |
351 | Prefs.RecentDocs.clear(); |
||
352 | Prefs.RecentDCount = 5; |
||
353 | Prefs.RandFarbig = false; |
||
354 | Prefs.AutoLine = 20; |
||
3 | paul | 355 | Prefs.PageFormat = 4; |
356 | Prefs.Ausrichtung = 0; |
||
357 | Prefs.PageBreite = 595; |
||
358 | Prefs.PageHoehe = 842; |
||
359 | Prefs.RandOben = 9; |
||
360 | Prefs.RandUnten = 40; |
||
361 | Prefs.RandLinks = 9; |
||
362 | Prefs.RandRechts = 9; |
||
363 | Prefs.DoppelSeiten = false; |
||
364 | Prefs.ErsteLinks = false; |
||
365 | Prefs.ScaleType = true; |
||
366 | Prefs.AspectRatio = true; |
||
367 | Prefs.MinWordLen = 3; |
||
249 | Franz | 368 | Prefs.HyCount = 2; |
3 | paul | 369 | Prefs.Language = ""; |
370 | Prefs.Automatic = true; |
||
371 | Prefs.AutoCheck = false; |
||
372 | Prefs.PDFTransparency = false; |
||
373 | Prefs.AutoSave = false; |
||
374 | Prefs.AutoSaveTime = 600000; |
||
11 | Franz | 375 | Prefs.DisScale = 1.0; |
282 | Franz | 376 | Prefs.DocDir = QDir::homeDirPath(); |
68 | Franz | 377 | Prefs.ProfileDir = ""; |
91 | Franz | 378 | Prefs.ScriptDir = ""; |
409 | Franz | 379 | Prefs.TemplateDir = ""; |
151 | Franz | 380 | Prefs.CustomColorSets.clear(); |
213 | Franz | 381 | Prefs.PrPr_Mode = false; |
344 | Franz | 382 | Prefs.Gcr_Mode = true; |
213 | Franz | 383 | Prefs.PrPr_AlphaText = false; |
384 | Prefs.PrPr_AlphaGraphics = false; |
||
385 | Prefs.PrPr_Transparency = false; |
||
386 | Prefs.PrPr_C = true; |
||
387 | Prefs.PrPr_M = true; |
||
388 | Prefs.PrPr_Y = true; |
||
389 | Prefs.PrPr_K = true; |
||
220 | Franz | 390 | Prefs.gimp_exe = "gimp"; |
391 | Prefs.gs_antiGraph = true; |
||
392 | Prefs.gs_antiText = true; |
||
393 | Prefs.gs_exe = "gs"; |
||
241 | Franz | 394 | Prefs.BaseGrid = 14.4; |
395 | Prefs.BaseOffs = 0.0; |
||
357 | Franz | 396 | Prefs.STEcolor = QColor(white); |
397 | Prefs.STEfont = font().toString(); |
||
220 | Franz | 398 | PDef.Pname = ""; |
399 | PDef.Dname = ""; |
||
400 | PDef.Command = ""; |
||
272 | Franz | 401 | PrinterUsed = false; |
3 | paul | 402 | resize(610, 600); |
272 | Franz | 403 | QVBox* vb = new QVBox( this ); |
404 | vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); |
||
405 | wsp = new QWorkspace( vb ); |
||
406 | setCentralWidget( vb ); |
||
3 | paul | 407 | connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *))); |
77 | Franz | 408 | Tpal = new Tree(this, 0); |
32 | Franz | 409 | Mpal = new Mpalette(this, &Prefs); |
3 | paul | 410 | Mpal->Cpal->SetColors(Prefs.DColors); |
411 | Npal = new NodePalette(this); |
||
412 | Lpal = new LayerPalette(this); |
||
30 | Franz | 413 | ScBook = new Biblio(this, &Prefs); |
3 | paul | 414 | Sepal = new SeitenPal(this); |
415 | BookPal = new BookPalette(this); |
||
284 | Franz | 416 | MaPal = new Measurements(this); |
417 | MaPal->hide(); |
||
3 | paul | 418 | CMSavail = false; |
92 | Franz | 419 | keyrep = false; |
3 | paul | 420 | Prefs.DCMSset.DefaultMonitorProfile = ""; |
421 | Prefs.DCMSset.DefaultPrinterProfile = ""; |
||
422 | Prefs.DCMSset.DefaultInputProfile = ""; |
||
423 | Prefs.DCMSset.DefaultInputProfile2 = ""; |
||
424 | Prefs.DCMSset.CMSinUse = false; |
||
425 | Prefs.DCMSset.SoftProofOn = false; |
||
426 | Prefs.DCMSset.GamutCheck = false; |
||
117 | Franz | 427 | Prefs.DCMSset.BlackPoint = true; |
3 | paul | 428 | Prefs.DCMSset.DefaultIntentMonitor = 1; |
429 | Prefs.DCMSset.DefaultIntentMonitor2 = 1; |
||
430 | Prefs.DCMSset.DefaultIntentPrinter = 0; |
||
431 | Prefs.GFontSub.clear(); |
||
238 | Franz | 432 | SetKeyEntry(56, tr("Smart Hyphen"), 0, CTRL+Key_Minus); |
3 | paul | 433 | SetKeyEntry(57, tr("Align Left"), 0, CTRL+Key_L); |
434 | SetKeyEntry(58, tr("Align Right"), 0, CTRL+Key_R); |
||
435 | SetKeyEntry(59, tr("Align Center"), 0, CTRL+Key_E); |
||
238 | Franz | 436 | SetKeyEntry(60, tr("Insert Page Number"), 0, CTRL+Key_NumberSign); |
3 | paul | 437 | SetKeyEntry(61, tr("Attach Text to Path"), PfadT, 0); |
438 | SetKeyEntry(62, tr("Show Layers"), viewLpal, 0); |
||
73 | Franz | 439 | SetKeyEntry(63, tr("Javascripts..."), jman, 0); |
3 | paul | 440 | SetKeyEntry(64, tr("Undo"), edUndo, CTRL+Key_Z); |
441 | SetKeyEntry(65, tr("Show Page Palette"), viewSepal, 0); |
||
319 | Franz | 442 | SetKeyEntry(66, tr("Lock/Unlock"), LockOb, CTRL+Key_F); |
73 | Franz | 443 | SetKeyEntry(67, tr("Non Breaking Space"), 0, CTRL+Key_Space); |
669 | cbradney | 444 | if (splashScreen != NULL) |
445 | splashScreen->setStatus( tr("Reading Preferences")); |
||
490 | cbradney | 446 | qApp->processEvents(); |
68 | Franz | 447 | ReadPrefs(); |
120 | Franz | 448 | if (Prefs.DefFont == "") |
449 | Prefs.DefFont = it.currentKey(); |
||
669 | cbradney | 450 | if (splashScreen != NULL) |
451 | splashScreen->setStatus( tr("Getting ICC Profiles")); |
||
3 | paul | 452 | GetCMSProfiles(); |
669 | cbradney | 453 | if (splashScreen != NULL) |
454 | splashScreen->setStatus( tr("Init Hyphenator")); |
||
490 | cbradney | 455 | qApp->processEvents(); |
3 | paul | 456 | InitHyphenator(); |
457 | Mpal->Cpal->UseTrans(Prefs.PDFTransparency); |
||
494 | fschmid | 458 | Mpal->Fonts->RebuildList(&Prefs, 0); |
3 | paul | 459 | DocDir = Prefs.DocDir; |
669 | cbradney | 460 | if (splashScreen != NULL) |
461 | splashScreen->setStatus( tr("Setting up Shortcuts")); |
||
490 | cbradney | 462 | qApp->processEvents(); |
3 | paul | 463 | SetShortCut(); |
464 | if (CMSavail) |
||
272 | Franz | 465 | { |
308 | Franz | 466 | settingsMenu->insertItem( tr("&Color Management..."), this , SLOT(SetCMSPrefs())); |
3 | paul | 467 | ProfilesL::Iterator ip; |
468 | if ((Prefs.DCMSset.DefaultInputProfile == "") || (!InputProfiles.contains(Prefs.DCMSset.DefaultInputProfile))) |
||
272 | Franz | 469 | { |
3 | paul | 470 | ip = InputProfiles.begin(); |
471 | Prefs.DCMSset.DefaultInputProfile = ip.key(); |
||
272 | Franz | 472 | } |
3 | paul | 473 | if ((Prefs.DCMSset.DefaultInputProfile2 == "") || (!InputProfiles.contains(Prefs.DCMSset.DefaultInputProfile2))) |
272 | Franz | 474 | { |
3 | paul | 475 | ip = InputProfiles.begin(); |
476 | Prefs.DCMSset.DefaultInputProfile2 = ip.key(); |
||
272 | Franz | 477 | } |
3 | paul | 478 | if ((Prefs.DCMSset.DefaultMonitorProfile == "") || (!MonitorProfiles.contains(Prefs.DCMSset.DefaultMonitorProfile))) |
272 | Franz | 479 | { |
3 | paul | 480 | ip = MonitorProfiles.begin(); |
481 | Prefs.DCMSset.DefaultMonitorProfile = ip.key(); |
||
272 | Franz | 482 | } |
3 | paul | 483 | if ((Prefs.DCMSset.DefaultPrinterProfile == "") || (!PrinterProfiles.contains(Prefs.DCMSset.DefaultPrinterProfile))) |
272 | Franz | 484 | { |
3 | paul | 485 | ip = PrinterProfiles.begin(); |
486 | Prefs.DCMSset.DefaultPrinterProfile = ip.key(); |
||
272 | Franz | 487 | } |
3 | paul | 488 | #ifdef HAVE_CMS |
489 | SoftProofing = Prefs.DCMSset.SoftProofOn; |
||
490 | CMSuse = false; |
||
491 | IntentPrinter = Prefs.DCMSset.DefaultIntentPrinter; |
||
492 | IntentMonitor = Prefs.DCMSset.DefaultIntentMonitor; |
||
493 | #endif |
||
272 | Franz | 494 | |
495 | } |
||
669 | cbradney | 496 | if (splashScreen != NULL) |
497 | splashScreen->setStatus( tr("Reading Scrapbook")); |
||
3 | paul | 498 | QString SCf = PrefsPfad+"/scrap.scs"; |
499 | QFileInfo SCfi = QFileInfo(SCf); |
||
500 | if (SCfi.exists()) |
||
501 | ScBook->BibWin->ReadContents(SCf); |
||
263 | Franz | 502 | ScBook->ScFilename = SCf; |
3 | paul | 503 | ScBook->AdjustMenu(); |
220 | Franz | 504 | HaveGS = system(Prefs.gs_exe+" -h > /dev/null 2>&1"); |
505 | HavePngAlpha = system(Prefs.gs_exe+" -sDEVICE=pngalpha -c quit > /dev/null 2>&1"); |
||
669 | cbradney | 506 | if (splashScreen != NULL) |
507 | splashScreen->setStatus( tr("Initializing Plugins")); |
||
490 | cbradney | 508 | qApp->processEvents(); |
669 | cbradney | 509 | InitPlugs(); |
3 | paul | 510 | ClipB = QApplication::clipboard(); |
276 | Franz | 511 | PalettesStat[0] = false; |
512 | GuidesStat[0] = false; |
||
3 | paul | 513 | connect(WerkTools, SIGNAL(NewMode(int)), this, SLOT(ModeFromTB(int))); |
514 | connect(WerkTools, SIGNAL(Schliessen()), this, SLOT(ToggleTools())); |
||
14 | Franz | 515 | connect(WerkToolsP, SIGNAL(NewMode(int)), this, SLOT(ModeFromTB(int))); |
516 | connect(WerkToolsP, SIGNAL(Schliessen()), this, SLOT(TogglePDFTools())); |
||
310 | Franz | 517 | connect(MaPal, SIGNAL(Schliessen(bool)), this, SLOT(setMapal(bool))); |
3 | paul | 518 | connect(Mpal, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
519 | connect(Mpal, SIGNAL(NewAbStyle(int)), this, SLOT(setNewAbStyle(int))); |
||
520 | connect(Mpal, SIGNAL(BackHome()), this, SLOT(Aktiv())); |
||
521 | connect(Mpal, SIGNAL(Stellung(int)), this, SLOT(setItemHoch(int))); |
||
522 | connect(Mpal, SIGNAL(Schliessen()), this, SLOT(ToggleMpal())); |
||
523 | connect(Mpal, SIGNAL(EditCL()), this, SLOT(ToggleFrameEdit())); |
||
32 | Franz | 524 | connect(Mpal, SIGNAL(NewTF(QString)), this, SLOT(SetNewFont(QString))); |
162 | Franz | 525 | connect(Mpal, SIGNAL(UpdtGui(int)), this, SLOT(HaveNewSel(int))); |
3 | paul | 526 | connect(Mpal->Cpal, SIGNAL(NewPen(QString)), this, SLOT(setPenFarbe(QString))); |
527 | connect(Mpal->Cpal, SIGNAL(NewBrush(QString)), this, SLOT(setBrushFarbe(QString))); |
||
528 | connect(Mpal->Cpal, SIGNAL(NewPenShade(int)), this, SLOT(setPenShade(int))); |
||
529 | connect(Mpal->Cpal, SIGNAL(NewBrushShade(int)), this, SLOT(setBrushShade(int))); |
||
80 | Franz | 530 | connect(Mpal->Cpal, SIGNAL(NewTrans(double)), this, SLOT(SetTranspar(double))); |
531 | connect(Mpal->Cpal, SIGNAL(NewTransS(double)), this, SLOT(SetTransparS(double))); |
||
295 | Franz | 532 | connect(Mpal->Cpal, SIGNAL(NewGradient(int)), this, SLOT(setGradFill(int))); |
686 | cbradney | 533 | connect(Mpal->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), this, SLOT(updtGradFill())); |
295 | Franz | 534 | connect(Mpal->Cpal, SIGNAL(gradientChanged()), this, SLOT(updtGradFill())); |
3 | paul | 535 | connect(Mpal->Cpal, SIGNAL(QueryItem()), this, SLOT(GetBrushPen())); |
536 | connect(Tpal, SIGNAL(Schliessen()), this, SLOT(ToggleTpal())); |
||
367 | Franz | 537 | connect(Tpal, SIGNAL(CloseMpal()), this, SLOT(ToggleMpal())); |
538 | connect(Tpal, SIGNAL(CloseSpal()), this, SLOT(ToggleBpal())); |
||
3 | paul | 539 | connect(Tpal, SIGNAL(SelectElement(int, int)), this, SLOT(SelectFromOutl(int, int))); |
540 | connect(Tpal, SIGNAL(SelectSeite(int)), this, SLOT(SelectFromOutlS(int))); |
||
356 | Franz | 541 | connect(Tpal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes())); |
3 | paul | 542 | connect(Mpal->Spal, SIGNAL(NewStyle(int)), this, SLOT(setNewAbStyle(int))); |
27 | Franz | 543 | connect(Mpal, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles())); |
356 | Franz | 544 | connect(Mpal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes())); |
367 | Franz | 545 | connect(Mpal, SIGNAL(CloseTpal()), this, SLOT(ToggleTpal())); |
546 | connect(Mpal, SIGNAL(CloseBpal()), this, SLOT(ToggleBpal())); |
||
3 | paul | 547 | connect(Npal, SIGNAL(Schliessen()), this, SLOT(NoFrameEdit())); |
548 | connect(Lpal, SIGNAL(LayerActivated(int)), this, SLOT(changeLayer(int))); |
||
216 | Franz | 549 | connect(Lpal, SIGNAL(LayerRemoved(int, bool)), this, SLOT(LayerRemove(int, bool))); |
3 | paul | 550 | connect(Lpal, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
551 | connect(Lpal, SIGNAL(Schliessen()), this, SLOT(ToggleLpal())); |
||
356 | Franz | 552 | connect(Lpal->Table, SIGNAL(Schliessen()), this, SLOT(ToggleLpal())); |
553 | connect(Lpal->Table, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes())); |
||
3 | paul | 554 | connect(Sepal, SIGNAL(Schliessen()), this, SLOT(ToggleSepal())); |
555 | connect(ScBook, SIGNAL(Schliessen()), this, SLOT(ToggleBpal())); |
||
356 | Franz | 556 | connect(ScBook->BibWin, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes())); |
366 | Franz | 557 | connect(ScBook->BibWin, SIGNAL(Schliessen()), this, SLOT(ToggleBpal())); |
367 | Franz | 558 | connect(ScBook->BibWin, SIGNAL(CloseTpal()), this, SLOT(ToggleTpal())); |
559 | connect(ScBook->BibWin, SIGNAL(CloseMpal()), this, SLOT(ToggleMpal())); |
||
3 | paul | 560 | connect(Sepal, SIGNAL(EditTemp(QString)), this, SLOT(ManageTemp(QString))); |
561 | connect(Sepal->PageView, SIGNAL(UseTemp(QString, int)), this, SLOT(Apply_Temp(QString, int))); |
||
562 | connect(Sepal->PageView, SIGNAL(NewPage(int, QString)), this, SLOT(slotNewPageP(int, QString))); |
||
563 | connect(Sepal->Trash, SIGNAL(DelPage(int)), this, SLOT(DeletePage2(int))); |
||
564 | connect(Sepal, SIGNAL(GotoSeite(int)), this, SLOT(SelectFromOutlS(int))); |
||
356 | Franz | 565 | connect(Sepal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes())); |
3 | paul | 566 | connect(BookPal->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks())); |
567 | connect(BookPal->BView, SIGNAL(ChangeBMNr(int, int, int)), this, SLOT(ChBookmarks(int, int, int))); |
||
366 | Franz | 568 | connect(BookPal->BView, SIGNAL(SelectElement(int, int)), this, SLOT(SelectFromOutl(int, int))); |
3 | paul | 569 | connect(BookPal, SIGNAL(Schliessen()), this, SLOT(ToggleBookpal())); |
356 | Franz | 570 | connect(BookPal, SIGNAL(ToggleAllPalettes()), this, SLOT(ToggleAllPalettes())); |
3 | paul | 571 | connect(recentMenu, SIGNAL(activated(int)), this, SLOT(LoadRecent(int))); |
148 | Franz | 572 | connect(ColorMenC, SIGNAL(activated(int)), this, SLOT(setItemFarbe(int))); |
272 | Franz | 573 | connect(ShadeMenu, SIGNAL(activated(int)), this, SLOT(setItemShade(int))); |
574 | connect(FontMenu, SIGNAL(activated(int)), this, SLOT(setItemFont(int))); |
||
575 | connect(SizeTMenu, SIGNAL(activated(int)), this, SLOT(setItemFSize(int))); |
||
576 | connect(TypeStyleMenu, SIGNAL(activated(int)), this, SLOT(setItemTypeStyle(int))); |
||
577 | connect(AliMenu, SIGNAL(activated(int)), this, SLOT(setItemTextAli(int))); |
||
3 | paul | 578 | connect(this, SIGNAL(TextIFont(QString)), this, SLOT(AdjustFontMenu(QString))); |
579 | connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int))); |
||
580 | connect(this, SIGNAL(TextISize(int)), Mpal, SLOT(setSize(int))); |
||
80 | Franz | 581 | connect(this, SIGNAL(TextUSval(double)), Mpal, SLOT(setExtra(double))); |
3 | paul | 582 | connect(this, SIGNAL(TextStil(int)), Mpal, SLOT(setStil(int))); |
68 | Franz | 583 | connect(this, SIGNAL(TextScale(int)), Mpal, SLOT(setTScale(int))); |
584 | connect(this, SIGNAL(TextFarben(QString, QString, int, int)), Mpal, SLOT(setActFarben(QString, QString, int, int))); |
||
3 | paul | 585 | connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange())); |
272 | Franz | 586 | typedef void (*HandlerType)(int); |
119 | Franz | 587 | HandlerType handler = 0; |
588 | handler = ScribusApp::defaultCrashHandler; |
||
272 | Franz | 589 | if (!handler) |
590 | handler = SIG_DFL; |
||
591 | sigset_t mask; |
||
592 | sigemptyset(&mask); |
||
119 | Franz | 593 | #ifdef SIGSEGV |
272 | Franz | 594 | signal (SIGSEGV, handler); |
595 | sigaddset(&mask, SIGSEGV); |
||
119 | Franz | 596 | #endif |
597 | #ifdef SIGFPE |
||
272 | Franz | 598 | signal (SIGFPE, handler); |
599 | sigaddset(&mask, SIGFPE); |
||
119 | Franz | 600 | #endif |
601 | #ifdef SIGILL |
||
272 | Franz | 602 | signal (SIGILL, handler); |
603 | sigaddset(&mask, SIGILL); |
||
119 | Franz | 604 | #endif |
605 | #ifdef SIGABRT |
||
272 | Franz | 606 | signal (SIGABRT, handler); |
607 | sigaddset(&mask, SIGABRT); |
||
119 | Franz | 608 | #endif |
272 | Franz | 609 | sigprocmask(SIG_UNBLOCK, &mask, 0); |
3 | paul | 610 | } |
611 | } |
||
612 | |||
675 | cbradney | 613 | /*! |
614 | \fn QString ScribusApp::getPreferencesLocation() |
||
615 | \author Craig Bradney |
||
616 | \date Thu 18 Nov 2004 |
||
617 | \brief Get the user's preference file location. Rename any existing old preferences files |
||
618 | \param None |
||
619 | \retval QString Location of the user's preferences |
||
620 | */ |
||
621 | |||
622 | QString ScribusApp::getPreferencesLocation() |
||
623 | { |
||
624 | QString Pff = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus"); |
||
625 | QFileInfo Pffi = QFileInfo(Pff); |
||
626 | QString PrefsPfad; |
||
627 | if (Pffi.exists()) |
||
628 | { |
||
629 | if (Pffi.isDir()) |
||
630 | PrefsPfad = Pff; |
||
631 | else |
||
632 | PrefsPfad = QDir::homeDirPath(); |
||
633 | } |
||
634 | else |
||
635 | { |
||
636 | QDir di = QDir(); |
||
637 | di.mkdir(Pff); |
||
638 | PrefsPfad = Pff; |
||
639 | QString OldPR = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus.rc"); |
||
640 | QFileInfo OldPi = QFileInfo(OldPR); |
||
641 | if (OldPi.exists()) |
||
642 | moveFile(OldPR, Pff+"/scribus.rc"); |
||
643 | QString OldPR2 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusfont.rc"); |
||
644 | QFileInfo OldPi2 = QFileInfo(OldPR2); |
||
645 | if (OldPi2.exists()) |
||
646 | moveFile(OldPR2, Pff+"/scribusfont.rc"); |
||
647 | QString OldPR3 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusscrap.scs"); |
||
648 | QFileInfo OldPi3 = QFileInfo(OldPR3); |
||
649 | if (OldPi3.exists()) |
||
650 | moveFile(OldPR3, Pff+"/scrap.scs"); |
||
651 | } |
||
652 | return PrefsPfad; |
||
653 | } |
||
654 | |||
3 | paul | 655 | void ScribusApp::initMenuBar() |
656 | { |
||
657 | int MenID; |
||
658 | QFont tmp; |
||
659 | recentMenu = new QPopupMenu(); |
||
660 | RecentDocs.clear(); |
||
661 | fileMenu=new QPopupMenu(); |
||
506 | fschmid | 662 | M_NewFile = fileMenu->insertItem(loadIcon("DateiNeu16.png"), tr("&New"), this, SLOT(slotFileNew()), CTRL+Key_N); |
308 | Franz | 663 | fid13 = fileMenu->insertItem(loadIcon("DateiOpen16.png"), tr("&Open..."), this, SLOT(slotDocOpen()), CTRL+Key_O); |
664 | fid14 = fileMenu->insertItem( tr("Open &Recent"), recentMenu); |
||
506 | fschmid | 665 | SetKeyEntry(0, tr("New"), M_NewFile, CTRL+Key_N); |
3 | paul | 666 | SetKeyEntry(1, tr("Open..."), fid13, CTRL+Key_O); |
667 | fileMenu->insertSeparator(); |
||
308 | Franz | 668 | fid1 = fileMenu->insertItem(loadIcon("DateiClos16.png"), tr("&Close"), this, SLOT(slotFileClose()), CTRL+Key_W); |
3 | paul | 669 | SetKeyEntry(2, tr("Close"), fid1, CTRL+Key_W); |
670 | fileMenu->setItemEnabled(fid1, 0); |
||
270 | Franz | 671 | MenuItemsFile.append(fid1); |
308 | Franz | 672 | fid4 = fileMenu->insertItem(loadIcon("DateiSave16.png"), tr("&Save"), this, SLOT(slotFileSave()), CTRL+Key_S); |
3 | paul | 673 | SetKeyEntry(3, tr("Save"), fid4, CTRL+Key_S); |
674 | fileMenu->setItemEnabled(fid4, 0); |
||
506 | fschmid | 675 | M_SaveAs = fileMenu->insertItem( loadIcon("filesaveas.png"), tr("Save &As..."), this, SLOT(slotFileSaveAs())); |
676 | SetKeyEntry(4, tr("Save as..."), M_SaveAs, 0); |
||
677 | fileMenu->setItemEnabled(M_SaveAs, 0); |
||
348 | Franz | 678 | fid52 = fileMenu->insertItem(loadIcon("revert.png"), tr("Re&vert to Saved"), this, SLOT(slotFileRevert())); |
112 | Franz | 679 | fileMenu->setItemEnabled(fid52, 0); |
308 | Franz | 680 | fid51 = fileMenu->insertItem( tr("Collect for O&utput..."), this, SLOT(Collect())); |
3 | paul | 681 | fileMenu->setItemEnabled(fid51, 0); |
270 | Franz | 682 | MenuItemsFile.append(fid51); |
3 | paul | 683 | fileMenu->insertSeparator(); |
684 | importMenu = new QPopupMenu(); |
||
308 | Franz | 685 | fid2 = importMenu->insertItem( tr("&Get Text/Picture..."), this, SLOT(slotFileOpen())); |
3 | paul | 686 | importMenu->setItemEnabled(fid2, 0); |
308 | Franz | 687 | fid2aa = importMenu->insertItem( tr("Append &Text..."), this, SLOT(slotFileAppend())); |
218 | Franz | 688 | importMenu->setItemEnabled(fid2aa, 0); |
326 | Franz | 689 | fid2a = importMenu->insertItem( tr("Import &Page(s)..."), this, SLOT(slotDocMerge())); |
3 | paul | 690 | importMenu->setItemEnabled(fid2a, 0); |
308 | Franz | 691 | fileMenu->insertItem( tr("&Import"), importMenu); |
3 | paul | 692 | exportMenu = new QPopupMenu(); |
308 | Franz | 693 | fid3 = exportMenu->insertItem( tr("Save &Text..."), this, SLOT(SaveText())); |
3 | paul | 694 | exportMenu->setItemEnabled(fid3, 0); |
308 | Franz | 695 | fid8 = exportMenu->insertItem( tr("Save Page as &EPS..."), this, SLOT(SaveAsEps())); |
3 | paul | 696 | exportMenu->setItemEnabled(fid8, 0); |
308 | Franz | 697 | fid10 = exportMenu->insertItem( tr("Save as P&DF..."), this, SLOT(SaveAsPDF())); |
3 | paul | 698 | exportMenu->setItemEnabled(fid10, 0); |
308 | Franz | 699 | fid11 = fileMenu->insertItem( tr("&Export"), exportMenu); |
3 | paul | 700 | fileMenu->setItemEnabled(fid11, 0); |
701 | fileMenu->insertSeparator(); |
||
361 | Franz | 702 | fid6 = fileMenu->insertItem(loadIcon("documentinfo.png"), tr("Document &Information..."), this, SLOT(InfoDoc()), CTRL+Key_I); |
3 | paul | 703 | fileMenu->setItemEnabled(fid6, 0); |
270 | Franz | 704 | MenuItemsFile.append(fid6); |
3 | paul | 705 | SetKeyEntry(5, tr("Document Info..."), fid6, CTRL+Key_I); |
308 | Franz | 706 | fid7 = fileMenu->insertItem( tr("Document &Setup..."), this, SLOT(SetupDoc())); |
3 | paul | 707 | fileMenu->setItemEnabled(fid7, 0); |
270 | Franz | 708 | MenuItemsFile.append(fid7); |
3 | paul | 709 | SetKeyEntry(6, tr("Document Setup..."), fid7, 0); |
506 | fschmid | 710 | M_Print = fileMenu->insertItem(loadIcon("DateiPrint16.png"), tr("&Print..."), this, SLOT(slotFilePrint()), CTRL+Key_P); |
711 | fileMenu->setItemEnabled(M_Print, 0); |
||
712 | MenuItemsFile.append(M_Print); |
||
713 | SetKeyEntry(7, tr("Print..."), M_Print, CTRL+Key_P); |
||
3 | paul | 714 | fileMenu->insertSeparator(); |
308 | Franz | 715 | MenID = fileMenu->insertItem(loadIcon("exit.png"), tr("&Quit"), this, SLOT(slotFileQuit()), CTRL+Key_Q); |
3 | paul | 716 | SetKeyEntry(8, tr("Quit"), MenID, CTRL+Key_Q); |
717 | editMenu = new QPopupMenu(); |
||
308 | Franz | 718 | edUndo = editMenu->insertItem( tr("&Undo"), this, SLOT(UnDoAction()), CTRL+Key_Z); |
3 | paul | 719 | editMenu->insertSeparator(); |
308 | Franz | 720 | edid1 = editMenu->insertItem(loadIcon("editcut.png"), tr("Cu&t"), this , SLOT(slotEditCut()), CTRL+Key_X); |
721 | edid2 = editMenu->insertItem(loadIcon("editcopy.png"), tr("&Copy"), this , SLOT(slotEditCopy()), CTRL+Key_C); |
||
722 | edid3 = editMenu->insertItem(loadIcon("editpaste.png"), tr("&Paste"), this , SLOT(slotEditPaste()), CTRL+Key_V); |
||
723 | edid4 = editMenu->insertItem(loadIcon("editdelete.png"), tr("C&lear"), this, SLOT(DeleteText())); |
||
724 | edid5 = editMenu->insertItem( tr("Select &All"), this, SLOT(SelectAll()), CTRL+Key_A); |
||
3 | paul | 725 | SetKeyEntry(9, tr("Cut"), edid1, CTRL+Key_X); |
726 | SetKeyEntry(10, tr("Copy"), edid2, CTRL+Key_C); |
||
727 | SetKeyEntry(11, tr("Paste"), edid3, CTRL+Key_V); |
||
728 | SetKeyEntry(12, tr("Clear"), edid4, 0); |
||
729 | SetKeyEntry(13, tr("Select all"), edid5, CTRL+Key_A); |
||
730 | editMenu->insertSeparator(); |
||
357 | Franz | 731 | Sear = editMenu->insertItem(loadIcon("find16.png"), tr("&Search/Replace..."), this, SLOT(SearchText())); |
164 | Franz | 732 | editMenu->insertSeparator(); |
308 | Franz | 733 | MenID = editMenu->insertItem( tr("C&olors..."), this , SLOT(slotEditColors())); |
3 | paul | 734 | SetKeyEntry(14, tr("Colors..."), MenID, 0); |
308 | Franz | 735 | edid6 = editMenu->insertItem( tr("&Paragraph Styles..."), this , SLOT(slotEditStyles())); |
736 | edid6a = editMenu->insertItem( tr("&Line Styles..."), this , SLOT(slotEditLineStyles())); |
||
3 | paul | 737 | SetKeyEntry(15, tr("Styles..."), edid6, 0); |
308 | Franz | 738 | tman = editMenu->insertItem( tr("&Templates..."), this, SLOT(ManageTemp())); |
3 | paul | 739 | SetKeyEntry(16, tr("Templates..."), tman, 0); |
308 | Franz | 740 | jman = editMenu->insertItem( tr("&Javascripts..."), this, SLOT(ManageJava())); |
3 | paul | 741 | editMenu->setItemEnabled(edUndo, 0); |
742 | editMenu->setItemEnabled(edid1, 0); |
||
743 | editMenu->setItemEnabled(edid2, 0); |
||
744 | editMenu->setItemEnabled(edid3, 0); |
||
745 | editMenu->setItemEnabled(edid4, 0); |
||
746 | editMenu->setItemEnabled(edid5, 0); |
||
747 | editMenu->setItemEnabled(edid6, 0); |
||
27 | Franz | 748 | editMenu->setItemEnabled(edid6a, 0); |
164 | Franz | 749 | editMenu->setItemEnabled(Sear, 0); |
3 | paul | 750 | editMenu->setItemEnabled(tman, 0); |
751 | editMenu->setItemEnabled(jman, 0); |
||
752 | StilMenu = new QPopupMenu(); |
||
753 | ObjMenu = new QPopupMenu(); |
||
68 | Franz | 754 | SetKeyEntry(19, tr("Select New Font"), 0, 0); |
308 | Franz | 755 | ODup = ObjMenu->insertItem( tr("D&uplicate"), this, SLOT(ObjektDup()), CTRL+Key_D); |
232 | Franz | 756 | SetKeyEntry(20, tr("Duplicate"), ODup, CTRL+Key_D); |
308 | Franz | 757 | OMDup = ObjMenu->insertItem( tr("&Multiple Duplicate"), this, SLOT(ObjektDupM())); |
232 | Franz | 758 | SetKeyEntry(21, tr("Multiple Duplicate"), OMDup, 0); |
308 | Franz | 759 | Loesch = ObjMenu->insertItem( tr("&Delete"), this, SLOT(DeleteObjekt()), CTRL+Key_K); |
3 | paul | 760 | SetKeyEntry(22, tr("Delete"), Loesch, CTRL+Key_K); |
761 | ObjMenu->insertSeparator(); |
||
308 | Franz | 762 | Gr = ObjMenu->insertItem( tr("&Group"), this, SLOT(GroupObj()), CTRL+Key_G); |
3 | paul | 763 | SetKeyEntry(23, tr("Group"), Gr, CTRL+Key_G); |
308 | Franz | 764 | UnGr = ObjMenu->insertItem( tr("&Ungroup"), this, SLOT(UnGroupObj()),CTRL+Key_U); |
74 | Franz | 765 | SetKeyEntry(24, tr("Un-group"), UnGr, CTRL+Key_U); |
319 | Franz | 766 | LockOb = ObjMenu->insertItem( tr("&Lock"), this, SLOT(ToggleObjLock()), CTRL+Key_F); |
3 | paul | 767 | ObjMenu->insertSeparator(); |
308 | Franz | 768 | OBack = ObjMenu->insertItem( tr("Send to &Back"), this, SLOT(Objekt2Back())); |
3 | paul | 769 | SetKeyEntry(25, tr("Send to Back"), OBack, 0); |
308 | Franz | 770 | OFront = ObjMenu->insertItem( tr("Bring to &Front"), this, SLOT(Objekt2Front())); |
3 | paul | 771 | SetKeyEntry(26, tr("Bring to Front"), OFront, 0); |
308 | Franz | 772 | OLower = ObjMenu->insertItem( tr("&Lower"), this, SLOT(ObjektLower())); |
3 | paul | 773 | SetKeyEntry(27, tr("Lower"), OLower, 0); |
308 | Franz | 774 | ORaise = ObjMenu->insertItem( tr("&Raise"), this, SLOT(ObjektRaise())); |
3 | paul | 775 | SetKeyEntry(28, tr("Raise"), ORaise, 0); |
308 | Franz | 776 | DistM = ObjMenu->insertItem( tr("Distribute/&Align..."), this, SLOT(ObjektAlign())); |
3 | paul | 777 | SetKeyEntry(29, tr("Distribute/Align..."), DistM, 0); |
778 | ObjMenu->insertSeparator(); |
||
779 | ShapeMenu = new QPopupMenu(); |
||
169 | Franz | 780 | SCustom = new Autoforms(0); |
781 | ShapeMenu->insertItem(SCustom); |
||
272 | Franz | 782 | connect(SCustom, SIGNAL(FormSel(int, int, double *)), this, SLOT(MakeFrame(int, int, double *))); |
377 | Franz | 783 | ShapeEdit = ShapeMenu->insertItem( tr("&Edit Shape"), this, SLOT(ToggleFrameEdit())); |
308 | Franz | 784 | ShapeM = ObjMenu->insertItem( tr("&Shape"), ShapeMenu); |
785 | PfadT = ObjMenu->insertItem( tr("&Attach Text to Path"), this, SLOT(Pfadtext())); |
||
786 | PfadDT = ObjMenu->insertItem( tr("&Detach Text from Path"), this, SLOT(noPfadtext())); |
||
787 | PfadV = ObjMenu->insertItem( tr("&Combine Polygons"), this, SLOT(UniteOb())); |
||
788 | PfadS = ObjMenu->insertItem( tr("Split &Polygons"), this, SLOT(SplitUniteOb())); |
||
789 | PfadTP = ObjMenu->insertItem( tr("C&onvert to Outlines"), this, SLOT(TraceText())); |
||
3 | paul | 790 | ObjMenu->setItemEnabled(ShapeM, 0); |
791 | ObjMenu->setItemEnabled(DistM, 0); |
||
792 | ObjMenu->setItemEnabled(Gr, 0); |
||
793 | ObjMenu->setItemEnabled(UnGr, 0); |
||
794 | ObjMenu->setItemEnabled(PfadT, 0); |
||
162 | Franz | 795 | ObjMenu->setItemEnabled(PfadDT, 0); |
3 | paul | 796 | ObjMenu->setItemEnabled(PfadV, 0); |
797 | ObjMenu->setItemEnabled(PfadS, 0); |
||
798 | ObjMenu->setItemEnabled(LockOb, 0); |
||
799 | ObjMenu->setItemEnabled(PfadTP, 0); |
||
800 | pageMenu = new QPopupMenu(); |
||
308 | Franz | 801 | MenID = pageMenu->insertItem( tr("&Insert..."), this, SLOT(slotNewPageM())); |
3 | paul | 802 | SetKeyEntry(30, tr("Insert..."), MenID, 0); |
308 | Franz | 803 | pgmd = pageMenu->insertItem( tr("&Delete..."), this, SLOT(DeletePage())); |
3 | paul | 804 | SetKeyEntry(31, tr("Delete..."), pgmd, 0); |
308 | Franz | 805 | MenID = pageMenu->insertItem( tr("&Copy")+"...", this, SLOT(CopyPage())); |
3 | paul | 806 | SetKeyEntry(61, tr("Copy")+"...", MenID, 0); |
308 | Franz | 807 | pgmv = pageMenu->insertItem( tr("&Move..."), this, SLOT(MovePage())); |
3 | paul | 808 | SetKeyEntry(32, tr("Move..."), pgmv, 0); |
308 | Franz | 809 | MenID = pageMenu->insertItem( tr("&Apply Template..."), this, SLOT(ApplyTemp())); |
3 | paul | 810 | SetKeyEntry(33, tr("Apply Template..."), MenID, 0); |
348 | Franz | 811 | MenID = pageMenu->insertItem( tr("Manage &Guides..."), this, SLOT(ManageGuides())); |
3 | paul | 812 | SetKeyEntry(49, tr("Manage Guides..."), MenID, 0); |
813 | pageMenu->setItemEnabled(pgmd, 0); |
||
814 | pageMenu->setItemEnabled(pgmv, 0); |
||
815 | viewMenu=new QPopupMenu(); |
||
308 | Franz | 816 | MenID = viewMenu->insertItem( tr("&Fit in Window"), this, SLOT(slotZoomFit()), CTRL+Key_0); |
3 | paul | 817 | SetKeyEntry(34, tr("Fit in Window"), MenID, CTRL+Key_0); |
308 | Franz | 818 | MenID = viewMenu->insertItem("&50%", this, SLOT(slotZoom50())); |
3 | paul | 819 | SetKeyEntry(35, tr("50%"), MenID, 0); |
308 | Franz | 820 | MenID = viewMenu->insertItem("&75%", this, SLOT(slotZoom75())); |
3 | paul | 821 | SetKeyEntry(36, tr("75%"), MenID, 0); |
308 | Franz | 822 | MenID = viewMenu->insertItem( tr("&100%"), this, SLOT(slotZoom100()), CTRL+Key_1); |
340 | Franz | 823 | SetKeyEntry(37, tr("100%"), MenID, CTRL+Key_1); |
308 | Franz | 824 | MenID = viewMenu->insertItem("&200%", this, SLOT(slotZoom200())); |
3 | paul | 825 | SetKeyEntry(38, tr("200%"), MenID, 0); |
308 | Franz | 826 | MenID = viewMenu->insertItem( tr("&Thumbnails"), this, SLOT(slotZoom20())); |
3 | paul | 827 | SetKeyEntry(39, tr("Thumbnails"), MenID, 0); |
828 | viewMenu->insertSeparator(); |
||
327 | Franz | 829 | Markers = viewMenu->insertItem( tr("Show &Margins"), this, SLOT(ToggleMarks())); |
3 | paul | 830 | SetKeyEntry(40, tr("Hide Margins"), Markers, 0); |
327 | Franz | 831 | viewMenu->setItemChecked(Markers, true); |
832 | FrameDr = viewMenu->insertItem( tr("Show &Frames"), this, SLOT(ToggleFrames())); |
||
3 | paul | 833 | SetKeyEntry(41, tr("Hide Frames"), FrameDr, 0); |
327 | Franz | 834 | viewMenu->setItemChecked(FrameDr, true); |
835 | Bilder = viewMenu->insertItem( tr("Show &Images"), this, SLOT(TogglePics())); |
||
836 | viewMenu->setItemChecked(Bilder, true); |
||
3 | paul | 837 | SetKeyEntry(42, tr("Hide Images"), Bilder, 0); |
308 | Franz | 838 | Ras = viewMenu->insertItem( tr("Show &Grid"), this, SLOT(ToggleRaster())); |
3 | paul | 839 | SetKeyEntry(43, tr("Show Grid"), Ras, 0); |
327 | Franz | 840 | viewMenu->setItemChecked(Ras, false); |
841 | Guide = viewMenu->insertItem( tr("Show G&uides"), this, SLOT(ToggleGuides())); |
||
842 | viewMenu->setItemChecked(Guide, true); |
||
340 | Franz | 843 | Base = viewMenu->insertItem( tr("Show &Baseline Grid"), this, SLOT(ToggleBase())); |
844 | viewMenu->insertSeparator(); |
||
845 | uRas = viewMenu->insertItem( tr("Sn&ap to Grid"), this, SLOT(ToggleURaster())); |
||
846 | SetKeyEntry(44, tr("Snap to Grid"), uRas, 0); |
||
308 | Franz | 847 | uGuide = viewMenu->insertItem( tr("Sna&p to Guides"), this, SLOT(ToggleUGuides())); |
3 | paul | 848 | toolMenu=new QPopupMenu(); |
308 | Franz | 849 | viewMpal = toolMenu->insertItem( tr("&Properties"), this, SLOT(ToggleMpal())); |
119 | Franz | 850 | SetKeyEntry(46, tr("Properties"), viewMpal, 0); |
308 | Franz | 851 | viewTpal = toolMenu->insertItem( tr("&Outline"), this, SLOT(ToggleTpal())); |
119 | Franz | 852 | SetKeyEntry(47, tr("Outline"), viewTpal, 0); |
308 | Franz | 853 | viewBpal = toolMenu->insertItem( tr("&Scrapbook"), this, SLOT(ToggleBpal())); |
119 | Franz | 854 | SetKeyEntry(48, tr("Scrapbook"), viewBpal, 0); |
308 | Franz | 855 | viewLpal = toolMenu->insertItem( tr("&Layers"), this, SLOT(ToggleLpal())); |
856 | viewSepal = toolMenu->insertItem( tr("P&age Palette"), this, SLOT(ToggleSepal())); |
||
857 | viewBopal = toolMenu->insertItem( tr("&Bookmarks"), this, SLOT(ToggleBookpal())); |
||
3 | paul | 858 | extraMenu=new QPopupMenu(); |
308 | Franz | 859 | MenID = extraMenu->insertItem( tr("&Manage Pictures"), this, SLOT(StatusPic())); |
3 | paul | 860 | SetKeyEntry(51, tr("Manage Pictures"), MenID, 0); |
308 | Franz | 861 | hyph = extraMenu->insertItem( tr("&Hyphenate Text"), this, SLOT(doHyphenate())); |
3 | paul | 862 | extraMenu->setItemEnabled(hyph, 0); |
863 | SetKeyEntry(50, tr("Hyphenate Text"), hyph, 0); |
||
284 | Franz | 864 | |
865 | settingsMenu = new QPopupMenu(); |
||
308 | Franz | 866 | tip = settingsMenu->insertItem( tr("Toolti&ps"), this, SLOT(ToggleTips())); |
867 | toolbarMenuTools = settingsMenu->insertItem( tr("&Tools"), this, SLOT(ToggleTools())); |
||
868 | toolbarMenuPDFTools = settingsMenu->insertItem( tr("P&DF Tools"), this, SLOT(TogglePDFTools())); |
||
284 | Franz | 869 | SetKeyEntry(45, tr("Tools"), toolbarMenuTools, 0); |
308 | Franz | 870 | SetKeyEntry(55, tr("Tooltips"), tip, 0); |
284 | Franz | 871 | tipsOn = true; |
872 | settingsMenu->setItemChecked(tip, tipsOn); |
||
873 | settingsMenu->insertSeparator(); |
||
341 | Franz | 874 | MenID = settingsMenu->insertItem( tr("P&references..."), this , SLOT(slotPrefsOrg())); |
308 | Franz | 875 | MenID = settingsMenu->insertItem( tr("&Fonts..."), this , SLOT(slotFontOrg())); |
284 | Franz | 876 | SetKeyEntry(17, tr("Fonts..."), MenID, 0); |
308 | Franz | 877 | settingsMenu->insertItem( tr("&Hyphenator..."), this, SLOT(configHyphenator())); |
878 | settingsMenu->insertItem( tr("&Keyboard Shortcuts..."), this, SLOT(DefKB())); |
||
284 | Franz | 879 | |
3 | paul | 880 | windowsMenu = new QPopupMenu(); |
881 | windowsMenu->setCheckable( true ); |
||
882 | connect(windowsMenu, SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
||
883 | helpMenu=new QPopupMenu(); |
||
308 | Franz | 884 | MenID = helpMenu->insertItem( tr("&About Scribus"), this, SLOT(slotHelpAbout())); |
3 | paul | 885 | SetKeyEntry(52, tr("About Scribus"), MenID, 0); |
308 | Franz | 886 | MenID = helpMenu->insertItem( tr("About &Qt"), this, SLOT(slotHelpAboutQt())); |
3 | paul | 887 | SetKeyEntry(53, tr("About Qt"), MenID, 0); |
888 | helpMenu->insertSeparator(); |
||
308 | Franz | 889 | MenID = helpMenu->insertItem( tr("Scribus &Manual..."), this, SLOT(slotOnlineHelp())); |
3 | paul | 890 | SetKeyEntry(54, tr("Online-Help..."), MenID, 0); |
456 | fschmid | 891 | |
892 | /* editMenu->insertItem( tr("Test"), this, SLOT(slotTest())); |
||
893 | editMenu->insertItem( tr("Test2"), this, SLOT(slotTest2())); |
||
894 | */ |
||
237 | Franz | 895 | menuBar()->insertItem( tr("&File"), fileMenu); |
896 | menuBar()->insertItem( tr("&Edit"), editMenu); |
||
308 | Franz | 897 | Stm = menuBar()->insertItem( tr("St&yle"), StilMenu); |
238 | Franz | 898 | Obm = menuBar()->insertItem( tr("&Item"), ObjMenu); |
899 | pgmm = menuBar()->insertItem( tr("&Page"), pageMenu); |
||
175 | Franz | 900 | menuBar()->setItemEnabled(Stm, 0); |
3 | paul | 901 | menuBar()->setItemEnabled(Obm, 0); |
902 | menuBar()->setItemEnabled(pgmm, 0); |
||
272 | Franz | 903 | ViMen = menuBar()->insertItem( tr("&View"), viewMenu); |
904 | menuBar()->setItemEnabled(ViMen, 0); |
||
237 | Franz | 905 | menuBar()->insertItem( tr("&Tools"), toolMenu); |
238 | Franz | 906 | exmn = menuBar()->insertItem( tr("E&xtras"), extraMenu); |
3 | paul | 907 | menuBar()->setItemEnabled(exmn, 0); |
284 | Franz | 908 | SetMen = menuBar()->insertItem( tr("&Settings"), settingsMenu ); |
272 | Franz | 909 | WinMen = menuBar()->insertItem( tr("&Windows"), windowsMenu ); |
910 | menuBar()->setItemEnabled(WinMen, 0); |
||
3 | paul | 911 | menuBar()->insertSeparator(); |
237 | Franz | 912 | menuBar()->insertItem( tr("&Help"), helpMenu); |
3 | paul | 913 | AliMenu = new QPopupMenu(); |
308 | Franz | 914 | AliMenu->insertItem( tr("&Left")); |
915 | AliMenu->insertItem( tr("&Center")); |
||
916 | AliMenu->insertItem( tr("&Right")); |
||
917 | AliMenu->insertItem( tr("&Block")); |
||
918 | AliMenu->insertItem( tr("&Forced")); |
||
3 | paul | 919 | ColorMenu = new QPopupMenu(); |
148 | Franz | 920 | ColorMenC = new QComboBox(false); |
921 | ColorMenC->setEditable(false); |
||
922 | ColorMenu->insertItem(ColorMenC); |
||
3 | paul | 923 | SizeTMenu = new QPopupMenu(); |
308 | Franz | 924 | SizeTMenu->insertItem( tr("&Other...")); |
617 | cbradney | 925 | QString ar_sizes[] = {" 7", " 9", "10", "11", "12", "14", "18", "24", "36", "48", "60", "72"}; |
274 | Franz | 926 | size_t f_size = sizeof(ar_sizes) / sizeof(*ar_sizes); |
927 | for (uint s = 0; s < f_size; ++s) |
||
928 | SizeTMenu->insertItem(ar_sizes[s] + tr(" pt")); |
||
3 | paul | 929 | ShadeMenu = new QPopupMenu(); |
308 | Franz | 930 | ShadeMenu->insertItem( tr("&Other...")); |
3 | paul | 931 | ShadeMenu->insertItem("0 %"); |
932 | ShadeMenu->insertItem("10 %"); |
||
933 | ShadeMenu->insertItem("20 %"); |
||
934 | ShadeMenu->insertItem("30 %"); |
||
935 | ShadeMenu->insertItem("40 %"); |
||
936 | ShadeMenu->insertItem("50 %"); |
||
937 | ShadeMenu->insertItem("60 %"); |
||
938 | ShadeMenu->insertItem("70 %"); |
||
939 | ShadeMenu->insertItem("80 %"); |
||
940 | ShadeMenu->insertItem("90 %"); |
||
941 | ShadeMenu->insertItem("100 %"); |
||
942 | FontMenu = new QPopupMenu(); |
||
943 | TypeStyleMenu = new QPopupMenu(); |
||
112 | Franz | 944 | TypeStyleMenu->insertItem( tr("Normal")); |
3 | paul | 945 | tmp = qApp->font(); |
946 | tmp = qApp->font(); |
||
947 | tmp.setUnderline(true); |
||
112 | Franz | 948 | TypeStyleMenu->insertItem(new FmItem( tr("Underline"), tmp)); |
3 | paul | 949 | tmp = qApp->font(); |
950 | tmp.setStrikeOut(true); |
||
112 | Franz | 951 | TypeStyleMenu->insertItem(new FmItem( tr("Strikethru"), tmp)); |
952 | TypeStyleMenu->insertItem( tr("Small Caps")); |
||
953 | TypeStyleMenu->insertItem( tr("Superscript")); |
||
954 | TypeStyleMenu->insertItem( tr("Subscript")); |
||
955 | TypeStyleMenu->insertItem( tr("Outlined")); |
||
3 | paul | 956 | } |
957 | |||
958 | void ScribusApp::initStatusBar() |
||
959 | { |
||
960 | FMess = new QLabel(statusBar(), "ft"); |
||
961 | FMess->setText(" "); |
||
962 | statusBar()->addWidget(FMess, 3, true); |
||
963 | FProg = new QProgressBar(statusBar(), "p"); |
||
272 | Franz | 964 | FProg->setCenterIndicator(true); |
3 | paul | 965 | FProg->setFixedWidth( 100 ); |
966 | statusBar()->addWidget(FProg, 0, true); |
||
967 | FProg->reset(); |
||
968 | XMess = new QLabel(statusBar(), "xt"); |
||
112 | Franz | 969 | XMess->setText( tr("X-Pos:")); |
3 | paul | 970 | statusBar()->addWidget(XMess, 0, true); |
971 | XDat = new QLabel(statusBar(), "dt"); |
||
972 | statusBar()->addWidget(XDat, 1, true); |
||
973 | XDat->setText(" "); |
||
974 | YMess = new QLabel(statusBar(), "yt"); |
||
112 | Franz | 975 | YMess->setText( tr("Y-Pos:")); |
3 | paul | 976 | statusBar()->addWidget(YMess, 0, true); |
977 | YDat = new QLabel(statusBar(), "ydt"); |
||
978 | statusBar()->addWidget(YDat, 1, true); |
||
80 | Franz | 979 | YDat->setText(" "); |
3 | paul | 980 | } |
981 | |||
80 | Franz | 982 | void ScribusApp::ReportMP(double xp, double yp) |
3 | paul | 983 | { |
984 | QString tmp, tmp2; |
||
173 | Franz | 985 | int multiplier, precision; |
986 | double divisor; |
||
3 | paul | 987 | switch (doc->Einheit) |
272 | Franz | 988 | { |
989 | case 0: |
||
274 | Franz | 990 | tmp2 = tr(" pt"); |
272 | Franz | 991 | multiplier = 100; |
992 | divisor = 100.0; |
||
993 | precision = 2; |
||
994 | break; |
||
995 | case 1: |
||
274 | Franz | 996 | tmp2 = tr(" mm"); |
272 | Franz | 997 | multiplier = 1000; |
998 | divisor = 1000.0; |
||
999 | precision = 3; |
||
1000 | break; |
||
1001 | case 2: |
||
274 | Franz | 1002 | tmp2 = tr(" in"); |
272 | Franz | 1003 | multiplier = 10000; |
1004 | divisor = 10000.0; |
||
1005 | precision = 4; |
||
1006 | break; |
||
1007 | case 3: |
||
274 | Franz | 1008 | tmp2 = tr(" p"); |
272 | Franz | 1009 | multiplier = 100; |
1010 | divisor = 100.0; |
||
1011 | precision = 2; |
||
1012 | break; |
||
1013 | default: // jjsa 21-03-2004 added default (complains for lint) |
||
274 | Franz | 1014 | tmp2 = tr(" pt"); |
272 | Franz | 1015 | multiplier = 100; |
1016 | divisor = 100.0; |
||
1017 | precision = 2; |
||
1018 | break; |
||
1019 | } |
||
173 | Franz | 1020 | XDat->setText(tmp.setNum(qRound(xp*UmReFaktor * multiplier) / divisor, 'f', precision)+tmp2); |
1021 | YDat->setText(tmp.setNum(qRound(yp*UmReFaktor * multiplier) / divisor, 'f', precision)+tmp2); |
||
3 | paul | 1022 | } |
1023 | |||
1024 | void ScribusApp::SetKeyEntry(int Nr, QString text, int Men, int KeyC) |
||
1025 | { |
||
1026 | Keys ke; |
||
1027 | ke.Name = text; |
||
1028 | ke.MenuID = Men; |
||
1029 | ke.KeyID = KeyC; |
||
1030 | Prefs.KeyActions.insert(Nr, ke); |
||
1031 | } |
||
1032 | |||
1033 | void ScribusApp::DeleteSel(PageItem *b) |
||
1034 | { |
||
1035 | Pti *it; |
||
238 | Franz | 1036 | int FirstSel = 0; |
1037 | bool first = false; |
||
272 | Franz | 1038 | for (it = b->Ptext.first(); it != 0; it = b->Ptext.next()) |
1039 | { |
||
1040 | if (it->cselect) |
||
1041 | { |
||
238 | Franz | 1042 | first = true; |
272 | Franz | 1043 | b->Ptext.remove(); |
1044 | it = b->Ptext.prev(); |
||
1045 | if (it == 0) |
||
1046 | it = b->Ptext.first(); |
||
1047 | } |
||
238 | Franz | 1048 | if (!first) |
1049 | FirstSel++; |
||
272 | Franz | 1050 | } |
3 | paul | 1051 | if (b->Ptext.count() != 0) |
238 | Franz | 1052 | { |
272 | Franz | 1053 | if (b->Ptext.first()->cselect) |
3 | paul | 1054 | { |
272 | Franz | 1055 | b->Ptext.remove(); |
3 | paul | 1056 | b->CPos = 0; |
238 | Franz | 1057 | } |
3 | paul | 1058 | else |
238 | Franz | 1059 | b->CPos = FirstSel; |
1060 | } |
||
3 | paul | 1061 | else |
1062 | b->CPos = 0; |
||
272 | Franz | 1063 | b->HasSel = false; |
1064 | DisableTxEdit(); |
||
3 | paul | 1065 | } |
1066 | |||
1067 | void ScribusApp::setTBvals(PageItem *b) |
||
1068 | { |
||
1069 | if (b->Ptext.count() != 0) |
||
272 | Franz | 1070 | { |
1071 | int ChPos = QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)); |
||
1072 | doc->CurrentStyle = b->Ptext.at(ChPos)->cstyle & 127; |
||
1073 | doc->CurrentABStil = b->Ptext.at(ChPos)->cab; |
||
1074 | setAbsValue(doc->CurrentABStil); |
||
1075 | Mpal->setAli(doc->CurrentABStil); |
||
1076 | doc->CurrFont = b->Ptext.at(ChPos)->cfont; |
||
1077 | doc->CurrFontSize = b->Ptext.at(ChPos)->csize; |
||
1078 | doc->CurrTextFill = b->Ptext.at(ChPos)->ccolor; |
||
1079 | doc->CurrTextFillSh = b->Ptext.at(ChPos)->cshade; |
||
1080 | doc->CurrTextStroke = b->Ptext.at(ChPos)->cstroke; |
||
1081 | doc->CurrTextStrokeSh = b->Ptext.at(ChPos)->cshade2; |
||
1082 | doc->CurrTextScale = b->Ptext.at(ChPos)->cscale; |
||
68 | Franz | 1083 | emit TextFarben(doc->CurrTextStroke, doc->CurrTextFill, doc->CurrTextStrokeSh, doc->CurrTextFillSh); |
1084 | emit TextIFont(doc->CurrFont); |
||
272 | Franz | 1085 | emit TextISize(doc->CurrFontSize); |
1086 | emit TextUSval(b->Ptext.at(ChPos)->cextra); |
||
1087 | emit TextStil(doc->CurrentStyle); |
||
68 | Franz | 1088 | emit TextScale(doc->CurrTextScale); |
272 | Franz | 1089 | } |
3 | paul | 1090 | } |
1091 | |||
1092 | void ScribusApp::wheelEvent(QWheelEvent *w) |
||
1093 | { |
||
1094 | if (HaveDoc) |
||
239 | Franz | 1095 | { |
276 | Franz | 1096 | if ((w->orientation() != Qt::Vertical) || ( w->state() & ShiftButton )) |
3 | paul | 1097 | { |
239 | Franz | 1098 | if (w->delta() < 0) |
240 | Franz | 1099 | view->scrollBy(Prefs.Wheelval, 0); |
239 | Franz | 1100 | else |
240 | Franz | 1101 | view->scrollBy(-Prefs.Wheelval, 0); |
239 | Franz | 1102 | } |
3 | paul | 1103 | else |
239 | Franz | 1104 | { |
1105 | if (w->delta() < 0) |
||
240 | Franz | 1106 | view->scrollBy(0, Prefs.Wheelval); |
239 | Franz | 1107 | else |
240 | Franz | 1108 | view->scrollBy(0, -Prefs.Wheelval); |
239 | Franz | 1109 | } |
3 | paul | 1110 | w->accept(); |
239 | Franz | 1111 | } |
3 | paul | 1112 | } |
1113 | |||
1114 | void ScribusApp::keyPressEvent(QKeyEvent *k) |
||
1115 | { |
||
146 | Franz | 1116 | QWidgetList windows; |
237 | Franz | 1117 | QWidget* w = NULL; |
3 | paul | 1118 | struct Pti *hg; |
1119 | int kk = k->key(); |
||
1120 | int as = k->ascii(); |
||
80 | Franz | 1121 | double altx, alty; |
3 | paul | 1122 | QString uc = k->text(); |
1123 | QString cr, Tcha, Twort; |
||
1124 | uint Tcoun; |
||
237 | Franz | 1125 | int len, pos, c; |
92 | Franz | 1126 | if (keyrep) |
1127 | return; |
||
1128 | keyrep = true; |
||
3 | paul | 1129 | switch (k->state()) |
272 | Franz | 1130 | { |
1131 | case ShiftButton: |
||
1132 | KeyMod = 0x00200000; |
||
1133 | break; |
||
1134 | case AltButton: |
||
1135 | KeyMod = 0x00800000; |
||
1136 | break; |
||
1137 | case ControlButton: |
||
1138 | KeyMod = 0x00400000; |
||
1139 | break; |
||
1140 | default: |
||
1141 | KeyMod = 0; |
||
1142 | break; |
||
1143 | } |
||
276 | Franz | 1144 | if (kk == Key_F10) |
1145 | { |
||
1146 | keyrep = false; |
||
1147 | ToggleAllPalettes(); |
||
1148 | return; |
||
1149 | } |
||
1150 | if ((kk == Key_F11) && (HaveDoc)) |
||
1151 | { |
||
1152 | keyrep = false; |
||
1153 | ToggleAllGuides(); |
||
1154 | return; |
||
1155 | } |
||
292 | Franz | 1156 | if ((kk == Key_Escape) && (HaveDoc)) |
1157 | { |
||
1158 | keyrep = false; |
||
1159 | NoFrameEdit(); |
||
1160 | slotSelect(); |
||
1161 | return; |
||
1162 | } |
||
232 | Franz | 1163 | ButtonState buttonState = k->state(); |
272 | Franz | 1164 | if ((HaveDoc) && (!view->LE->hasFocus()) && (!view->PGS->PageCombo->hasFocus())) |
1165 | { |
||
456 | fschmid | 1166 | if ((doc->AppMode != 7) && (view->SelItem.count() == 0)) |
272 | Franz | 1167 | { |
1168 | switch (kk) |
||
146 | Franz | 1169 | { |
272 | Franz | 1170 | case Key_Space: |
1171 | keyrep = false; |
||
1172 | if (doc->AppMode == 23) |
||
1173 | setAppMode(1); |
||
1174 | else |
||
1175 | { |
||
1176 | setAppMode(23); |
||
1177 | qApp->setOverrideCursor(QCursor(loadIcon("HandC.xpm")), true); |
||
1178 | } |
||
1179 | return; |
||
1180 | break; |
||
1181 | case Key_Prior: |
||
1182 | view->scrollBy(0, -Prefs.Wheelval); |
||
1183 | keyrep = false; |
||
1184 | return; |
||
1185 | break; |
||
1186 | case Key_Next: |
||
1187 | view->scrollBy(0, Prefs.Wheelval); |
||
1188 | keyrep = false; |
||
1189 | return; |
||
1190 | break; |
||
1191 | case Key_Tab: |
||
1192 | keyrep = false; |
||
1193 | windows = wsp->windowList(); |
||
1194 | if (windows.count() > 1) |
||
1195 | { |
||
1196 | for (int i = 0; i < static_cast<int>(windows.count()); ++i) |
||
250 | Franz | 1197 | { |
272 | Franz | 1198 | if (wsp->activeWindow() == windows.at(i)) |
1199 | { |
||
1200 | if (i == static_cast<int>(windows.count()-1)) |
||
1201 | w = windows.at(0); |
||
1202 | else |
||
1203 | w = windows.at(i+1); |
||
1204 | break; |
||
1205 | } |
||
250 | Franz | 1206 | } |
272 | Franz | 1207 | doc->OpenNodes = Tpal->buildReopenVals(); |
1208 | if ( w ) |
||
1209 | w->showNormal(); |
||
1210 | newActWin(w); |
||
1211 | } |
||
1212 | return; |
||
1213 | break; |
||
1214 | } |
||
1215 | } |
||
456 | fschmid | 1216 | if (view->SelItem.count() != 0) |
272 | Franz | 1217 | { |
456 | fschmid | 1218 | PageItem *b = view->SelItem.at(0); |
358 | Franz | 1219 | if (kk == Key_F9) |
1220 | { |
||
1221 | keyrep = false; |
||
1222 | if (doc->AppMode == 7) |
||
1223 | setAppMode(1); |
||
1224 | else |
||
1225 | setAppMode(7); |
||
1226 | return; |
||
1227 | } |
||
272 | Franz | 1228 | switch (doc->AppMode) |
1229 | { |
||
1230 | case 1: |
||
1231 | switch (kk) |
||
1232 | { |
||
360 | Franz | 1233 | case Key_Backspace: |
272 | Franz | 1234 | case Key_Delete: |
1235 | if (!doc->EditClip) |
||
1236 | { |
||
1237 | if ((!b->Locked) && (!((b->isTableItem) && (b->isSingleSel)))) |
||
456 | fschmid | 1238 | view->DeleteItem(); |
272 | Franz | 1239 | } |
1240 | break; |
||
360 | Franz | 1241 | case Key_Prior: |
1242 | if (!b->Locked) |
||
456 | fschmid | 1243 | view->RaiseItem(); |
360 | Franz | 1244 | break; |
1245 | case Key_Next: |
||
1246 | if (!b->Locked) |
||
456 | fschmid | 1247 | view->LowerItem(); |
360 | Franz | 1248 | break; |
272 | Franz | 1249 | case Key_Left: |
1250 | if (!k->isAutoRepeat()) |
||
1251 | { |
||
456 | fschmid | 1252 | view->storeUndoInf(b); |
272 | Franz | 1253 | doc->UnData.UnCode = 1; |
1254 | doc->UnDoValid = true; |
||
1255 | CanUndo(); |
||
1256 | } |
||
1257 | if (!b->Locked) |
||
1258 | { |
||
1259 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1260 | view->moveGroup(-10, 0); |
272 | Franz | 1261 | else if ( buttonState & ControlButton ) |
456 | fschmid | 1262 | view->moveGroup(-0.1, 0); |
272 | Franz | 1263 | else |
456 | fschmid | 1264 | view->moveGroup(-1, 0); |
272 | Franz | 1265 | } |
1266 | break; |
||
1267 | case Key_Right: |
||
1268 | if (!k->isAutoRepeat()) |
||
1269 | { |
||
456 | fschmid | 1270 | view->storeUndoInf(b); |
272 | Franz | 1271 | doc->UnData.UnCode = 1; |
1272 | doc->UnDoValid = true; |
||
1273 | CanUndo(); |
||
1274 | } |
||
1275 | if (!b->Locked) |
||
1276 | { |
||
1277 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1278 | view->moveGroup(10, 0); |
272 | Franz | 1279 | else if ( buttonState & ControlButton ) |
456 | fschmid | 1280 | view->moveGroup(0.1, 0); |
272 | Franz | 1281 | else |
456 | fschmid | 1282 | view->moveGroup(1, 0); |
272 | Franz | 1283 | } |
1284 | break; |
||
1285 | case Key_Up: |
||
1286 | if (!k->isAutoRepeat()) |
||
1287 | { |
||
456 | fschmid | 1288 | view->storeUndoInf(b); |
272 | Franz | 1289 | doc->UnData.UnCode = 1; |
1290 | doc->UnDoValid = true; |
||
1291 | CanUndo(); |
||
1292 | } |
||
1293 | if (!b->Locked) |
||
1294 | { |
||
1295 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1296 | view->moveGroup(0, -10); |
272 | Franz | 1297 | else if ( buttonState & ControlButton ) |
456 | fschmid | 1298 | view->moveGroup(0, -0.1); |
272 | Franz | 1299 | else |
456 | fschmid | 1300 | view->moveGroup(0, -1); |
272 | Franz | 1301 | } |
1302 | break; |
||
1303 | case Key_Down: |
||
1304 | if (!k->isAutoRepeat()) |
||
1305 | { |
||
456 | fschmid | 1306 | view->storeUndoInf(b); |
272 | Franz | 1307 | doc->UnData.UnCode = 1; |
1308 | doc->UnDoValid = true; |
||
1309 | CanUndo(); |
||
1310 | } |
||
1311 | if (!b->Locked) |
||
1312 | { |
||
1313 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1314 | view->moveGroup(0, 10); |
272 | Franz | 1315 | else if ( buttonState & ControlButton ) |
456 | fschmid | 1316 | view->moveGroup(0, 0.1); |
272 | Franz | 1317 | else |
456 | fschmid | 1318 | view->moveGroup(0, 1); |
272 | Franz | 1319 | } |
1320 | break; |
||
1321 | default: |
||
1322 | if (b->PType == 4) |
||
1323 | { |
||
1324 | if ((kk + KeyMod) == Prefs.KeyActions[59].KeyID) |
||
146 | Franz | 1325 | { |
272 | Franz | 1326 | setNewAbStyle(1); |
1327 | b->Tinput = true; |
||
456 | fschmid | 1328 | view->RefreshItem(b); |
272 | Franz | 1329 | } |
1330 | if ((kk + KeyMod) == Prefs.KeyActions[58].KeyID) |
||
1331 | { |
||
1332 | setNewAbStyle(2); |
||
1333 | b->Tinput = true; |
||
456 | fschmid | 1334 | view->RefreshItem(b); |
272 | Franz | 1335 | } |
1336 | if ((kk + KeyMod) == Prefs.KeyActions[57].KeyID) |
||
1337 | { |
||
1338 | setNewAbStyle(0); |
||
1339 | b->Tinput = true; |
||
456 | fschmid | 1340 | view->RefreshItem(b); |
272 | Franz | 1341 | } |
1342 | } |
||
1343 | break; |
||
1344 | } |
||
1345 | slotDocCh(); |
||
1346 | break; |
||
1347 | case 7: |
||
1348 | int oldPos = b->CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key |
||
456 | fschmid | 1349 | view->oldCp = b->CPos; |
272 | Franz | 1350 | if (b->PType == 4) |
1351 | { |
||
456 | fschmid | 1352 | view->slotDoCurs(false); |
272 | Franz | 1353 | switch (kk) |
1354 | { |
||
1355 | case Key_Prior: |
||
1356 | case Key_Next: |
||
1357 | case Key_End: |
||
1358 | case Key_Home: |
||
1359 | case Key_Right: |
||
1360 | case Key_Left: |
||
1361 | case Key_Up: |
||
1362 | case Key_Down: |
||
1363 | if ( (buttonState & ShiftButton) == 0 ) |
||
456 | fschmid | 1364 | view->deselectAll(b); |
272 | Franz | 1365 | } |
1366 | if (UniCinp) |
||
1367 | { |
||
1368 | int conv = 0; |
||
1369 | bool ok = false; |
||
1370 | UniCinS += uc; |
||
1371 | conv = UniCinS.toInt(&ok, 16); |
||
1372 | if (!ok) |
||
1373 | { |
||
1374 | UniCinp = false; |
||
1375 | UniCinC = 0; |
||
1376 | UniCinS = ""; |
||
1377 | keyrep = false; |
||
1378 | return; |
||
1379 | } |
||
1380 | UniCinC++; |
||
1381 | if (UniCinC == 4) |
||
1382 | { |
||
1383 | UniCinp = false; |
||
1384 | UniCinC = 0; |
||
1385 | UniCinS = ""; |
||
1386 | if (ok) |
||
146 | Franz | 1387 | { |
282 | Franz | 1388 | if (b->HasSel) |
1389 | DeleteSel(b); |
||
272 | Franz | 1390 | if (conv < 31) |
1391 | conv = 32; |
||
1392 | hg = new Pti; |
||
1393 | hg->ch = QString(QChar(conv)); |
||
1394 | hg->cfont = doc->CurrFont; |
||
1395 | hg->csize = doc->CurrFontSize; |
||
1396 | hg->ccolor = doc->CurrTextFill; |
||
1397 | hg->cshade = doc->CurrTextFillSh; |
||
1398 | hg->cstroke = doc->CurrTextStroke; |
||
1399 | hg->cshade2 = doc->CurrTextStrokeSh; |
||
1400 | hg->cscale = doc->CurrTextScale; |
||
1401 | hg->cselect = false; |
||
1402 | hg->cstyle = doc->CurrentStyle; |
||
1403 | hg->cab = doc->CurrentABStil; |
||
1404 | if (doc->Vorlagen[doc->CurrentABStil].Font != "") |
||
146 | Franz | 1405 | { |
272 | Franz | 1406 | hg->cfont = doc->Vorlagen[doc->CurrentABStil].Font; |
1407 | hg->csize = doc->Vorlagen[doc->CurrentABStil].FontSize; |
||
146 | Franz | 1408 | } |
272 | Franz | 1409 | hg->cextra = 0; |
1410 | hg->xp = 0; |
||
1411 | hg->yp = 0; |
||
1412 | hg->PRot = 0; |
||
1413 | hg->PtransX = 0; |
||
1414 | hg->PtransY = 0; |
||
1415 | b->Ptext.insert(b->CPos, hg); |
||
1416 | b->CPos += 1; |
||
1417 | b->Tinput = true; |
||
282 | Franz | 1418 | setTBvals(b); |
456 | fschmid | 1419 | view->RefreshItem(b); |
272 | Franz | 1420 | keyrep = false; |
1421 | return; |
||
146 | Franz | 1422 | } |
1423 | } |
||
272 | Franz | 1424 | else |
1425 | { |
||
1426 | keyrep = false; |
||
1427 | return; |
||
1428 | } |
||
1429 | } |
||
1430 | switch (kk) |
||
1431 | { |
||
1432 | case Key_F12: |
||
1433 | UniCinp = true; |
||
1434 | UniCinC = 0; |
||
1435 | UniCinS = ""; |
||
1436 | keyrep = false; |
||
1437 | return; |
||
1438 | break; |
||
291 | Franz | 1439 | case Key_Home: |
272 | Franz | 1440 | // go to begin of line |
1441 | if ( (pos = b->CPos) == 0 ) |
||
1442 | break; // at begin of frame |
||
1443 | len = static_cast<int>(b->Ptext.count()); |
||
1444 | if ( pos == len ) |
||
1445 | pos--; |
||
1446 | if ( (buttonState & ControlButton) == 0 ) |
||
1447 | { |
||
1448 | alty = b->Ptext.at(pos)->yp; |
||
1449 | c = b->Ptext.at(pos)->ch.at(0).latin1(); |
||
1450 | if ( c == 13 ) // new line, position is wrong |
||
1451 | if ( --pos > 0 ) |
||
1452 | alty = b->Ptext.at(pos)->yp; |
||
1453 | // check for yp at actual position |
||
1454 | if ( pos < len ) |
||
1455 | { |
||
1456 | altx = b->Ptext.at(pos)->yp; |
||
1457 | if ( altx > alty ) |
||
3 | paul | 1458 | { |
272 | Franz | 1459 | // we was at begin of line |
1460 | break; |
||
3 | paul | 1461 | } |
272 | Franz | 1462 | } |
1463 | while ( pos > 0 && b->Ptext.at(pos-1)->yp == alty ) |
||
1464 | pos--; |
||
1465 | if ( b->Ptext.at(pos)->ch.at(0).latin1() == 13 ) |
||
1466 | pos++; |
||
1467 | } |
||
1468 | else |
||
1469 | { |
||
1470 | // paragraph begin |
||
1471 | if ( pos < len && |
||
1472 | b->Ptext.at(pos)->ch.at(0).latin1() == 13 ) |
||
1473 | pos--; |
||
1474 | while(pos > 0 ) |
||
1475 | if ( b->Ptext.at(pos)->ch.at(0).latin1() == 13 ) |
||
3 | paul | 1476 | { |
272 | Franz | 1477 | pos++; |
1478 | break; |
||
3 | paul | 1479 | } |
272 | Franz | 1480 | else |
1481 | pos--; |
||
1482 | } |
||
1483 | b->CPos = pos; |
||
1484 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1485 | view->ExpandSel(b, -1, oldPos); |
272 | Franz | 1486 | break; |
291 | Franz | 1487 | case Key_End: |
272 | Franz | 1488 | // go to end of line |
1489 | len = static_cast<int>(b->Ptext.count()); |
||
1490 | if ( b->CPos >= len ) |
||
1491 | break; // at end of frame |
||
1492 | if ( (buttonState & ControlButton) == 0 ) |
||
1493 | { |
||
1494 | if ( b->CPos < len && b->Ptext.at(b->CPos)->ch.at(0).latin1() == 13 ) |
||
239 | Franz | 1495 | { |
272 | Franz | 1496 | // at end of paragraph and therefore line |
1497 | break; |
||
239 | Franz | 1498 | } |
272 | Franz | 1499 | alty = b->Ptext.at(b->CPos)->yp; |
1500 | while ( b->CPos < len-1 && b->Ptext.at(b->CPos+1)->yp == alty ) |
||
1501 | b->CPos++; |
||
1502 | |||
1503 | if ( b->CPos < len -1 ) |
||
1504 | c = b->Ptext.at(b->CPos+1)->ch.at(0).latin1(); |
||
1505 | else if ( b->CPos == len - 1 ) |
||
1506 | c = 13; |
||
1507 | else |
||
1508 | c = 0; |
||
1509 | if ( c == 13 ) |
||
1510 | b->CPos++; |
||
1511 | } |
||
1512 | else |
||
1513 | { |
||
1514 | // go to end of paragraph |
||
1515 | if ( b->Ptext.at(b->CPos)->ch.at(0).latin1() == 13 ) |
||
239 | Franz | 1516 | { |
272 | Franz | 1517 | break; |
239 | Franz | 1518 | } |
272 | Franz | 1519 | pos = b->CPos; |
1520 | while ( pos < len ) |
||
239 | Franz | 1521 | { |
272 | Franz | 1522 | if ( b->Ptext.at(pos)->ch.at(0).latin1() == 13 ) |
1523 | break; |
||
239 | Franz | 1524 | else |
272 | Franz | 1525 | pos++; |
239 | Franz | 1526 | } |
272 | Franz | 1527 | b->CPos = pos; |
1528 | } |
||
1529 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1530 | view->ExpandSel(b, 1, oldPos); |
272 | Franz | 1531 | break; |
1532 | case Key_Down: |
||
1533 | if (b->CPos != static_cast<int>(b->Ptext.count())) |
||
1534 | { |
||
1535 | alty = b->Ptext.at(b->CPos)->yp; |
||
1536 | altx = b->Ptext.at(b->CPos)->xp; |
||
1537 | do |
||
1538 | { |
||
1539 | b->CPos += 1; |
||
1540 | if (b->CPos == static_cast<int>(b->Ptext.count())) |
||
1541 | break; |
||
1542 | if (b->Ptext.at(b->CPos)->yp > alty) |
||
3 | paul | 1543 | { |
272 | Franz | 1544 | if (b->Ptext.at(b->CPos)->xp >= altx) |
1545 | break; |
||
3 | paul | 1546 | } |
239 | Franz | 1547 | } |
272 | Franz | 1548 | while (b->CPos < static_cast<int>(b->Ptext.count())); |
1549 | if ( buttonState & ShiftButton ) |
||
237 | Franz | 1550 | { |
272 | Franz | 1551 | if ( buttonState & AltButton ) |
1552 | b->CPos = b->Ptext.count(); |
||
456 | fschmid | 1553 | view->ExpandSel(b, 1, oldPos); |
237 | Franz | 1554 | } |
272 | Franz | 1555 | else |
1556 | if (b->CPos == static_cast<int>(b->Ptext.count())) |
||
1557 | if (b->NextBox != 0) |
||
253 | Franz | 1558 | { |
272 | Franz | 1559 | if (b->NextBox->Ptext.count() != 0) |
253 | Franz | 1560 | { |
456 | fschmid | 1561 | view->Deselect(true); |
272 | Franz | 1562 | b->NextBox->CPos = 0; |
456 | fschmid | 1563 | view->SelectItemNr(b->NextBox->ItemNr); |
272 | Franz | 1564 | b = b->NextBox; |
253 | Franz | 1565 | } |
1566 | } |
||
272 | Franz | 1567 | } |
1568 | else |
||
1569 | { |
||
1570 | if (b->NextBox != 0) |
||
1571 | { |
||
1572 | if (b->NextBox->Ptext.count() != 0) |
||
253 | Franz | 1573 | { |
456 | fschmid | 1574 | view->Deselect(true); |
272 | Franz | 1575 | b->NextBox->CPos = 0; |
456 | fschmid | 1576 | view->SelectItemNr(b->NextBox->ItemNr); |
272 | Franz | 1577 | b = b->NextBox; |
253 | Franz | 1578 | } |
1579 | } |
||
272 | Franz | 1580 | } |
1581 | if ( b->HasSel ) |
||
456 | fschmid | 1582 | view->RefreshItem(b); |
272 | Franz | 1583 | setTBvals(b); |
1584 | break; |
||
1585 | case Key_Up: |
||
1586 | if (b->CPos > 0) |
||
1587 | { |
||
1588 | if (b->CPos == static_cast<int>(b->Ptext.count())) |
||
1589 | b->CPos -= 1; |
||
1590 | alty = b->Ptext.at(b->CPos)->yp; |
||
1591 | altx = b->Ptext.at(b->CPos)->xp; |
||
1592 | if (b->CPos > 0) |
||
1593 | { |
||
1594 | do |
||
235 | Franz | 1595 | { |
272 | Franz | 1596 | b->CPos -= 1; |
1597 | if (b->CPos == 0) |
||
1598 | break; |
||
1599 | if (b->Ptext.at(b->CPos)->yp < alty) |
||
235 | Franz | 1600 | { |
272 | Franz | 1601 | if (b->Ptext.at(b->CPos)->xp <= altx) |
235 | Franz | 1602 | break; |
1603 | } |
||
1604 | } |
||
272 | Franz | 1605 | while (b->CPos > 0); |
1606 | } |
||
1607 | if ( buttonState & ShiftButton ) |
||
1608 | { |
||
1609 | if ( buttonState & AltButton ) |
||
1610 | b->CPos = 0; |
||
456 | fschmid | 1611 | view->ExpandSel(b, -1, oldPos); |
272 | Franz | 1612 | } |
1613 | else |
||
1614 | if (b->CPos == 0) |
||
237 | Franz | 1615 | { |
272 | Franz | 1616 | if (b->BackBox != 0) |
237 | Franz | 1617 | { |
456 | fschmid | 1618 | view->Deselect(true); |
3 | paul | 1619 | b->BackBox->CPos = b->BackBox->Ptext.count(); |
456 | fschmid | 1620 | view->SelectItemNr(b->BackBox->ItemNr); |
3 | paul | 1621 | b = b->BackBox; |
232 | Franz | 1622 | } |
272 | Franz | 1623 | } |
1624 | } |
||
1625 | else |
||
1626 | { |
||
1627 | b->CPos = 0; |
||
1628 | if (b->BackBox != 0) |
||
1629 | { |
||
456 | fschmid | 1630 | view->Deselect(true); |
272 | Franz | 1631 | b->BackBox->CPos = b->BackBox->Ptext.count(); |
456 | fschmid | 1632 | view->SelectItemNr(b->BackBox->ItemNr); |
272 | Franz | 1633 | b = b->BackBox; |
1634 | } |
||
1635 | } |
||
1636 | if ( b->HasSel ) |
||
456 | fschmid | 1637 | view->RefreshItem(b); |
272 | Franz | 1638 | setTBvals(b); |
1639 | break; |
||
291 | Franz | 1640 | case Key_Prior: |
272 | Franz | 1641 | b->CPos = 0; |
1642 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1643 | view->ExpandSel(b, -1, oldPos); |
272 | Franz | 1644 | setTBvals(b); |
1645 | break; |
||
291 | Franz | 1646 | case Key_Next: |
272 | Franz | 1647 | b->CPos = static_cast<int>(b->Ptext.count()); |
1648 | if ( buttonState & ShiftButton ) |
||
456 | fschmid | 1649 | view->ExpandSel(b, 1, oldPos); |
272 | Franz | 1650 | setTBvals(b); |
1651 | break; |
||
1652 | case Key_Left: |
||
1653 | if ( buttonState & ControlButton ) |
||
1654 | { |
||
456 | fschmid | 1655 | view->setNewPos(b, oldPos, b->Ptext.count(),-1); |
272 | Franz | 1656 | if ( buttonState & ShiftButton ) |
456 | fschmid | 1657 | view->ExpandSel(b, -1, oldPos); |
272 | Franz | 1658 | } |
1659 | else if ( buttonState & ShiftButton ) |
||
1660 | { |
||
1661 | b->CPos--; |
||
1662 | if ( b->CPos < 0 ) |
||
1663 | b->CPos = 0; |
||
1664 | else |
||
456 | fschmid | 1665 | view->ExpandSel(b, -1, oldPos); |
272 | Franz | 1666 | } |
1667 | else |
||
1668 | { |
||
1669 | b->CPos -= 1; |
||
1670 | if (b->CPos < 0) |
||
1671 | { |
||
1672 | b->CPos = 0; |
||
1673 | if (b->BackBox != 0) |
||
1674 | { |
||
456 | fschmid | 1675 | view->Deselect(true); |
272 | Franz | 1676 | b->BackBox->CPos = b->BackBox->Ptext.count(); |
456 | fschmid | 1677 | view->SelectItemNr(b->BackBox->ItemNr); |
272 | Franz | 1678 | b = b->BackBox; |
1679 | } |
||
1680 | } |
||
1681 | } |
||
405 | Franz | 1682 | if ((b->CPos > 0) && (b->CPos == static_cast<int>(b->Ptext.count()))) |
272 | Franz | 1683 | { |
283 | Franz | 1684 | if (b->Ptext.at(b->CPos-1)->cstyle & 256) |
1685 | { |
||
1686 | b->CPos -= 1; |
||
405 | Franz | 1687 | while ((b->CPos > 0) && (b->Ptext.at(b->CPos)->cstyle & 256)) |
283 | Franz | 1688 | { |
1689 | b->CPos--; |
||
1690 | if (b->CPos == 0) |
||
1691 | break; |
||
1692 | } |
||
1693 | } |
||
272 | Franz | 1694 | } |
283 | Franz | 1695 | else |
1696 | { |
||
405 | Franz | 1697 | while ((b->CPos > 0) && (b->Ptext.at(b->CPos)->cstyle & 256)) |
283 | Franz | 1698 | { |
1699 | b->CPos--; |
||
1700 | if (b->CPos == 0) |
||
1701 | break; |
||
1702 | } |
||
1703 | } |
||
272 | Franz | 1704 | if ( b->HasSel ) |
456 | fschmid | 1705 | view->RefreshItem(b); |
272 | Franz | 1706 | setTBvals(b); |
1707 | break; |
||
1708 | case Key_Right: |
||
1709 | if ( buttonState & ControlButton ) |
||
1710 | { |
||
456 | fschmid | 1711 | view->setNewPos(b, oldPos, b->Ptext.count(),1); |
272 | Franz | 1712 | if ( buttonState & ShiftButton ) |
456 | fschmid | 1713 | view->ExpandSel(b, 1, oldPos); |
272 | Franz | 1714 | } |
1715 | else if ( buttonState & ShiftButton ) |
||
1716 | { |
||
1717 | b->CPos++; |
||
1718 | if ( b->CPos > static_cast<int>(b->Ptext.count()) ) |
||
1719 | b->CPos--; |
||
1720 | else |
||
456 | fschmid | 1721 | view->ExpandSel(b, 1, oldPos); |
272 | Franz | 1722 | } |
1723 | else |
||
1724 | { |
||
1725 | b->CPos += 1; // new position within text ? |
||
1726 | if (b->CPos > static_cast<int>(b->Ptext.count())) |
||
1727 | { |
||
1728 | b->CPos -= 1; |
||
1729 | if (b->NextBox != 0) |
||
1730 | { |
||
1731 | if (b->NextBox->Ptext.count() != 0) |
||
232 | Franz | 1732 | { |
456 | fschmid | 1733 | view->Deselect(true); |
272 | Franz | 1734 | b->NextBox->CPos = 0; |
456 | fschmid | 1735 | view->SelectItemNr(b->NextBox->ItemNr); |
272 | Franz | 1736 | b = b->NextBox; |
232 | Franz | 1737 | } |
272 | Franz | 1738 | } |
1739 | } |
||
1740 | } |
||
1741 | if ( b->HasSel ) |
||
456 | fschmid | 1742 | view->RefreshItem(b); |
272 | Franz | 1743 | setTBvals(b); |
1744 | break; |
||
1745 | case Key_Delete: |
||
1746 | if (b->CPos == static_cast<int>(b->Ptext.count())) |
||
1747 | { |
||
1748 | if (b->HasSel) |
||
1749 | { |
||
1750 | DeleteSel(b); |
||
232 | Franz | 1751 | setTBvals(b); |
456 | fschmid | 1752 | view->RefreshItem(b); |
272 | Franz | 1753 | } |
1754 | keyrep = false; |
||
1755 | return; |
||
1756 | } |
||
1757 | if (b->Ptext.count() == 0) |
||
1758 | { |
||
1759 | keyrep = false; |
||
1760 | return; |
||
1761 | } |
||
1762 | cr = b->Ptext.at(b->CPos)->ch; |
||
1763 | if (b->HasSel) |
||
1764 | DeleteSel(b); |
||
1765 | else |
||
1766 | b->Ptext.remove(b->CPos); |
||
1767 | b->Tinput = false; |
||
1768 | if ((cr == QChar(13)) && (b->Ptext.count() != 0)) |
||
1769 | { |
||
456 | fschmid | 1770 | view->chAbStyle(b, b->Ptext.at(QMAX(b->CPos-1,0))->cab); |
272 | Franz | 1771 | b->Tinput = false; |
1772 | } |
||
1773 | setTBvals(b); |
||
456 | fschmid | 1774 | view->RefreshItem(b); |
272 | Franz | 1775 | break; |
1776 | case Key_Backspace: |
||
1777 | if (b->CPos == 0) |
||
1778 | { |
||
1779 | if (b->HasSel) |
||
1780 | { |
||
1781 | DeleteSel(b); |
||
1782 | setTBvals(b); |
||
456 | fschmid | 1783 | view->RefreshItem(b); |
272 | Franz | 1784 | } |
1785 | keyrep = false; |
||
1786 | return; |
||
1787 | } |
||
1788 | if (b->Ptext.count() == 0) |
||
1789 | { |
||
1790 | keyrep = false; |
||
1791 | return; |
||
1792 | } |
||
1793 | cr = b->Ptext.at(QMAX(b->CPos-1,0))->ch; |
||
1794 | if (b->HasSel) |
||
1795 | DeleteSel(b); |
||
1796 | else |
||
456 | fschmid | 1797 | { |
272 | Franz | 1798 | b->CPos -= 1; |
456 | fschmid | 1799 | b->Ptext.remove(b->CPos); |
1800 | } |
||
272 | Franz | 1801 | b->Tinput = false; |
1802 | if ((cr == QChar(13)) && (b->Ptext.count() != 0)) |
||
1803 | &nb |