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