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