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