Rev 109 | Rev 112 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | paul | 1 | /*************************************************************************** |
2 | scribus.cpp - description |
||
3 | ------------------- |
||
4 | begin : Fre Apr 6 21:09:31 CEST 2001 |
||
5 | copyright : (C) 2001 by Franz Schmid |
||
6 | email : Franz.Schmid@altmuehlnet.de |
||
7 | ***************************************************************************/ |
||
8 | |||
9 | /*************************************************************************** |
||
10 | * * |
||
11 | * This program is free software; you can redistribute it and/or modify * |
||
12 | * it under the terms of the GNU General Public License as published by * |
||
13 | * the Free Software Foundation; either version 2 of the License, or * |
||
14 | * (at your option) any later version. * |
||
15 | * * |
||
16 | ***************************************************************************/ |
||
17 | |||
18 | #include <qaccel.h> |
||
19 | #include <qapplication.h> |
||
20 | #include <qcolordialog.h> |
||
21 | #include <qcolor.h> |
||
22 | #include <qiconset.h> |
||
23 | #include <qtextstream.h> |
||
24 | #include <qstylefactory.h> |
||
25 | #include <qregexp.h> |
||
26 | #include <qtextcodec.h> |
||
27 | #include <qcursor.h> |
||
28 | #include <qvbox.h> |
||
29 | #include <cstdio> |
||
30 | #include <cstdlib> |
||
31 | #include <dlfcn.h> |
||
32 | #include <iostream> |
||
80 | Franz | 33 | #include <string> |
3 | paul | 34 | #include "scribus.h" |
35 | #include "scribus.moc" |
||
36 | #include "newfile.h" |
||
37 | #include "page.h" |
||
38 | #include "query.h" |
||
39 | #include "mdup.h" |
||
40 | #include "docinfo.h" |
||
41 | #include "reformdoc.h" |
||
42 | #include "serializer.h" |
||
43 | #include "align.h" |
||
44 | #include "fmitem.h" |
||
45 | #include "fontprefs.h" |
||
46 | #include "libprefs/prefs.h" |
||
47 | #include "pdfopts.h" |
||
48 | #include "inspage.h" |
||
49 | #include "delpages.h" |
||
50 | #include "movepage.h" |
||
51 | #include "helpbrowser.h" |
||
52 | #include "scribusXml.h" |
||
53 | #include "libabout/about.h" |
||
54 | #include "druck.h" |
||
55 | #include "editformats.h" |
||
56 | #include "muster.h" |
||
57 | #include "applytemplate.h" |
||
58 | #include "picstatus.h" |
||
59 | #include "customfdialog.h" |
||
60 | #include "cmsprefs.h" |
||
61 | #include "annot.h" |
||
62 | #include "annota.h" |
||
63 | #include "javadocs.h" |
||
64 | #include "config.h" |
||
65 | #include "fpoint.h" |
||
66 | #include "fpointarray.h" |
||
67 | #include "hysettings.h" |
||
68 | #include "guidemanager.h" |
||
69 | #include "mergedoc.h" |
||
27 | Franz | 70 | #include "lineformats.h" |
34 | Franz | 71 | #include "missing.h" |
102 | Franz | 72 | #include "story.h" |
3 | paul | 73 | extern QPixmap loadIcon(QString nam); |
90 | Franz | 74 | extern bool overwrite(QWidget *parent, QString filename); |
3 | paul | 75 | |
76 | using namespace std; |
||
77 | |||
78 | #ifdef HAVE_CMS |
||
79 | cmsHPROFILE CMSoutputProf; |
||
80 | cmsHPROFILE CMSprinterProf; |
||
81 | cmsHTRANSFORM stdTrans; |
||
82 | cmsHTRANSFORM stdProof; |
||
83 | cmsHTRANSFORM stdTransImg; |
||
84 | cmsHTRANSFORM stdProofImg; |
||
85 | bool SoftProofing; |
||
86 | bool Gamut; |
||
87 | bool CMSuse; |
||
88 | int IntentMonitor; |
||
89 | int IntentPrinter; |
||
90 | #endif |
||
91 | bool CMSavail; |
||
92 | ProfilesL InputProfiles; |
||
93 | int PolyC; |
||
94 | int PolyFd; |
||
80 | Franz | 95 | double PolyF; |
3 | paul | 96 | bool PolyS; |
80 | Franz | 97 | double PolyR; |
98 | double UmReFaktor; |
||
3 | paul | 99 | QString DocDir; |
100 | |||
17 | Franz | 101 | ScribusApp::ScribusApp(SplashScreen *splash) |
3 | paul | 102 | { |
103 | setCaption(tr("Scribus " VERSION)); |
||
83 | Franz | 104 | setIcon(loadIcon("AppIcon.png")); |
3 | paul | 105 | initMenuBar(); |
106 | initStatusBar(); |
||
107 | WerkTools2 = new QToolBar(tr("File"), this); |
||
108 | DatNeu = new QToolButton(loadIcon("DateiNeu.xpm"), tr("Creates a new Document"), QString::null, this, SLOT(slotFileNew()), WerkTools2); |
||
77 | Franz | 109 | DatOpe = new QToolButton(loadIcon("DateiOpen.xpm"), tr("Opens a Document"), QString::null, this, SLOT(slotDocOpen()), WerkTools2); |
110 | DatSav = new QToolButton(loadIcon("DateiSave.xpm"), tr("Saves the Current Document"), QString::null, this, SLOT(slotFileSave()), WerkTools2); |
||
111 | DatClo = new QToolButton(loadIcon("DateiClos.xpm"), tr("Closes the Current Document"), QString::null, this, SLOT(slotFileClose()), WerkTools2); |
||
112 | DatPri = new QToolButton(loadIcon("DateiPrint.xpm"), tr("Prints the Current Document"), QString::null, this, SLOT(slotFilePrint()), WerkTools2); |
||
113 | DatPDF = new QToolButton(loadIcon("acrobat.png"), tr("Saves the Current Document as PDF"), QString::null, this, SLOT(SaveAsPDF()), WerkTools2); |
||
80 | Franz | 114 | DatSav->setEnabled(false); |
73 | Franz | 115 | DatClo->setEnabled(false); |
77 | Franz | 116 | DatPri->setEnabled(false); |
80 | Franz | 117 | DatPDF->setEnabled(false); |
73 | Franz | 118 | DatOpe->setPopup(recentMenu); |
80 | Franz | 119 | WerkTools = new WerkToolB(this); |
73 | Franz | 120 | setDockEnabled(WerkTools, DockLeft, false); |
77 | Franz | 121 | setDockEnabled(WerkTools, DockRight, false); |
122 | WerkTools->Sichtbar = true; |
||
123 | WerkTools->setEnabled(false); |
||
124 | WerkToolsP = new WerkToolBP(this); |
||
80 | Franz | 125 | setDockEnabled(WerkToolsP, DockLeft, false); |
73 | Franz | 126 | setDockEnabled(WerkToolsP, DockRight, false); |
80 | Franz | 127 | WerkToolsP->setEnabled(false); |
73 | Franz | 128 | WerkToolsP->Sichtbar = true; |
80 | Franz | 129 | QString Pff = QString(getenv("HOME"))+"/.scribus"; |
73 | Franz | 130 | QFileInfo Pffi = QFileInfo(Pff); |
131 | if (Pffi.exists()) |
||
77 | Franz | 132 | { |
80 | Franz | 133 | if (Pffi.isDir()) |
73 | Franz | 134 | PrefsPfad = Pff; |
135 | else |
||
136 | PrefsPfad = QString(getenv("HOME")); |
||
77 | Franz | 137 | } |
73 | Franz | 138 | else |
77 | Franz | 139 | { |
3 | paul | 140 | QDir di = QDir(); |
73 | Franz | 141 | di.mkdir(Pff); |
142 | PrefsPfad = Pff; |
||
143 | QString OldPR = QString(getenv("HOME"))+"/.scribus.rc"; |
||
144 | QFileInfo OldPi = QFileInfo(OldPR); |
||
145 | if (OldPi.exists()) |
||
77 | Franz | 146 | { |
3 | paul | 147 | system("mv " + OldPR + " " + Pff+"/scribus.rc"); |
77 | Franz | 148 | } |
3 | paul | 149 | QString OldPR2 = QString(getenv("HOME"))+"/.scribusfont.rc"; |
150 | QFileInfo OldPi2 = QFileInfo(OldPR2); |
||
151 | if (OldPi2.exists()) |
||
152 | { |
||
153 | system("mv " + OldPR2 + " " + Pff+"/scribusfont.rc"); |
||
154 | } |
||
155 | QString OldPR3 = QString(getenv("HOME"))+"/.scribusscrap.scs"; |
||
156 | QFileInfo OldPi3 = QFileInfo(OldPR3); |
||
157 | if (OldPi3.exists()) |
||
158 | { |
||
159 | system("mv " + OldPR3 + " " + Pff+"/scrap.scs"); |
||
160 | } |
||
161 | } |
||
162 | /** Erstelle Fontliste */ |
||
163 | NoFonts = false; |
||
164 | BuFromApp = false; |
||
17 | Franz | 165 | splash->setStatus(tr("Searching for Fonts")); |
3 | paul | 166 | GetAllFonts(); |
167 | if (NoFonts) |
||
168 | { |
||
169 | QString mess = tr("There are no Postscript-Fonts on your System"); |
||
170 | mess += "\n" + tr("Exiting now"); |
||
171 | QMessageBox::critical(this, tr("Fatal Error"), mess, 1, 0, 0); |
||
172 | } |
||
173 | else |
||
174 | { |
||
175 | HaveDoc = 0; |
||
95 | Franz | 176 | view = NULL; |
177 | doc = NULL; |
||
3 | paul | 178 | BuildFontMenu(); |
179 | SCFontsIterator it(Prefs.AvailFonts); |
||
180 | Prefs.DefFont = it.currentKey(); |
||
111 | Franz | 181 | Prefs.DefSize = 120; |
81 | Franz | 182 | Prefs.AppFontSize = qApp->font().pointSize(); |
3 | paul | 183 | /** Default Farbenliste */ |
184 | Prefs.DColors.clear(); |
||
185 | Prefs.DColors.insert("White", CMYKColor(0, 0, 0, 0)); |
||
186 | Prefs.DColors.insert("Black", CMYKColor(0, 0, 0, 255)); |
||
187 | Prefs.DColors.insert("Blue", CMYKColor(255, 255, 0, 0)); |
||
188 | Prefs.DColors.insert("Cyan", CMYKColor(255, 0, 0, 0)); |
||
189 | Prefs.DColors.insert("Green", CMYKColor(255, 0, 255, 0)); |
||
190 | Prefs.DColors.insert("Red", CMYKColor(0, 255, 255, 0)); |
||
191 | Prefs.DColors.insert("Yellow", CMYKColor(0, 0, 255, 0)); |
||
192 | Prefs.DColors.insert("Magenta", CMYKColor(0, 255, 0, 0)); |
||
193 | DispX = 10; |
||
194 | DispY = 10; |
||
195 | Prefs.Wheelval = 40; |
||
196 | Prefs.GrabRad = 4; |
||
197 | Prefs.GuideRad = 10; |
||
198 | Prefs.DminGrid = 20; |
||
199 | Prefs.DmajGrid = 100; |
||
200 | DocNr = 1; |
||
201 | Prefs.DminColor = QColor(green); |
||
202 | Prefs.DmajColor = QColor(green); |
||
203 | Prefs.DpapColor = QColor(white); |
||
204 | Prefs.DmargColor = QColor(blue); |
||
205 | Prefs.guideColor = QColor(darkBlue); |
||
206 | Prefs.DVHoch = 33; |
||
207 | Prefs.DVHochSc = 100; |
||
208 | Prefs.DVTief = 33; |
||
209 | Prefs.DVTiefSc = 100; |
||
210 | Prefs.DVKapit = 75; |
||
211 | Prefs.GUI = "Default"; |
||
212 | Prefs.Dpen = "Black"; |
||
213 | Prefs.Dbrush = "Black"; |
||
214 | Prefs.Dshade = 100; |
||
215 | Prefs.Dshade2 = 100; |
||
216 | Prefs.DLineArt = SolidLine; |
||
217 | Prefs.Dwidth = 1; |
||
218 | Prefs.DpenLine = "Black"; |
||
219 | Prefs.DpenText = "Black"; |
||
220 | Prefs.DshadeLine = 100; |
||
221 | Prefs.DLstyleLine = SolidLine; |
||
222 | Prefs.DwidthLine = 1; |
||
223 | Prefs.MagMin = 10; |
||
224 | Prefs.MagMax = 800; |
||
225 | Prefs.MagStep = 25; |
||
226 | Prefs.DbrushPict = "White"; |
||
227 | Prefs.ShadePict = 100; |
||
228 | Prefs.ScaleX = 1; |
||
229 | Prefs.ScaleY = 1; |
||
230 | Prefs.Before = true; |
||
231 | Prefs.Einheit = 0; |
||
232 | UmReFaktor = 1.0; |
||
233 | PolyC = 4; |
||
234 | PolyF = 0.5; |
||
235 | PolyS = false; |
||
236 | PolyFd = 0; |
||
237 | PolyR = 0; |
||
238 | Prefs.PolyC = PolyC; |
||
239 | Prefs.PolyF = PolyF; |
||
240 | Prefs.PolyFd = PolyFd; |
||
241 | Prefs.PolyS = PolyS; |
||
242 | Prefs.PolyR = PolyR; |
||
243 | Prefs.Werkv = true; |
||
14 | Franz | 244 | Prefs.WerkvP = true; |
3 | paul | 245 | Prefs.Mpalv = false; |
246 | Prefs.Tpalv = false; |
||
247 | Prefs.SCpalv = false; |
||
248 | Prefs.Lpalv = false; |
||
249 | Prefs.Bopalv = false; |
||
87 | Franz | 250 | Prefs.Mpalx = 0; |
251 | Prefs.Mpaly = 0; |
||
252 | Prefs.Tpalx = 0; |
||
253 | Prefs.Tpaly = 0; |
||
254 | Prefs.SCpalx = 0; |
||
255 | Prefs.SCpaly = 0; |
||
256 | Prefs.SCpalw = 100; |
||
257 | Prefs.SCpalh = 200; |
||
258 | Prefs.Sepalx = 0; |
||
259 | Prefs.Sepaly = 0; |
||
260 | Prefs.Bopalx = 0; |
||
261 | Prefs.Bopaly = 0; |
||
262 | Prefs.Lpalx = 0; |
||
263 | Prefs.Lpaly = 0; |
||
3 | paul | 264 | Prefs.PSize = 40; |
265 | Prefs.SaveAtQ = true; |
||
266 | Prefs.ShFrames = true; |
||
267 | Prefs.PagesSbS = true; |
||
268 | Prefs.RecentDocs.clear(); |
||
269 | Prefs.RecentDCount = 5; |
||
270 | Prefs.RandFarbig = false; |
||
271 | Prefs.AutoLine = 20; |
||
272 | Prefs.PageFormat = 4; |
||
273 | Prefs.Ausrichtung = 0; |
||
274 | Prefs.PageBreite = 595; |
||
275 | Prefs.PageHoehe = 842; |
||
276 | Prefs.RandOben = 9; |
||
277 | Prefs.RandUnten = 40; |
||
278 | Prefs.RandLinks = 9; |
||
279 | Prefs.RandRechts = 9; |
||
280 | Prefs.DoppelSeiten = false; |
||
281 | Prefs.ErsteLinks = false; |
||
282 | Prefs.ScaleType = true; |
||
283 | Prefs.AspectRatio = true; |
||
284 | Prefs.MinWordLen = 3; |
||
285 | Prefs.Language = ""; |
||
286 | Prefs.Automatic = true; |
||
287 | Prefs.AutoCheck = false; |
||
288 | Prefs.PDFTransparency = false; |
||
289 | Prefs.AutoSave = false; |
||
290 | Prefs.AutoSaveTime = 600000; |
||
11 | Franz | 291 | Prefs.DisScale = 1.0; |
3 | paul | 292 | Prefs.DocDir = QString(getenv("HOME")); |
68 | Franz | 293 | Prefs.ProfileDir = ""; |
91 | Franz | 294 | Prefs.ScriptDir = ""; |
3 | paul | 295 | PDef.Pname = ""; |
296 | PDef.Dname = ""; |
||
297 | PDef.Command = ""; |
||
298 | PrinterUsed = false; |
||
299 | resize(610, 600); |
||
300 | QVBox* vb = new QVBox( this ); |
||
301 | vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); |
||
302 | wsp = new QWorkspace( vb ); |
||
303 | setCentralWidget( vb ); |
||
304 | connect(wsp, SIGNAL(windowActivated(QWidget *)), this, SLOT(newActWin(QWidget *))); |
||
77 | Franz | 305 | Tpal = new Tree(this, 0); |
32 | Franz | 306 | Mpal = new Mpalette(this, &Prefs); |
3 | paul | 307 | Mpal->Cpal->SetColors(Prefs.DColors); |
308 | Npal = new NodePalette(this); |
||
309 | Lpal = new LayerPalette(this); |
||
30 | Franz | 310 | ScBook = new Biblio(this, &Prefs); |
3 | paul | 311 | Sepal = new SeitenPal(this); |
312 | BookPal = new BookPalette(this); |
||
313 | CMSavail = false; |
||
92 | Franz | 314 | keyrep = false; |
3 | paul | 315 | Prefs.DCMSset.DefaultMonitorProfile = ""; |
316 | Prefs.DCMSset.DefaultPrinterProfile = ""; |
||
317 | Prefs.DCMSset.DefaultInputProfile = ""; |
||
318 | Prefs.DCMSset.DefaultInputProfile2 = ""; |
||
319 | Prefs.DCMSset.CMSinUse = false; |
||
320 | Prefs.DCMSset.SoftProofOn = false; |
||
321 | Prefs.DCMSset.GamutCheck = false; |
||
322 | Prefs.DCMSset.DefaultIntentMonitor = 1; |
||
323 | Prefs.DCMSset.DefaultIntentMonitor2 = 1; |
||
324 | Prefs.DCMSset.DefaultIntentPrinter = 0; |
||
325 | Prefs.GFontSub.clear(); |
||
326 | SetKeyEntry(56, tr("Smart Hyphen"), 0, ALT+Key_Minus); |
||
327 | SetKeyEntry(57, tr("Align Left"), 0, CTRL+Key_L); |
||
328 | SetKeyEntry(58, tr("Align Right"), 0, CTRL+Key_R); |
||
329 | SetKeyEntry(59, tr("Align Center"), 0, CTRL+Key_E); |
||
73 | Franz | 330 | SetKeyEntry(60, tr("Insert Page Number"), 0, ALT+Key_NumberSign); |
3 | paul | 331 | SetKeyEntry(61, tr("Attach Text to Path"), PfadT, 0); |
332 | SetKeyEntry(62, tr("Show Layers"), viewLpal, 0); |
||
73 | Franz | 333 | SetKeyEntry(63, tr("Javascripts..."), jman, 0); |
3 | paul | 334 | SetKeyEntry(64, tr("Undo"), edUndo, CTRL+Key_Z); |
335 | SetKeyEntry(65, tr("Show Page Palette"), viewSepal, 0); |
||
336 | SetKeyEntry(66, tr("Lock/Unlock"), LockOb, CTRL+Key_H); |
||
73 | Franz | 337 | SetKeyEntry(67, tr("Non Breaking Space"), 0, CTRL+Key_Space); |
68 | Franz | 338 | splash->setStatus(tr("Reading Preferences")); |
339 | ReadPrefs(); |
||
17 | Franz | 340 | splash->setStatus(tr("Getting ICC-Profiles")); |
3 | paul | 341 | GetCMSProfiles(); |
17 | Franz | 342 | splash->setStatus(tr("Init Hyphenator")); |
3 | paul | 343 | InitHyphenator(); |
344 | Mpal->Cpal->UseTrans(Prefs.PDFTransparency); |
||
68 | Franz | 345 | Mpal->Fonts->RebuildList(&Prefs); |
346 | Mpal->fillLangCombo(Sprachen); |
||
3 | paul | 347 | DocDir = Prefs.DocDir; |
17 | Franz | 348 | splash->setStatus(tr("")); |
349 | splash->setStatus(tr("Setting up Shortcuts")); |
||
3 | paul | 350 | SetShortCut(); |
351 | if (CMSavail) |
||
352 | { |
||
353 | hymen->insertItem(tr("Color Management..."), this , SLOT(SetCMSPrefs())); |
||
354 | ProfilesL::Iterator ip; |
||
355 | if ((Prefs.DCMSset.DefaultInputProfile == "") || (!InputProfiles.contains(Prefs.DCMSset.DefaultInputProfile))) |
||
356 | { |
||
357 | ip = InputProfiles.begin(); |
||
358 | Prefs.DCMSset.DefaultInputProfile = ip.key(); |
||
359 | } |
||
360 | if ((Prefs.DCMSset.DefaultInputProfile2 == "") || (!InputProfiles.contains(Prefs.DCMSset.DefaultInputProfile2))) |
||
361 | { |
||
362 | ip = InputProfiles.begin(); |
||
363 | Prefs.DCMSset.DefaultInputProfile2 = ip.key(); |
||
364 | } |
||
365 | if ((Prefs.DCMSset.DefaultMonitorProfile == "") || (!MonitorProfiles.contains(Prefs.DCMSset.DefaultMonitorProfile))) |
||
366 | { |
||
367 | ip = MonitorProfiles.begin(); |
||
368 | Prefs.DCMSset.DefaultMonitorProfile = ip.key(); |
||
369 | } |
||
370 | if ((Prefs.DCMSset.DefaultPrinterProfile == "") || (!PrinterProfiles.contains(Prefs.DCMSset.DefaultPrinterProfile))) |
||
371 | { |
||
372 | ip = PrinterProfiles.begin(); |
||
373 | Prefs.DCMSset.DefaultPrinterProfile = ip.key(); |
||
80 | Franz | 374 | } |
3 | paul | 375 | #ifdef HAVE_CMS |
376 | SoftProofing = Prefs.DCMSset.SoftProofOn; |
||
377 | CMSuse = false; |
||
378 | IntentPrinter = Prefs.DCMSset.DefaultIntentPrinter; |
||
379 | IntentMonitor = Prefs.DCMSset.DefaultIntentMonitor; |
||
380 | #endif |
||
381 | } |
||
17 | Franz | 382 | splash->setStatus(tr("Reading Scrapbook")); |
3 | paul | 383 | QString SCf = PrefsPfad+"/scrap.scs"; |
384 | QFileInfo SCfi = QFileInfo(SCf); |
||
385 | if (SCfi.exists()) |
||
386 | { |
||
387 | ScBook->BibWin->ReadContents(SCf); |
||
388 | ScBook->ScFilename = SCf; |
||
389 | } |
||
390 | ScBook->AdjustMenu(); |
||
391 | HaveGS = system("gs -h > /dev/null 2>&1"); |
||
17 | Franz | 392 | splash->setStatus(tr("Initializing Plugins")); |
393 | InitPlugs(splash); |
||
3 | paul | 394 | ClipB = QApplication::clipboard(); |
395 | connect(WerkTools, SIGNAL(NewMode(int)), this, SLOT(ModeFromTB(int))); |
||
396 | connect(WerkTools, SIGNAL(Schliessen()), this, SLOT(ToggleTools())); |
||
14 | Franz | 397 | connect(WerkToolsP, SIGNAL(NewMode(int)), this, SLOT(ModeFromTB(int))); |
398 | connect(WerkToolsP, SIGNAL(Schliessen()), this, SLOT(TogglePDFTools())); |
||
3 | paul | 399 | connect(Mpal, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); |
400 | connect(Mpal, SIGNAL(NewAbStyle(int)), this, SLOT(setNewAbStyle(int))); |
||
401 | connect(Mpal, SIGNAL(BackHome()), this, SLOT(Aktiv())); |
||
402 | connect(Mpal, SIGNAL(Stellung(int)), this, SLOT(setItemHoch(int))); |
||
403 | connect(Mpal, SIGNAL(Schliessen()), this, SLOT(ToggleMpal())); |
||
404 | connect(Mpal, SIGNAL(EditCL()), this, SLOT(ToggleFrameEdit())); |
||
32 | Franz | 405 | connect(Mpal, SIGNAL(NewTF(QString)), this, SLOT(SetNewFont(QString))); |
3 | paul | 406 | connect(Mpal->Cpal, SIGNAL(NewPen(QString)), this, SLOT(setPenFarbe(QString))); |
407 | connect(Mpal->Cpal, SIGNAL(NewBrush(QString)), this, SLOT(setBrushFarbe(QString))); |
||
408 | connect(Mpal->Cpal, SIGNAL(NewPenShade(int)), this, SLOT(setPenShade(int))); |
||
409 | connect(Mpal->Cpal, SIGNAL(NewBrushShade(int)), this, SLOT(setBrushShade(int))); |
||
80 | Franz | 410 | connect(Mpal->Cpal, SIGNAL(NewTrans(double)), this, SLOT(SetTranspar(double))); |
411 | connect(Mpal->Cpal, SIGNAL(NewTransS(double)), this, SLOT(SetTransparS(double))); |
||
3 | paul | 412 | connect(Mpal->Cpal, SIGNAL(NewGradient(int, QString, int, QString, int)), this, SLOT(setGradFill(int, QString, int, QString, int))); |
413 | connect(Mpal->Cpal, SIGNAL(QueryItem()), this, SLOT(GetBrushPen())); |
||
414 | connect(Tpal, SIGNAL(Schliessen()), this, SLOT(ToggleTpal())); |
||
415 | connect(Tpal, SIGNAL(SelectElement(int, int)), this, SLOT(SelectFromOutl(int, int))); |
||
416 | connect(Tpal, SIGNAL(SelectSeite(int)), this, SLOT(SelectFromOutlS(int))); |
||
417 | connect(Mpal->Spal, SIGNAL(NewStyle(int)), this, SLOT(setNewAbStyle(int))); |
||
418 | connect(Mpal->Spal, SIGNAL(EditSt()), this, SLOT(slotEditStyles())); |
||
27 | Franz | 419 | connect(Mpal, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles())); |
3 | paul | 420 | connect(Npal, SIGNAL(Schliessen()), this, SLOT(NoFrameEdit())); |
421 | connect(Lpal, SIGNAL(LayerActivated(int)), this, SLOT(changeLayer(int))); |
||
422 | connect(Lpal, SIGNAL(LayerRemoved(int)), this, SLOT(LayerRemove(int))); |
||
423 | connect(Lpal, SIGNAL(LayerChanged()), this, SLOT(showLayer())); |
||
424 | connect(Lpal, SIGNAL(Schliessen()), this, SLOT(ToggleLpal())); |
||
425 | connect(Sepal, SIGNAL(Schliessen()), this, SLOT(ToggleSepal())); |
||
426 | connect(ScBook, SIGNAL(Schliessen()), this, SLOT(ToggleBpal())); |
||
427 | connect(Sepal, SIGNAL(EditTemp(QString)), this, SLOT(ManageTemp(QString))); |
||
428 | connect(Sepal->PageView, SIGNAL(UseTemp(QString, int)), this, SLOT(Apply_Temp(QString, int))); |
||
429 | connect(Sepal->PageView, SIGNAL(NewPage(int, QString)), this, SLOT(slotNewPageP(int, QString))); |
||
430 | connect(Sepal->Trash, SIGNAL(DelPage(int)), this, SLOT(DeletePage2(int))); |
||
431 | connect(Sepal, SIGNAL(GotoSeite(int)), this, SLOT(SelectFromOutlS(int))); |
||
432 | connect(BookPal->BView, SIGNAL(MarkMoved()), this, SLOT(StoreBookmarks())); |
||
433 | connect(BookPal->BView, SIGNAL(ChangeBMNr(int, int, int)), this, SLOT(ChBookmarks(int, int, int))); |
||
434 | connect(BookPal, SIGNAL(Schliessen()), this, SLOT(ToggleBookpal())); |
||
435 | connect(recentMenu, SIGNAL(activated(int)), this, SLOT(LoadRecent(int))); |
||
436 | connect(ColorMenu, SIGNAL(activated(int)), this, SLOT(setItemFarbe(int))); |
||
437 | connect(ShadeMenu, SIGNAL(activated(int)), this, SLOT(setItemShade(int))); |
||
438 | connect(FontMenu, SIGNAL(activated(int)), this, SLOT(setItemFont(int))); |
||
439 | connect(SizeTMenu, SIGNAL(activated(int)), this, SLOT(setItemFSize(int))); |
||
440 | connect(TypeStyleMenu, SIGNAL(activated(int)), this, SLOT(setItemTypeStyle(int))); |
||
441 | connect(AliMenu, SIGNAL(activated(int)), this, SLOT(setItemTextAli(int))); |
||
442 | connect(this, SIGNAL(TextIFont(QString)), this, SLOT(AdjustFontMenu(QString))); |
||
443 | connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int))); |
||
444 | connect(this, SIGNAL(TextISize(int)), Mpal, SLOT(setSize(int))); |
||
80 | Franz | 445 | connect(this, SIGNAL(TextUSval(double)), Mpal, SLOT(setExtra(double))); |
3 | paul | 446 | connect(this, SIGNAL(TextStil(int)), Mpal, SLOT(setStil(int))); |
68 | Franz | 447 | connect(this, SIGNAL(TextScale(int)), Mpal, SLOT(setTScale(int))); |
448 | connect(this, SIGNAL(TextFarben(QString, QString, int, int)), Mpal, SLOT(setActFarben(QString, QString, int, int))); |
||
3 | paul | 449 | connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange())); |
450 | } |
||
451 | } |
||
452 | |||
453 | void ScribusApp::initMenuBar() |
||
454 | { |
||
455 | int a; |
||
456 | int MenID; |
||
457 | QFont tmp; |
||
458 | recentMenu = new QPopupMenu(); |
||
459 | RecentDocs.clear(); |
||
460 | fileMenu=new QPopupMenu(); |
||
461 | fid12 = fileMenu->insertItem(loadIcon("DateiNeu16.png"), tr("New"), this, SLOT(slotFileNew()), CTRL+Key_N); |
||
462 | fid13 = fileMenu->insertItem(loadIcon("DateiOpen16.png"), tr("Open..."), this, SLOT(slotDocOpen()), CTRL+Key_O); |
||
463 | fid14 = fileMenu->insertItem(tr("Recent Documents"), recentMenu); |
||
464 | SetKeyEntry(0, tr("New"), fid12, CTRL+Key_N); |
||
465 | SetKeyEntry(1, tr("Open..."), fid13, CTRL+Key_O); |
||
466 | fileMenu->insertSeparator(); |
||
467 | fid1 = fileMenu->insertItem(loadIcon("DateiClos16.png"), tr("Close"), this, SLOT(slotFileClose()), CTRL+Key_W); |
||
468 | SetKeyEntry(2, tr("Close"), fid1, CTRL+Key_W); |
||
469 | fileMenu->setItemEnabled(fid1, 0); |
||
470 | fid4 = fileMenu->insertItem(loadIcon("DateiSave16.png"), tr("Save"), this, SLOT(slotFileSave()), CTRL+Key_S); |
||
471 | SetKeyEntry(3, tr("Save"), fid4, CTRL+Key_S); |
||
472 | fileMenu->setItemEnabled(fid4, 0); |
||
473 | fid5 = fileMenu->insertItem(tr("Save as..."), this, SLOT(slotFileSaveAs())); |
||
474 | SetKeyEntry(4, tr("Save as..."), fid5, 0); |
||
475 | fileMenu->setItemEnabled(fid5, 0); |
||
476 | fid51 = fileMenu->insertItem(tr("Collect for Output..."), this, SLOT(Collect())); |
||
477 | fileMenu->setItemEnabled(fid51, 0); |
||
478 | fileMenu->insertSeparator(); |
||
479 | importMenu = new QPopupMenu(); |
||
480 | fid2 = importMenu->insertItem(tr("Get Text/Picture..."), this, SLOT(slotFileOpen())); |
||
481 | importMenu->setItemEnabled(fid2, 0); |
||
482 | fid2a = importMenu->insertItem(tr("Insert Page..."), this, SLOT(slotDocMerge())); |
||
483 | importMenu->setItemEnabled(fid2a, 0); |
||
484 | fileMenu->insertItem(tr("Import..."), importMenu); |
||
485 | exportMenu = new QPopupMenu(); |
||
486 | fid3 = exportMenu->insertItem(tr("Save Text..."), this, SLOT(SaveText())); |
||
487 | exportMenu->setItemEnabled(fid3, 0); |
||
488 | fid8 = exportMenu->insertItem(tr("Save Page as EPS..."), this, SLOT(SaveAsEps())); |
||
489 | exportMenu->setItemEnabled(fid8, 0); |
||
490 | fid10 = exportMenu->insertItem(tr("Save as PDF..."), this, SLOT(SaveAsPDF())); |
||
491 | exportMenu->setItemEnabled(fid10, 0); |
||
492 | fid11 = fileMenu->insertItem(tr("Export..."), exportMenu); |
||
493 | fileMenu->setItemEnabled(fid11, 0); |
||
494 | fileMenu->insertSeparator(); |
||
495 | fid6 = fileMenu->insertItem(tr("Document Info..."), this, SLOT(InfoDoc()), CTRL+Key_I); |
||
496 | fileMenu->setItemEnabled(fid6, 0); |
||
497 | SetKeyEntry(5, tr("Document Info..."), fid6, CTRL+Key_I); |
||
498 | fid7 = fileMenu->insertItem(tr("Document Setup..."), this, SLOT(SetupDoc())); |
||
499 | fileMenu->setItemEnabled(fid7, 0); |
||
500 | SetKeyEntry(6, tr("Document Setup..."), fid7, 0); |
||
501 | fid9 = fileMenu->insertItem(loadIcon("DateiPrint16.png"), tr("Print..."), this, SLOT(slotFilePrint()), CTRL+Key_P); |
||
502 | fileMenu->setItemEnabled(fid9, 0); |
||
503 | SetKeyEntry(7, tr("Print..."), fid9, CTRL+Key_P); |
||
504 | fileMenu->insertSeparator(); |
||
505 | MenID = fileMenu->insertItem(loadIcon("exit.png"), tr("Quit"), this, SLOT(slotFileQuit()), CTRL+Key_Q); |
||
506 | SetKeyEntry(8, tr("Quit"), MenID, CTRL+Key_Q); |
||
507 | editMenu = new QPopupMenu(); |
||
508 | edUndo = editMenu->insertItem(tr("Undo"), this, SLOT(UnDoAction()), CTRL+Key_Z); |
||
509 | editMenu->insertSeparator(); |
||
510 | edid1 = editMenu->insertItem(loadIcon("editcut.png"), tr("Cut"), this , SLOT(slotEditCut()), CTRL+Key_X); |
||
511 | edid2 = editMenu->insertItem(loadIcon("editcopy.png"), tr("Copy"), this , SLOT(slotEditCopy()), CTRL+Key_C); |
||
512 | edid3 = editMenu->insertItem(loadIcon("editpaste.png"), tr("Paste"), this , SLOT(slotEditPaste()), CTRL+Key_V); |
||
513 | edid4 = editMenu->insertItem(loadIcon("editdelete.png"), tr("Clear"), this, SLOT(DeleteText())); |
||
514 | edid5 = editMenu->insertItem(tr("Select all"), this, SLOT(SelectAll()), CTRL+Key_A); |
||
515 | SetKeyEntry(9, tr("Cut"), edid1, CTRL+Key_X); |
||
516 | SetKeyEntry(10, tr("Copy"), edid2, CTRL+Key_C); |
||
517 | SetKeyEntry(11, tr("Paste"), edid3, CTRL+Key_V); |
||
518 | SetKeyEntry(12, tr("Clear"), edid4, 0); |
||
519 | SetKeyEntry(13, tr("Select all"), edid5, CTRL+Key_A); |
||
520 | editMenu->insertSeparator(); |
||
521 | MenID = editMenu->insertItem(tr("Colors..."), this , SLOT(slotEditColors())); |
||
522 | SetKeyEntry(14, tr("Colors..."), MenID, 0); |
||
523 | edid6 = editMenu->insertItem(tr("Styles..."), this , SLOT(slotEditStyles())); |
||
27 | Franz | 524 | edid6a = editMenu->insertItem(tr("Line Styles..."), this , SLOT(slotEditLineStyles())); |
3 | paul | 525 | SetKeyEntry(15, tr("Styles..."), edid6, 0); |
526 | tman = editMenu->insertItem(tr("Templates..."), this, SLOT(ManageTemp())); |
||
527 | SetKeyEntry(16, tr("Templates..."), tman, 0); |
||
73 | Franz | 528 | jman = editMenu->insertItem(tr("Javascripts..."), this, SLOT(ManageJava())); |
3 | paul | 529 | hymen = new QPopupMenu(); |
530 | MenID = hymen->insertItem(tr("General..."), this , SLOT(slotPrefsOrg())); |
||
531 | SetKeyEntry(18, tr("Preferences..."), MenID, 0); |
||
532 | MenID = hymen->insertItem(tr("Fonts..."), this , SLOT(slotFontOrg())); |
||
533 | SetKeyEntry(17, tr("Fonts..."), MenID, 0); |
||
534 | hymen->insertItem(tr("Hyphenator..."), this, SLOT(configHyphenator())); |
||
535 | editMenu->insertItem(tr("Preferences"), hymen); |
||
536 | editMenu->setItemEnabled(edUndo, 0); |
||
537 | editMenu->setItemEnabled(edid1, 0); |
||
538 | editMenu->setItemEnabled(edid2, 0); |
||
539 | editMenu->setItemEnabled(edid3, 0); |
||
540 | editMenu->setItemEnabled(edid4, 0); |
||
541 | editMenu->setItemEnabled(edid5, 0); |
||
542 | editMenu->setItemEnabled(edid6, 0); |
||
27 | Franz | 543 | editMenu->setItemEnabled(edid6a, 0); |
3 | paul | 544 | editMenu->setItemEnabled(tman, 0); |
545 | editMenu->setItemEnabled(jman, 0); |
||
546 | StilMenu = new QPopupMenu(); |
||
547 | ObjMenu = new QPopupMenu(); |
||
68 | Franz | 548 | SetKeyEntry(19, tr("Select New Font"), 0, 0); |
3 | paul | 549 | MenID = ObjMenu->insertItem(tr("Duplicate"), this, SLOT(ObjektDup()), CTRL+Key_D); |
550 | SetKeyEntry(20, tr("Duplicate"), MenID, CTRL+Key_D); |
||
551 | MenID = ObjMenu->insertItem(tr("Multiple Duplicate"), this, SLOT(ObjektDupM())); |
||
552 | SetKeyEntry(21, tr("Multiple Duplicate"), MenID, 0); |
||
553 | Loesch = ObjMenu->insertItem(tr("Delete"), this, SLOT(DeleteObjekt()), CTRL+Key_K); |
||
554 | SetKeyEntry(22, tr("Delete"), Loesch, CTRL+Key_K); |
||
555 | ObjMenu->insertSeparator(); |
||
556 | Gr = ObjMenu->insertItem(tr("Group"), this, SLOT(GroupObj()), CTRL+Key_G); |
||
557 | SetKeyEntry(23, tr("Group"), Gr, CTRL+Key_G); |
||
74 | Franz | 558 | UnGr = ObjMenu->insertItem(tr("Un-group"), this, SLOT(UnGroupObj()),CTRL+Key_U); |
559 | SetKeyEntry(24, tr("Un-group"), UnGr, CTRL+Key_U); |
||
3 | paul | 560 | LockOb = ObjMenu->insertItem(tr("Lock"), this, SLOT(ToggleObjLock()), CTRL+Key_H); |
561 | ObjMenu->insertSeparator(); |
||
562 | OBack = ObjMenu->insertItem(tr("Send to Back"), this, SLOT(Objekt2Back())); |
||
563 | SetKeyEntry(25, tr("Send to Back"), OBack, 0); |
||
564 | OFront = ObjMenu->insertItem(tr("Bring to Front"), this, SLOT(Objekt2Front())); |
||
565 | SetKeyEntry(26, tr("Bring to Front"), OFront, 0); |
||
566 | OLower = ObjMenu->insertItem(tr("Lower"), this, SLOT(ObjektLower())); |
||
567 | SetKeyEntry(27, tr("Lower"), OLower, 0); |
||
568 | ORaise = ObjMenu->insertItem(tr("Raise"), this, SLOT(ObjektRaise())); |
||
569 | SetKeyEntry(28, tr("Raise"), ORaise, 0); |
||
570 | DistM = ObjMenu->insertItem(tr("Distribute/Align..."), this, SLOT(ObjektAlign())); |
||
571 | SetKeyEntry(29, tr("Distribute/Align..."), DistM, 0); |
||
572 | ObjMenu->insertSeparator(); |
||
573 | ShapeMenu = new QPopupMenu(); |
||
574 | ShapeMenu->insertItem(tr("Rectangle"), this, SLOT(RectFrame())); |
||
575 | ShapeMenu->insertItem(tr("Rounded Rectangle"), this, SLOT(RoundedFrame())); |
||
576 | ShapeMenu->insertItem(tr("Oval"), this, SLOT(OvalFrame())); |
||
577 | ShapeEdit = ShapeMenu->insertItem(tr("Edit Frame"), this, SLOT(ToggleFrameEdit())); |
||
578 | ShapeM = ObjMenu->insertItem(tr("Shape"), ShapeMenu); |
||
579 | PfadT = ObjMenu->insertItem(tr("Attach Text to Path"), this, SLOT(Pfadtext())); |
||
580 | PfadV = ObjMenu->insertItem(tr("Combine Polygons"), this, SLOT(UniteOb())); |
||
61 | paul | 581 | PfadS = ObjMenu->insertItem(tr("Split Polygons"), this, SLOT(SplitUniteOb())); |
68 | Franz | 582 | PfadTP = ObjMenu->insertItem(tr("Convert to Outlines"), this, SLOT(TraceText())); |
3 | paul | 583 | ObjMenu->setItemEnabled(ShapeM, 0); |
584 | ObjMenu->setItemEnabled(DistM, 0); |
||
585 | ObjMenu->setItemEnabled(Gr, 0); |
||
586 | ObjMenu->setItemEnabled(UnGr, 0); |
||
587 | ObjMenu->setItemEnabled(PfadT, 0); |
||
588 | ObjMenu->setItemEnabled(PfadV, 0); |
||
589 | ObjMenu->setItemEnabled(PfadS, 0); |
||
590 | ObjMenu->setItemEnabled(LockOb, 0); |
||
591 | ObjMenu->setItemEnabled(PfadTP, 0); |
||
592 | pageMenu = new QPopupMenu(); |
||
593 | MenID = pageMenu->insertItem(tr("Insert..."), this, SLOT(slotNewPageM())); |
||
594 | SetKeyEntry(30, tr("Insert..."), MenID, 0); |
||
595 | pgmd = pageMenu->insertItem(tr("Delete..."), this, SLOT(DeletePage())); |
||
596 | SetKeyEntry(31, tr("Delete..."), pgmd, 0); |
||
597 | MenID = pageMenu->insertItem(tr("Copy")+"...", this, SLOT(CopyPage())); |
||
598 | SetKeyEntry(61, tr("Copy")+"...", MenID, 0); |
||
599 | pgmv = pageMenu->insertItem(tr("Move..."), this, SLOT(MovePage())); |
||
600 | SetKeyEntry(32, tr("Move..."), pgmv, 0); |
||
601 | MenID = pageMenu->insertItem(tr("Apply Template..."), this, SLOT(ApplyTemp())); |
||
602 | SetKeyEntry(33, tr("Apply Template..."), MenID, 0); |
||
603 | MenID = pageMenu->insertItem(tr("Manage Guides..."), this, SLOT(ManageGuides())); |
||
604 | SetKeyEntry(49, tr("Manage Guides..."), MenID, 0); |
||
605 | pageMenu->setItemEnabled(pgmd, 0); |
||
606 | pageMenu->setItemEnabled(pgmv, 0); |
||
607 | viewMenu=new QPopupMenu(); |
||
608 | MenID = viewMenu->insertItem(tr("Fit in Window"), this, SLOT(slotZoomFit()), CTRL+Key_0); |
||
609 | SetKeyEntry(34, tr("Fit in Window"), MenID, CTRL+Key_0); |
||
610 | MenID = viewMenu->insertItem("50%", this, SLOT(slotZoom50())); |
||
611 | SetKeyEntry(35, tr("50%"), MenID, 0); |
||
612 | MenID = viewMenu->insertItem("75%", this, SLOT(slotZoom75())); |
||
613 | SetKeyEntry(36, tr("75%"), MenID, 0); |
||
614 | MenID = viewMenu->insertItem(tr("Actual Size"), this, SLOT(slotZoom100()), CTRL+Key_1); |
||
615 | SetKeyEntry(37, tr("Actual Size"), MenID, CTRL+Key_1); |
||
616 | MenID = viewMenu->insertItem("200%", this, SLOT(slotZoom200())); |
||
617 | SetKeyEntry(38, tr("200%"), MenID, 0); |
||
618 | MenID = viewMenu->insertItem(tr("Thumbnails"), this, SLOT(slotZoom20())); |
||
619 | SetKeyEntry(39, tr("Thumbnails"), MenID, 0); |
||
620 | viewMenu->insertSeparator(); |
||
621 | Markers = viewMenu->insertItem(tr("Hide Margins"), this, SLOT(ToggleMarks())); |
||
622 | SetKeyEntry(40, tr("Hide Margins"), Markers, 0); |
||
623 | FrameDr = viewMenu->insertItem(tr("Hide Frames"), this, SLOT(ToggleFrames())); |
||
624 | SetKeyEntry(41, tr("Hide Frames"), FrameDr, 0); |
||
625 | Bilder = viewMenu->insertItem(tr("Hide Images"), this, SLOT(TogglePics())); |
||
626 | SetKeyEntry(42, tr("Hide Images"), Bilder, 0); |
||
627 | Ras = viewMenu->insertItem(tr("Show Grid"), this, SLOT(ToggleRaster())); |
||
628 | SetKeyEntry(43, tr("Show Grid"), Ras, 0); |
||
629 | uRas = viewMenu->insertItem(tr("Snap to Grid"), this, SLOT(ToggleURaster())); |
||
630 | SetKeyEntry(44, tr("Snap to Grid"), uRas, 0); |
||
631 | Guide = viewMenu->insertItem(tr("Hide Guides"), this, SLOT(ToggleGuides())); |
||
632 | uGuide = viewMenu->insertItem(tr("Snap to Guides"), this, SLOT(ToggleUGuides())); |
||
633 | for (a=0; a<6; ++a) |
||
634 | { |
||
635 | viewMenu->setItemEnabled(viewMenu->idAt(a), 0); |
||
636 | } |
||
637 | viewMenu->setItemEnabled(Markers, 0); |
||
638 | viewMenu->setItemEnabled(FrameDr, 0); |
||
639 | viewMenu->setItemEnabled(Bilder, 0); |
||
640 | viewMenu->setItemEnabled(Ras, 0); |
||
641 | viewMenu->setItemEnabled(uRas, 0); |
||
642 | viewMenu->setItemEnabled(Guide, 0); |
||
643 | viewMenu->setItemEnabled(uGuide, 0); |
||
644 | toolMenu=new QPopupMenu(); |
||
645 | viewTools = toolMenu->insertItem(tr("Hide Tools"), this, SLOT(ToggleTools())); |
||
646 | SetKeyEntry(45, tr("Hide Tools"), viewTools, 0); |
||
14 | Franz | 647 | viewToolsP = toolMenu->insertItem(tr("Hide PDF-Tools"), this, SLOT(TogglePDFTools())); |
68 | Franz | 648 | viewMpal = toolMenu->insertItem(tr("Show Properties"), this, SLOT(ToggleMpal())); |
649 | SetKeyEntry(46, tr("Show Properties"), viewMpal, 0); |
||
3 | paul | 650 | viewTpal = toolMenu->insertItem(tr("Show Outline"), this, SLOT(ToggleTpal())); |
651 | SetKeyEntry(47, tr("Show Outline"), viewTpal, 0); |
||
652 | viewBpal = toolMenu->insertItem(tr("Show Scrapbook"), this, SLOT(ToggleBpal())); |
||
653 | SetKeyEntry(48, tr("Show Scrapbook"), viewBpal, 0); |
||
654 | viewLpal = toolMenu->insertItem(tr("Show Layers"), this, SLOT(ToggleLpal())); |
||
655 | viewSepal = toolMenu->insertItem(tr("Show Page Palette"), this, SLOT(ToggleSepal())); |
||
656 | viewBopal = toolMenu->insertItem(tr("Show Bookmarks"), this, SLOT(ToggleBookpal())); |
||
657 | extraMenu=new QPopupMenu(); |
||
658 | MenID = extraMenu->insertItem(tr("Manage Pictures"), this, SLOT(StatusPic())); |
||
659 | SetKeyEntry(51, tr("Manage Pictures"), MenID, 0); |
||
660 | hyph = extraMenu->insertItem(tr("Hyphenate Text"), this, SLOT(doHyphenate())); |
||
661 | extraMenu->setItemEnabled(hyph, 0); |
||
662 | SetKeyEntry(50, tr("Hyphenate Text"), hyph, 0); |
||
663 | windowsMenu = new QPopupMenu(); |
||
664 | windowsMenu->setCheckable( true ); |
||
665 | connect(windowsMenu, SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow())); |
||
666 | helpMenu=new QPopupMenu(); |
||
667 | MenID = helpMenu->insertItem(tr("About Scribus"), this, SLOT(slotHelpAbout())); |
||
668 | SetKeyEntry(52, tr("About Scribus"), MenID, 0); |
||
669 | MenID = helpMenu->insertItem(tr("About Qt"), this, SLOT(slotHelpAboutQt())); |
||
670 | SetKeyEntry(53, tr("About Qt"), MenID, 0); |
||
671 | helpMenu->insertSeparator(); |
||
672 | MenID = helpMenu->insertItem(tr("Online-Help..."), this, SLOT(slotOnlineHelp())); |
||
673 | SetKeyEntry(54, tr("Online-Help..."), MenID, 0); |
||
674 | tip = helpMenu->insertItem(tr("Tool-Tips"), this, SLOT(ToggleTips())); |
||
675 | SetKeyEntry(55, tr("Tool-Tips"), tip, 0); |
||
676 | tipsOn = true; |
||
677 | helpMenu->setItemChecked(tip, tipsOn); |
||
68 | Franz | 678 | // ObjMenu->insertItem(tr("Test"), this, SLOT(slotTest())); |
3 | paul | 679 | // helpMenu->insertItem(tr("Test2"), this, SLOT(slotTest2())); |
680 | menuBar()->insertItem(tr("File"), fileMenu); |
||
681 | menuBar()->insertItem(tr("Edit"), editMenu); |
||
682 | Stm = menuBar()->insertItem(tr("Style"), StilMenu); |
||
683 | Obm = menuBar()->insertItem(tr("Item"), ObjMenu); |
||
684 | pgmm = menuBar()->insertItem(tr("Page"), pageMenu); |
||
685 | menuBar()->setItemEnabled(Obm, 0); |
||
686 | menuBar()->setItemEnabled(pgmm, 0); |
||
687 | menuBar()->insertItem(tr("View"), viewMenu); |
||
688 | menuBar()->insertItem(tr("Tools"), toolMenu); |
||
689 | exmn = menuBar()->insertItem(tr("Extras"), extraMenu); |
||
690 | menuBar()->setItemEnabled(exmn, 0); |
||
691 | menuBar()->insertItem( tr("Windows"), windowsMenu ); |
||
692 | menuBar()->insertSeparator(); |
||
693 | menuBar()->insertItem(tr("Help"), helpMenu); |
||
694 | AliMenu = new QPopupMenu(); |
||
695 | AliMenu->insertItem(tr("Left")); |
||
696 | AliMenu->insertItem(tr("Center")); |
||
697 | AliMenu->insertItem(tr("Right")); |
||
698 | AliMenu->insertItem(tr("Block")); |
||
699 | AliMenu->insertItem(tr("Forced")); |
||
700 | ColorMenu = new QPopupMenu(); |
||
701 | SizeTMenu = new QPopupMenu(); |
||
702 | SizeTMenu->insertItem(tr("Other...")); |
||
703 | SizeTMenu->insertItem(" 7 pt"); |
||
704 | SizeTMenu->insertItem(" 9 pt"); |
||
705 | SizeTMenu->insertItem("10 pt"); |
||
706 | SizeTMenu->insertItem("12 pt"); |
||
707 | SizeTMenu->insertItem("14 pt"); |
||
708 | SizeTMenu->insertItem("18 pt"); |
||
709 | SizeTMenu->insertItem("24 pt"); |
||
710 | SizeTMenu->insertItem("36 pt"); |
||
711 | SizeTMenu->insertItem("48 pt"); |
||
712 | SizeTMenu->insertItem("60 pt"); |
||
713 | SizeTMenu->insertItem("72 pt"); |
||
714 | ShadeMenu = new QPopupMenu(); |
||
715 | ShadeMenu->insertItem(tr("Other...")); |
||
716 | ShadeMenu->insertItem("0 %"); |
||
717 | ShadeMenu->insertItem("10 %"); |
||
718 | ShadeMenu->insertItem("20 %"); |
||
719 | ShadeMenu->insertItem("30 %"); |
||
720 | ShadeMenu->insertItem("40 %"); |
||
721 | ShadeMenu->insertItem("50 %"); |
||
722 | ShadeMenu->insertItem("60 %"); |
||
723 | ShadeMenu->insertItem("70 %"); |
||
724 | ShadeMenu->insertItem("80 %"); |
||
725 | ShadeMenu->insertItem("90 %"); |
||
726 | ShadeMenu->insertItem("100 %"); |
||
727 | FontMenu = new QPopupMenu(); |
||
728 | TypeStyleMenu = new QPopupMenu(); |
||
729 | TypeStyleMenu->insertItem(tr("Normal")); |
||
730 | tmp = qApp->font(); |
||
731 | tmp = qApp->font(); |
||
732 | tmp.setUnderline(true); |
||
733 | TypeStyleMenu->insertItem(new FmItem(tr("Underline"), tmp)); |
||
734 | tmp = qApp->font(); |
||
735 | tmp.setStrikeOut(true); |
||
736 | TypeStyleMenu->insertItem(new FmItem(tr("Strikethru"), tmp)); |
||
737 | TypeStyleMenu->insertItem(tr("Small Caps")); |
||
738 | TypeStyleMenu->insertItem(tr("Superscript")); |
||
739 | TypeStyleMenu->insertItem(tr("Subscript")); |
||
68 | Franz | 740 | TypeStyleMenu->insertItem(tr("Outlined")); |
3 | paul | 741 | } |
742 | |||
743 | void ScribusApp::initStatusBar() |
||
744 | { |
||
745 | FMess = new QLabel(statusBar(), "ft"); |
||
746 | FMess->setText(" "); |
||
747 | statusBar()->addWidget(FMess, 3, true); |
||
748 | FProg = new QProgressBar(statusBar(), "p"); |
||
749 | FProg->setCenterIndicator(true); |
||
750 | FProg->setFixedWidth( 100 ); |
||
751 | statusBar()->addWidget(FProg, 0, true); |
||
752 | FProg->reset(); |
||
753 | XMess = new QLabel(statusBar(), "xt"); |
||
754 | XMess->setText(tr("X-Pos:")); |
||
755 | statusBar()->addWidget(XMess, 0, true); |
||
756 | XDat = new QLabel(statusBar(), "dt"); |
||
757 | statusBar()->addWidget(XDat, 1, true); |
||
758 | XDat->setText(" "); |
||
759 | YMess = new QLabel(statusBar(), "yt"); |
||
760 | YMess->setText(tr("Y-Pos:")); |
||
761 | statusBar()->addWidget(YMess, 0, true); |
||
762 | YDat = new QLabel(statusBar(), "ydt"); |
||
763 | statusBar()->addWidget(YDat, 1, true); |
||
80 | Franz | 764 | YDat->setText(" "); |
3 | paul | 765 | } |
766 | |||
80 | Franz | 767 | void ScribusApp::ReportMP(double xp, double yp) |
3 | paul | 768 | { |
769 | QString tmp, tmp2; |
||
770 | switch (doc->Einheit) |
||
771 | { |
||
772 | case 0: |
||
773 | tmp2 = " pt"; |
||
774 | break; |
||
775 | case 1: |
||
776 | tmp2 = " mm"; |
||
777 | break; |
||
778 | case 2: |
||
779 | tmp2 = " in"; |
||
780 | break; |
||
781 | case 3: |
||
782 | tmp2 = " p"; |
||
783 | break; |
||
784 | } |
||
785 | XDat->setText(tmp.setNum(qRound(xp*UmReFaktor * 100) / 100.0, 'f', 2)+tmp2); |
||
786 | YDat->setText(tmp.setNum(qRound(yp*UmReFaktor * 100) / 100.0, 'f', 2)+tmp2); |
||
787 | } |
||
788 | |||
789 | void ScribusApp::SetKeyEntry(int Nr, QString text, int Men, int KeyC) |
||
790 | { |
||
791 | Keys ke; |
||
792 | ke.Name = text; |
||
793 | ke.MenuID = Men; |
||
794 | ke.KeyID = KeyC; |
||
795 | Prefs.KeyActions.insert(Nr, ke); |
||
796 | } |
||
797 | |||
798 | void ScribusApp::DeleteSel(PageItem *b) |
||
799 | { |
||
800 | Pti *it; |
||
801 | for (it = b->Ptext.first(); it != 0; it = b->Ptext.next()) |
||
802 | { |
||
803 | if (it->cselect) |
||
804 | { |
||
805 | b->Ptext.remove(); |
||
806 | it = b->Ptext.prev(); |
||
807 | if (it == 0) |
||
808 | { |
||
809 | it = b->Ptext.first(); |
||
810 | } |
||
811 | } |
||
812 | } |
||
813 | if (b->Ptext.count() != 0) |
||
814 | { |
||
815 | if (b->Ptext.first()->cselect) |
||
816 | { |
||
817 | b->Ptext.remove(); |
||
818 | b->CPos = 0; |
||
819 | } |
||
820 | else |
||
821 | b->CPos = QMIN(b->CPos, doc->ActPage->oldCp); |
||
822 | } |
||
823 | else |
||
824 | b->CPos = 0; |
||
825 | b->HasSel = false; |
||
826 | DisableTxEdit(); |
||
827 | } |
||
828 | |||
829 | void ScribusApp::setTBvals(PageItem *b) |
||
830 | { |
||
831 | if (b->Ptext.count() != 0) |
||
832 | { |
||
833 | doc->CurrentStyle = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->cstyle & 127; |
||
834 | doc->CurrentABStil = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->cab; |
||
835 | setAbsValue(doc->CurrentABStil); |
||
836 | Mpal->setAli(doc->CurrentABStil); |
||
68 | Franz | 837 | doc->CurrFont = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->cfont; |
838 | doc->CurrFontSize = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->csize; |
||
839 | doc->CurrTextFill = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->ccolor; |
||
840 | doc->CurrTextFillSh = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->cshade; |
||
841 | doc->CurrTextStroke = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->cstroke; |
||
842 | doc->CurrTextStrokeSh = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->cshade2; |
||
843 | doc->CurrTextScale = b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->cscale; |
||
844 | emit TextFarben(doc->CurrTextStroke, doc->CurrTextFill, doc->CurrTextStrokeSh, doc->CurrTextFillSh); |
||
845 | emit TextIFont(doc->CurrFont); |
||
846 | emit TextISize(doc->CurrFontSize); |
||
847 | emit TextUSval(b->Ptext.at(QMIN(b->CPos, static_cast<int>(b->Ptext.count()-1)))->cextra); |
||
848 | emit TextStil(doc->CurrentStyle); |
||
849 | emit TextScale(doc->CurrTextScale); |
||
3 | paul | 850 | } |
851 | } |
||
852 | |||
853 | void ScribusApp::wheelEvent(QWheelEvent *w) |
||
854 | { |
||
855 | if (HaveDoc) |
||
856 | { |
||
857 | if (w->delta() < 0) |
||
858 | view->scrollBy(0, Prefs.Wheelval); |
||
859 | else |
||
860 | view->scrollBy(0, -Prefs.Wheelval); |
||
861 | w->accept(); |
||
862 | } |
||
863 | } |
||
864 | |||
865 | void ScribusApp::keyPressEvent(QKeyEvent *k) |
||
866 | { |
||
867 | struct Pti *hg; |
||
868 | int kk = k->key(); |
||
869 | int as = k->ascii(); |
||
80 | Franz | 870 | double altx, alty; |
3 | paul | 871 | QString uc = k->text(); |
872 | QString cr, Tcha, Twort; |
||
873 | uint Tcoun; |
||
92 | Franz | 874 | if (keyrep) |
875 | return; |
||
876 | keyrep = true; |
||
3 | paul | 877 | switch (k->state()) |
878 | { |
||
879 | case ShiftButton: |
||
880 | KeyMod = 0x00200000; |
||
881 | break; |
||
882 | case AltButton: |
||
883 | KeyMod = 0x00800000; |
||
884 | break; |
||
885 | case ControlButton: |
||
886 | KeyMod = 0x00400000; |
||
887 | break; |
||
888 | default: |
||
889 | KeyMod = 0; |
||
890 | } |
||
891 | if ((HaveDoc) && (!view->LE->hasFocus())) |
||
892 | { |
||
893 | switch (kk) |
||
894 | { |
||
895 | case Key_Prior: |
||
896 | view->scrollBy(0, -Prefs.Wheelval); |
||
92 | Franz | 897 | keyrep = false; |
3 | paul | 898 | return; |
899 | break; |
||
900 | case Key_Next: |
||
901 | view->scrollBy(0, Prefs.Wheelval); |
||
92 | Franz | 902 | keyrep = false; |
3 | paul | 903 | return; |
904 | break; |
||
905 | } |
||
906 | if (doc->ActPage->SelItem.count() != 0) |
||
907 | { |
||
908 | PageItem *b = doc->ActPage->SelItem.at(0); |
||
909 | switch (doc->AppMode) |
||
910 | { |
||
911 | case 1: |
||
912 | switch (kk) |
||
913 | { |
||
914 | case Key_Delete: |
||
915 | if (!doc->EditClip) |
||
916 | { |
||
917 | if (!b->Locked) |
||
918 | doc->ActPage->DeleteItem(); |
||
919 | } |
||
920 | break; |
||
921 | case Key_Left: |
||
922 | if (!k->isAutoRepeat()) |
||
923 | { |
||
924 | doc->ActPage->storeUndoInf(b); |
||
925 | doc->UnData.UnCode = 1; |
||
926 | doc->UnDoValid = true; |
||
927 | CanUndo(); |
||
928 | } |
||
929 | if (!b->Locked) |
||
930 | doc->ActPage->moveGroup(-1, 0); |
||
931 | break; |
||
932 | case Key_Right: |
||
933 | if (!k->isAutoRepeat()) |
||
934 | { |
||
935 | doc->ActPage->storeUndoInf(b); |
||
936 | doc->UnData.UnCode = 1; |
||
937 | doc->UnDoValid = true; |
||
938 | CanUndo(); |
||
939 | } |
||
940 | if (!b->Locked) |
||
941 | doc->ActPage->moveGroup(1, 0); |
||
942 | break; |
||
943 | case Key_Up: |
||
944 | if (!k->isAutoRepeat()) |
||
945 | { |
||
946 | doc->ActPage->storeUndoInf(b); |
||
947 | doc->UnData.UnCode = 1; |
||
948 | doc->UnDoValid = true; |
||
949 | CanUndo(); |
||
950 | } |
||
951 | if (!b->Locked) |
||
952 | doc->ActPage->moveGroup(0, -1); |
||
953 | break; |
||
954 | case Key_Down: |
||
955 | if (!k->isAutoRepeat()) |
||
956 | { |
||
957 | doc->ActPage->storeUndoInf(b); |
||
958 | doc->UnData.UnCode = 1; |
||
959 | doc->UnDoValid = true; |
||
960 | CanUndo(); |
||
961 | } |
||
962 | if (!b->Locked) |
||
963 | doc->ActPage->moveGroup(0, 1); |
||
964 | default: |
||
965 | if (b->PType == 4) |
||
966 | { |
||
967 | if ((kk + KeyMod) == Prefs.KeyActions[59].KeyID) |
||
968 | { |
||
969 | setNewAbStyle(1); |
||
970 | b->Dirty = true; |
||
971 | b->Tinput = true; |
||
68 | Franz | 972 | doc->ActPage->RefreshItem(b); |
3 | paul | 973 | } |
974 | if ((kk + KeyMod) == Prefs.KeyActions[58].KeyID) |
||
975 | { |
||
976 | setNewAbStyle(2); |
||
977 | b->Dirty = true; |
||
978 | b->Tinput = true; |
||
68 | Franz | 979 | doc->ActPage->RefreshItem(b); |
3 | paul | 980 | } |
981 | if ((kk + KeyMod) == Prefs.KeyActions[57].KeyID) |
||
982 | { |
||
983 | setNewAbStyle(0); |
||
984 | b->Dirty = true; |
||
985 | b->Tinput = true; |
||
68 | Franz | 986 | doc->ActPage->RefreshItem(b); |
3 | paul | 987 | } |
988 | } |
||
989 | break; |
||
990 | } |
||
991 | slotDocCh(); |
||
992 | break; |
||
993 | case 7: |
||
994 | if (b->PType == 4) |
||
995 | { |
||
996 | doc->ActPage->slotDoCurs(false); |
||
997 | switch (kk) |
||
998 | { |
||
999 | case Key_Down: |
||
1000 | if (b->CPos != static_cast<int>(b->Ptext.count())) |
||
1001 | { |
||
1002 | alty = b->Ptext.at(b->CPos)->yp; |
||
1003 | altx = b->Ptext.at(b->CPos)->xp; |
||
1004 | do |
||
1005 | { |
||
1006 | b->CPos += 1; |
||
1007 | if (b->CPos == static_cast<int>(b->Ptext.count())) |
||
1008 | break; |
||
1009 | if (b->Ptext.at(b->CPos)->yp > alty) |
||
1010 | { |
||
1011 | if (b->Ptext.at(b->CPos)->xp >= altx) |
||
1012 | break; |
||
1013 | } |
||
1014 | } |
||
1015 | while (b->CPos < static_cast<int>(b->Ptext.count())); |
||
1016 | if (b->CPos == static_cast<int>(b->Ptext.count())) |
||
1017 | if (b->NextBox != 0) |
||
1018 | { |
||
1019 | if (b->NextBox->Ptext.count() != 0) |
||
1020 | { |
||
1021 | b->OwnPage->Deselect(true); |
||
1022 | b->NextBox->CPos = 0; |
||
1023 | doc->ActPage = b->NextBox->OwnPage; |
||
1024 | b->NextBox->OwnPage->SelectItemNr(b->NextBox->ItemNr); |
||
1025 | b = b->NextBox; |
||
1026 | } |
||
80 | Franz | 1027 | } |
3 | paul | 1028 | } |
1029 | else |
||
1030 | { |
||
1031 | if (b->NextBox != 0) |
||
1032 | { |
||
1033 | if (b->NextBox->Ptext.count() != 0) |
||
1034 | { |
||
1035 | b->OwnPage->Deselect(true); |
||
1036 | b->NextBox->CPos = 0; |
||
1037 | doc->ActPage = b->NextBox->OwnPage; |
||
1038 | b->NextBox->OwnPage->SelectItemNr(b->NextBox->ItemNr); |
||
1039 | b = b->NextBox; |
||
1040 | } |
||
1041 | } |
||
1042 | } |
||
1043 | setTBvals(b); |
||
1044 | break; |
||
1045 | case Key_Up: |
||
1046 | if (b->CPos > 0) |
||
1047 | { |
||
1048 | if (b->CPos == static_cast<int>(b->Ptext.count())) |
||
1049 | b->CPos -= 1; |
||
1050 | alty = b->Ptext.at(b->CPos)->yp; |
||
1051 | altx = b->Ptext.at(b->CPos)->xp; |
||
1052 | if (b->CPos > 0) |
||
1053 | { |
||
1054 | do |
||
1055 | { |
||
1056 | b->CPos -= 1; |
||
1057 | if (b->CPos == 0) |
||
1058 | break; |
||
1059 | if (b->Ptext.at(b->CPos)->yp < alty) |
||
1060 | { |
||
1061 | if (b->Ptext.at(b->CPos)->xp <= altx) |
||
1062 | break; |
||
1063 | } |
||
1064 | } |
||
1065 | while (b->CPos > 0); |
||
1066 | } |
||
1067 | if (b->CPos == 0) |
||
1068 | { |
||
1069 | if (b->BackBox != 0) |
||
1070 | { |
||
1071 | b->OwnPage->Deselect(true); |
||
1072 | b->BackBox->CPos = b->BackBox->Ptext.count(); |
||
1073 | doc->ActPage = b->BackBox->OwnPage; |
||
1074 | b->BackBox->OwnPage->SelectItemNr(b->BackBox->ItemNr); |
||
1075 | b = b->BackBox; |
||
1076 | } |
||
1077 | } |
||
1078 | } |
||
1079 | else |
||
1080 | { |
||
1081 | b->CPos = 0; |
||
1082 | if (b->BackBox != 0) |
||
1083 | { |
||
1084 | b->OwnPage->Deselect(true); |
||
1085 | b->BackBox->CPos = b->BackBox->Ptext.count(); |
||
1086 | doc->ActPage = b->BackBox->OwnPage; |
||
1087 | b->BackBox->OwnPage->SelectItemNr(b->BackBox->ItemNr); |
||
1088 | b = b->BackBox; |
||
1089 | } |
||
1090 | } |
||
1091 | setTBvals(b); |
||
1092 | break; |
||
1093 | case Key_Home: |
||
1094 | b->CPos = 0; |
||
1095 | setTBvals(b); |
||
1096 | break; |
||
1097 | case Key_End: |
||
1098 | b->CPos = static_cast<int>(b->Ptext.count()); |
||
1099 | setTBvals(b); |
||
1100 | break; |
||
1101 | case Key_Left: |
||
1102 | b->CPos -= 1; |
||
1103 | if (b->CPos < 0) |
||
1104 | { |
||
1105 | b->CPos = 0; |
||
1106 | if (b->BackBox != 0) |
||
1107 | { |
||
1108 | b->OwnPage->Deselect(true); |
||
1109 | b->BackBox->CPos = b->BackBox->Ptext.count(); |
||
1110 | doc->ActPage = b->BackBox->OwnPage; |
||
1111 | b->BackBox->OwnPage->SelectItemNr(b->BackBox->ItemNr); |
||
1112 | b = b->BackBox; |
||
1113 | } |
||
1114 | } |
||
1115 | setTBvals(b); |
||
1116 | break; |
||
1117 | case Key_Right: |
||
1118 | b->CPos += 1; |
||
1119 | if (b->CPos > static_cast<int>(b->Ptext.count())) |
||
1120 | { |
||
1121 | b->CPos -= 1; |
||
1122 | if (b->NextBox != 0) |
||
1123 | { |
||
1124 | if (b->NextBox->Ptext.count() != 0) |
||
1125 | { |
||
1126 | b->OwnPage->Deselect(true); |
||
1127 | b->NextBox->CPos = 0; |
||
1128 | doc->ActPage = b->NextBox->OwnPage; |
||
1129 | b->NextBox->OwnPage->SelectItemNr(b->NextBox->ItemNr); |
||
1130 | b = b->NextBox; |
||
1131 | } |
||
1132 | } |
||
1133 | } |
||
1134 | setTBvals(b); |
||
1135 | break; |
||
1136 | case Key_Delete: |
||
1137 | if (b->CPos == static_cast<int>(b->Ptext.count())) { return; } |
||
1138 | if (b->Ptext.count() == 0) { return; } |
||
1139 | cr = b->Ptext.at(b->CPos)->ch; |
||
1140 | if (b->HasSel) |
||
1141 | DeleteSel(b); |
||
1142 | else |
||
1143 | b->Ptext.remove(b->CPos); |
||
1144 | b->Tinput = false; |
||
1145 | if ((cr == QChar(13)) && (b->Ptext.count() != 0)) |
||
1146 | { |
||
1147 | doc->ActPage->chAbStyle(b, b->Ptext.at(QMAX(b->CPos-1,0))->cab); |
||
1148 | b->Tinput = false; |
||
1149 | } |
||
1150 | setTBvals(b); |
||
1151 | b->Dirty = true; |
||
68 | Franz | 1152 | doc->ActPage->RefreshItem(b); |
3 | paul | 1153 | break; |
1154 | case Key_Backspace: |
||
1155 | if (b->CPos == 0) |
||
1156 | return; |
||
1157 | if (b->Ptext.count() == 0) { return; } |
||
1158 | cr = b->Ptext.at(QMAX(b->CPos-1,0))->ch; |
||
1159 | if (b->HasSel) |
||
1160 | DeleteSel(b); |
||
1161 | else |
||
1162 | b->CPos -= 1; |
||
1163 | b->Ptext.remove(b->CPos); |
||
1164 | b->Tinput = false; |
||
1165 | if ((cr == QChar(13)) && (b->Ptext.count() != 0)) |
||
1166 | { |
||
1167 | doc->ActPage->chAbStyle(b, b->Ptext.at(QMAX(b->CPos-1,0))->cab); |
||
1168 | b->Tinput = false; |
||
1169 | } |
||
1170 | setTBvals(b); |
||
1171 | b->Dirty = true; |
||
68 | Franz | 1172 | doc->ActPage->RefreshItem(b); |
3 | paul | 1173 | break; |
1174 | default: |
||
1175 | if ((b->HasSel) && (kk < 0x1000)) |
||
1176 | { |
||
1177 | DeleteSel(b); |
||
1178 | b->Dirty = true; |
||
68 | Franz | 1179 | doc->ActPage->RefreshItem(b); |
3 | paul | 1180 | } |
66 | paul | 1181 | if (((kk + KeyMod) == Prefs.KeyActions[60].KeyID) || ((kk + KeyMod) == Prefs.KeyActions[67].KeyID)) |
3 | paul | 1182 | { |
1183 | hg = new Pti; |
||
55 | Franz | 1184 | if ((kk + KeyMod) == Prefs.KeyActions[60].KeyID) |
1185 | hg->ch = QString(QChar(30)); |
||
1186 | else |
||
1187 | hg->ch = QString(QChar(29)); |
||
68 | Franz | 1188 | hg->cfont = doc->CurrFont; |
1189 | hg->csize = doc->CurrFontSize; |
||
1190 | hg->ccolor = doc->CurrTextFill; |
||
1191 | hg->cshade = doc->CurrTextFillSh; |
||
1192 | hg->cstroke = doc->CurrTextStroke; |
||
1193 | hg->cshade2 = doc->CurrTextStrokeSh; |
||
1194 | hg->cscale = doc->CurrTextScale; |
||
3 | paul | 1195 | hg->cselect = false; |
1196 | hg->cstyle = doc->CurrentStyle; |
||
1197 | hg->cab = doc->CurrentABStil; |
||
1198 | if (doc->Vorlagen[doc->CurrentABStil].Font != "") |
||
1199 | { |
||
1200 | hg->cfont = doc->Vorlagen[doc->CurrentABStil].Font; |
||
1201 | hg->csize = doc->Vorlagen[doc->CurrentABStil].FontSize; |
||
1202 | } |
||
68 | Franz | 1203 | hg->cextra = 0; |
3 | paul | 1204 | hg->xp = 0; |
1205 | hg->yp = 0; |
||
1206 | hg->PRot = 0; |
||
1207 | hg->PtransX = 0; |
||
1208 | hg->PtransY = 0; |
||
1209 | b->Ptext.insert(b->CPos, hg); |
||
1210 | b->CPos += 1; |
||
1211 | b->Dirty = true; |
||
1212 | b->Tinput = true; |
||
68 | Franz | 1213 | doc->ActPage->RefreshItem(b); |
3 | paul | 1214 | break; |
1215 | } |
||
1216 | if ((kk + KeyMod) == Prefs.KeyActions[56].KeyID) |
||
1217 | { |
||
1218 | b->Ptext.at(QMAX(b->CPos-1,0))->cstyle ^= 128; |
||
1219 | b->Dirty = true; |
||
1220 | b->Tinput = true; |
||
68 | Franz | 1221 | doc->ActPage->RefreshItem(b); |
3 | paul | 1222 | break; |
1223 | } |
||
1224 | if ((kk + KeyMod) == Prefs.KeyActions[59].KeyID) |
||
1225 | { |
||
1226 | setNewAbStyle(1); |
||
1227 | b->Dirty = true; |
||
1228 | b->Tinput = true; |
||
68 | Franz | 1229 | doc->ActPage->RefreshItem(b); |
3 | paul | 1230 | break; |
1231 | } |
||
1232 | if ((kk + KeyMod) == Prefs.KeyActions[57].KeyID) |
||
1233 | { |
||
1234 | setNewAbStyle(0); |
||
1235 | b->Dirty = true; |
||
1236 | b->Tinput = true; |
||
68 | Franz | 1237 | doc->ActPage->RefreshItem(b); |
3 | paul | 1238 | break; |
1239 | } |
||
1240 | if ((kk + KeyMod) == Prefs.KeyActions[58].KeyID) |
||
1241 | { |
||
1242 | setNewAbStyle(2); |
||
1243 | b->Dirty = true; |
||
1244 | b->Tinput = true; |
||
68 | Franz | 1245 | doc->ActPage->RefreshItem(b); |
3 | paul | 1246 | break; |
1247 | } |
||
68 | Franz | 1248 | if (((uc[0] > QChar(31)) || (as == 13) || (as == 30)) && ((*doc->AllFonts)[doc->CurrFont]->CharWidth.contains(uc[0].unicode()))) |
3 | paul | 1249 | { |
1250 | hg = new Pti; |
||
1251 | hg->ch = uc; |
||
68 | Franz | 1252 | hg->cfont = doc->CurrFont; |
1253 | hg->ccolor = doc->CurrTextFill; |
||
1254 | hg->cshade = doc->CurrTextFillSh; |
||
1255 | hg->cstroke = doc->CurrTextStroke; |
||
1256 | hg->cshade2 = doc->CurrTextStrokeSh; |
||
1257 | hg->cscale = doc->CurrTextScale; |
||
1258 | hg->csize = doc->CurrFontSize; |
||
3 | paul | 1259 | hg->cextra = 0; |
1260 | hg->cselect = false; |
||
1261 | hg->cstyle = doc->CurrentStyle; |
||
1262 | hg->cab = doc->CurrentABStil; |
||
1263 | if (doc->Vorlagen[doc->CurrentABStil].Font != "") |
||
1264 | { |
||
1265 | hg->cfont = doc->Vorlagen[doc->CurrentABStil].Font; |
||
1266 | hg->csize = doc->Vorlagen[doc->CurrentABStil].FontSize; |
||
1267 | } |
||
1268 | hg->xp = 0; |
||
1269 | hg->yp = 0; |
||
1270 | hg->PRot = 0; |
||
1271 | hg->PtransX = 0; |
||
1272 | hg->PtransY = 0; |
||
1273 | b->Ptext.insert(b->CPos, hg); |
||
1274 | b->CPos += 1; |
||
1275 | if ((doc->Trenner->AutoCheck) && (b->CPos > 1)) |
||
1276 | { |
||
1277 | Twort = ""; |
||
1278 | Tcoun = 0; |
||
1279 | for (int hych = b->CPos-1; hych > -1; hych--) |
||
1280 | { |
||
1281 | Tcha = b->Ptext.at(hych)->ch; |
||
1282 | if (Tcha == " ") |
||
1283 | { |
||
1284 | Tcoun = hych+1; |
||
1285 | break; |
||
1286 | } |
||
1287 | Twort.prepend(Tcha); |
||
1288 | } |
||
1289 | if (Twort != "") |
||
1290 | { |
||
68 | Franz | 1291 | if (doc->Trenner->Language != b->Language) |
1292 | doc->Trenner->slotNewDict(b->Language); |
||
3 | paul | 1293 | doc->Trenner->slotHyphenateWord(b, Twort, Tcoun); |
1294 | b->Dirty = true; |
||
1295 | } |
||
1296 | } |
||
1297 | if ((b->CPos < static_cast<int>(b->Ptext.count())) || (as == 30)) |
||
1298 | b->Dirty = true; |
||
1299 | b->Tinput = true; |
||
92 | Franz | 1300 | doc->ActPage->RefreshItem(b, true); |
3 | paul | 1301 | } |
1302 | break; |
||
1303 | } |
||
1304 | if (b->Ptext.count() != 0) |
||
1305 | if (b->Ptext.at(QMAX(b->CPos-1, 0))->yp != 0) |
||
1306 | doc->ActPage->slotDoCurs(true); |
||
1307 | if ((kk == Key_Left) || (kk == Key_Right) || (kk == Key_Up) || (kk == Key_Down)) |
||
92 | Franz | 1308 | { |
1309 | keyrep = false; |
||
3 | paul | 1310 | return; |
92 | Franz | 1311 | } |
3 | paul | 1312 | } |
1313 | slotDocCh(false); |
||
1314 | break; |
||
1315 | } |
||
1316 | } |
||
1317 | } |
||
92 | Franz | 1318 | keyrep = false; |
3 | paul | 1319 | } |
1320 | |||
1321 | void ScribusApp::closeEvent(QCloseEvent *ce) |
||
1322 | { |
||
1323 | QWidgetList windows = wsp->windowList(); |
||
1324 | ScribusWin* tw; |
||
1325 | if (!windows.isEmpty()) |
||
1326 | { |
||
1327 | for ( int i = 0; i < static_cast<int>(windows.count()); ++i ) |
||
1328 | { |
||
1329 | newActWin(windows.at(i)); |
||
1330 | tw = ActWin; |
||
1331 | ActWin->close(); |
||
1332 | if (tw == ActWin) |
||
1333 | { |
||
1334 | ce->ignore(); |
||
1335 | return; |
||
1336 | } |
||
1337 | } |
||
1338 | SavePrefs(); |
||
68 | Franz | 1339 | if ((Prefs.SaveAtQ) && (ScBook->Changed == true)) |
3 | paul | 1340 | { |
1341 | if (ScBook->ScFilename.isEmpty()) |
||
1342 | ScBook->ScFilename = PrefsPfad+"/scrap.scs"; |
||
1343 | ScBook->Save(); |
||
1344 | } |
||
1345 | if (ScBook->BibWin->Objekte.count() == 0) |
||
1346 | system("rm -f " + PrefsPfad+"/scrap.scs"); |
||
1347 | Prefs.AvailFonts.~SCFonts(); |
||
1348 | FinalizePlugs(); |
||
1349 | exit(0); |
||
1350 | } |
||
1351 | else |
||
1352 | { |
||
1353 | SavePrefs(); |
||
68 | Franz | 1354 | if ((Prefs.SaveAtQ) && (ScBook->Changed == true)) |
3 | paul | 1355 | { |
1356 | if (ScBook->ScFilename.isEmpty()) |
||
1357 | ScBook->ScFilename = PrefsPfad+"/scrap.scs"; |
||
1358 | ScBook->Save(); |
||
1359 | } |
||
1360 | if (ScBook->BibWin->Objekte.count() == 0) |
||
1361 | system("rm -f " + PrefsPfad+"/scrap.scs"); |
||
1362 | qApp->setOverrideCursor(QCursor(ArrowCursor), true); |
||
1363 | Prefs.AvailFonts.~SCFonts(); |
||
1364 | FinalizePlugs(); |
||
1365 | exit(0); |
||
1366 | } |
||
1367 | } |
||
1368 | |||
1369 | ///////////////////////////////////////////////////////////////////// |
||
1370 | // SLOT IMPLEMENTATION |
||
1371 | ///////////////////////////////////////////////////////////////////// |
||
80 | Franz | 1372 | double ScribusApp::mm2pts(int mm) |
3 | paul | 1373 | { |
1374 | return mm / 25.4 * 72; |
||
1375 | } |
||
1376 | |||
80 | Franz | 1377 | double ScribusApp::pts2mm(double pts) |
3 | paul | 1378 | { |
1379 | return pts / 72 * 25.4; |
||
1380 | } |
||
1381 | |||
1382 | bool ScribusApp::slotFileNew() |
||
1383 | { |
||
80 | Franz | 1384 | double b, h, tpr, lr, rr, br, sp, ab; |
3 | paul | 1385 | bool fp, atf, ret; |
1386 | NewDoc* dia = new NewDoc(this, &Prefs); |
||
1387 | if (dia->exec()) |
||
1388 | { |
||
1389 | tpr = dia->Top; |
||
1390 | lr = dia->Left; |
||
1391 | rr = dia->Right; |
||
1392 | br = dia->Bottom; |
||
1393 | ab = dia->Dist; |
||
1394 | b = dia->Pagebr; |
||
1395 | h = dia->Pageho; |
||
1396 | sp = dia->SpinBox10->value(); |
||
1397 | atf = dia->AutoFrame->isChecked(); |
||
1398 | fp = dia->Doppelseiten->isChecked(); |
||
1399 | if (dia->ComboBox3->currentItem() == 1) |
||
1400 | { |
||
1401 | b = mm2pts(qRound(pts2mm(dia->Pagebr))); |
||
1402 | h = mm2pts(qRound(pts2mm(dia->Pageho))); |
||
1403 | } |
||
1404 | ret = doFileNew(b, h, tpr, lr, rr, br, ab, sp, atf, fp, dia->ComboBox3->currentItem(), |
||
1405 | dia->ErsteSeite->isChecked(), dia->Orient, dia->PgNr->value()); |
||
1406 | FMess->setText(tr("Ready")); |
||
1407 | } |
||
1408 | else |
||
1409 | ret = false; |
||
1410 | delete dia; |
||
1411 | return ret; |
||
1412 | } |
||
1413 | |||
80 | Franz | 1414 | bool ScribusApp::doFileNew(double b, double h, double tpr, double lr, double rr, double br, double ab, double sp, |
3 | paul | 1415 | bool atf, bool fp, int einh, bool firstleft, int Ori, int SNr) |
1416 | { |
||
1417 | QString cc; |
||
91 | Franz | 1418 | if (HaveDoc) |
1419 | doc->OpenNodes = Tpal->buildReopenVals(); |
||
3 | paul | 1420 | doc = new ScribusDoc(); |
1421 | doc->Einheit = einh; |
||
1422 | if (fp) |
||
1423 | doc->FirstPageLeft = firstleft; |
||
1424 | doc->PageOri = Ori; |
||
1425 | doc->FirstPnum = SNr; |
||
1426 | doc->AllFonts = &Prefs.AvailFonts; |
||
1427 | doc->AddFont(Prefs.DefFont, Prefs.AvailFonts[Prefs.DefFont]->Font); |
||
1428 | doc->Dfont = Prefs.DefFont; |
||
1429 | doc->Dsize = Prefs.DefSize; |
||
1430 | doc->GrabRad = Prefs.GrabRad; |
||
1431 | doc->GuideRad = Prefs.GuideRad; |
||
1432 | doc->minorGrid = Prefs.DminGrid; |
||
1433 | doc->majorGrid = Prefs.DmajGrid; |
||
1434 | doc->minorColor = Prefs.DminColor; |
||
1435 | doc->majorColor = Prefs.DmajColor; |
||
1436 | doc->papColor = Prefs.DpapColor; |
||
1437 | doc->margColor = Prefs.DmargColor; |
||
1438 | doc->guideColor = Prefs.guideColor; |
||
1439 | doc->VHoch = Prefs.DVHoch; |
||
1440 | doc->VHochSc = Prefs.DVHochSc; |
||
1441 | doc->VTief = Prefs.DVTief; |
||
1442 | doc->VTiefSc = Prefs.DVTiefSc; |
||
1443 | doc->VKapit = Prefs.DVKapit; |
||
1444 | doc->Dpen = Prefs.Dpen; |
||
1445 | doc->DpenText = Prefs.DpenText; |
||
1446 | doc->Dbrush = Prefs.Dbrush; |
||
1447 | doc->Dshade = Prefs.Dshade; |
||
1448 | doc->Dshade2 = Prefs.Dshade2; |
||
1449 | doc->DLineArt = PenStyle(Prefs.DLineArt); |
||
1450 | doc->Dwidth = Prefs.Dwidth; |
||
1451 | doc->DpenLine = Prefs.DpenLine; |
||
1452 | doc->DshadeLine = Prefs.DshadeLine; |
||
1453 | doc->DLstyleLine = PenStyle(Prefs.DLstyleLine); |
||
1454 | doc->DwidthLine = Prefs.DwidthLine; |
||
1455 | doc->MagMin = Prefs.MagMin; |
||
1456 | doc->MagMax = Prefs.MagMax; |
||
1457 | doc->MagStep = Prefs.MagStep; |
||
1458 | doc->DbrushPict = Prefs.DbrushPict; |
||
1459 | doc->ShadePict = Prefs.ShadePict; |
||
1460 | doc->ScaleX = Prefs.ScaleX; |
||
1461 | doc->ScaleY = Prefs.ScaleY; |
||
1462 | doc->ScaleType = Prefs.ScaleType; |
||
1463 | doc->AspectRatio = Prefs.AspectRatio; |
||
1464 | doc->Before = Prefs.Before; |
||
1465 | doc->PagesSbS = Prefs.PagesSbS; |
||
1466 | doc->ShFrames = Prefs.ShFrames; |
||
1467 | doc->RandFarbig = Prefs.RandFarbig; |
||
1468 | doc->AutoLine = Prefs.AutoLine; |
||
1469 | doc->DocName = doc->DocName+cc.setNum(DocNr); |
||
1470 | doc->HasCMS = true; |
||
1471 | doc->CMSSettings.DefaultInputProfile = Prefs.DCMSset.DefaultInputProfile; |
||
1472 | doc->CMSSettings.DefaultInputProfile2 = Prefs.DCMSset.DefaultInputProfile2; |
||
1473 | doc->CMSSettings.DefaultMonitorProfile = Prefs.DCMSset.DefaultMonitorProfile; |
||
1474 | doc->CMSSettings.DefaultPrinterProfile = Prefs.DCMSset.DefaultPrinterProfile; |
||
1475 | doc->CMSSettings.DefaultIntentPrinter = Prefs.DCMSset.DefaultIntentPrinter; |
||
1476 | doc->CMSSettings.DefaultIntentMonitor = Prefs.DCMSset.DefaultIntentMonitor; |
||
1477 | doc->CMSSettings.DefaultIntentMonitor2 = Prefs.DCMSset.DefaultIntentMonitor2; |
||
1478 | doc->CMSSettings.SoftProofOn = Prefs.DCMSset.SoftProofOn; |
||
1479 | doc->CMSSettings.GamutCheck = Prefs.DCMSset.GamutCheck; |
||
1480 | doc->CMSSettings.CMSinUse = Prefs.DCMSset.CMSinUse; |
||
1481 | doc->PDF_Optionen.SolidProf = doc->CMSSettings.DefaultInputProfile2; |
||
1482 | doc->PDF_Optionen.ImageProf = doc->CMSSettings.DefaultInputProfile; |
||
1483 | doc->PDF_Optionen.PrintProf = doc->CMSSettings.DefaultPrinterProfile; |
||
1484 | doc->PDF_Optionen.Intent = doc->CMSSettings.DefaultIntentMonitor; |
||
1485 | doc->PDF_Optionen.Intent2 = doc->CMSSettings.DefaultIntentMonitor2; |
||
1486 | doc->ActiveLayer = 0; |
||
1487 | HaveDoc++; |
||
1488 | DocNr++; |
||
11 | Franz | 1489 | doc->Scale = 1.0*Prefs.DisScale; |
3 | paul | 1490 | doc->AppMode = 1; |
1491 | doc->Language = Prefs.Language; |
||
1492 | doc->MinWordLen = Prefs.MinWordLen; |
||
1493 | doc->Automatic = Prefs.Automatic; |
||
1494 | doc->AutoCheck = Prefs.AutoCheck; |
||
1495 | doc->PageColors = Prefs.DColors; |
||
89 | Franz | 1496 | doc->loading = true; |
3 | paul | 1497 | ScribusWin* w = new ScribusWin(wsp, doc); |
1498 | view = new ScribusView(w, doc, &Prefs); |
||
1499 | w->setView(view); |
||
1500 | ActWin = w; |
||
59 | Franz | 1501 | doc->WinHan = w; |
3 | paul | 1502 | w->setCentralWidget(view); |
1503 | connect(w, SIGNAL(Schliessen()), this, SLOT(DoFileClose())); |
||
1504 | connect(w, SIGNAL(SaveAndClose()), this, SLOT(DoSaveClose())); |
||
1505 | if (CMSavail) |
||
1506 | { |
||
1507 | #ifdef HAVE_CMS |
||
1508 | w->SoftProofing = Prefs.DCMSset.SoftProofOn; |
||
1509 | w->Gamut = Prefs.DCMSset.GamutCheck; |
||
1510 | CMSuse = Prefs.DCMSset.CMSinUse; |
||
1511 | w->IntentPrinter = Prefs.DCMSset.DefaultIntentPrinter; |
||
1512 | w->IntentMonitor = Prefs.DCMSset.DefaultIntentMonitor; |
||
1513 | SoftProofing = Prefs.DCMSset.SoftProofOn; |
||
1514 | Gamut = Prefs.DCMSset.GamutCheck; |
||
1515 | IntentPrinter = Prefs.DCMSset.DefaultIntentPrinter; |
||
1516 | IntentMonitor = Prefs.DCMSset.DefaultIntentMonitor; |
||
1517 | w->OpenCMSProfiles(InputProfiles, MonitorProfiles, PrinterProfiles); |
||
1518 | stdProof = w->stdProof; |
||
1519 | stdTrans = w->stdTrans; |
||
1520 | stdProofImg = w->stdProofImg; |
||
1521 | stdTransImg = w->stdTransImg; |
||
1522 | CMSoutputProf = doc->DocOutputProf; |
||
1523 | CMSprinterProf = doc->DocPrinterProf; |
||
1524 | if (static_cast<int>(cmsGetColorSpace(doc->DocInputProf)) == icSigRgbData) |
||
1525 | doc->CMSSettings.ComponentsInput2 = 3; |
||
1526 | if (static_cast<int>(cmsGetColorSpace(doc->DocInputProf)) == icSigCmykData) |
||
1527 | doc->CMSSettings.ComponentsInput2 = 4; |
||
1528 | if (static_cast<int>(cmsGetColorSpace(doc->DocInputProf)) == icSigCmyData) |
||
1529 | doc->CMSSettings.ComponentsInput2 = 3; |
||
1530 | if (static_cast<int>(cmsGetColorSpace(doc->DocPrinterProf)) == icSigRgbData) |
||
1531 | doc->CMSSettings.ComponentsPrinter = 3; |
||
1532 | if (static_cast<int>(cmsGetColorSpace(doc->DocPrinterProf)) == icSigCmykData) |
||
1533 | doc->CMSSettings.ComponentsPrinter = 4; |
||
1534 | if (static_cast<int>(cmsGetColorSpace(doc->DocPrinterProf)) == icSigCmyData) |
||
1535 | doc->CMSSettings.ComponentsPrinter = 3; |
||
1536 | doc->PDF_Optionen.SComp = doc->CMSSettings.ComponentsInput2; |
||
80 | Franz | 1537 | #endif |
3 | paul | 1538 | if (Prefs.DCMSset.CMSinUse) |
1539 | RecalcColors(); |
||
1540 | } |
||
1541 | doc->setPage(b, h, tpr, lr, rr, br, sp, ab, atf, fp); |
||
91 | Franz | 1542 | doc->loading = false; |
3 | paul | 1543 | slotNewPage(0); |
91 | Franz | 1544 | doc->loading = true; |
3 | paul | 1545 | HaveNewDoc(); |
1546 | view->Pages.at(0)->parentWidget()->hide(); |
||
1547 | view->DocPages = view->Pages; |
||
1548 | view->Pages = view->MasterPages; |
||
1549 | doc->PageC = view->MasterPages.count(); |
||
1550 | bool atfb = doc->PageAT; |
||
1551 | doc->PageAT = false; |
||
1552 | slotNewPage(0); |
||
1553 | doc->PageAT = atfb; |
||
1554 | view->MasterNames["Normal"] = 0; |
||
1555 | view->Pages.at(0)->PageNam = "Normal"; |
||
1556 | view->Pages.at(0)->parentWidget()->hide(); |
||
1557 | view->MasterPages = view->Pages; |
||
1558 | doc->PageC = view->DocPages.count(); |
||
1559 | view->Pages = view->DocPages; |
||
1560 | doc->MasterP = false; |
||
1561 | view->Pages.at(0)->MPageNam = "Normal"; |
||
1562 | view->Pages.at(0)->parentWidget()->show(); |
||
1563 | doc->setUnModified(); |
||
1564 | doc->loading = false; |
||
1565 | doc->ActPage = view->Pages.at(0); |
||
91 | Franz | 1566 | doc->OpenNodes.clear(); |
3 | paul | 1567 | Tpal->BuildTree(view); |
1568 | Sepal->Rebuild(); |
||
1569 | BookPal->BView->clear(); |
||
1570 | if ( wsp->windowList().isEmpty() ) |
||
1571 | w->showMaximized(); |
||
1572 | else |
||
1573 | w->show(); |
||
1574 | view->show(); |
||
81 | Franz | 1575 | connect(doc->ASaveTimer, SIGNAL(timeout()), w, SLOT(slotAutoSave())); |
1576 | connect(w, SIGNAL(AutoSaved()), this, SLOT(slotAutoSaved())); |
||
3 | paul | 1577 | doc->AutoSave = Prefs.AutoSave; |
1578 | if (doc->AutoSave) |
||
1579 | doc->ASaveTimer->start(Prefs.AutoSaveTime); |
||
68 | Franz | 1580 | DatSav->setEnabled(false); |
1581 | fileMenu->setItemEnabled(fid4, 0); |
||
3 | paul | 1582 | return true; |
1583 | } |
||
1584 | |||
1585 | void ScribusApp::DoSaveClose() |
||
1586 | { |
||
1587 | slotFileSaveAs(); |
||
1588 | DoFileClose(); |
||
1589 | } |
||
1590 | |||
1591 | void ScribusApp::windowsMenuAboutToShow() |
||
1592 | { |
||
1593 | windowsMenu->clear(); |
||
1594 | int cascadeId = windowsMenu->insertItem(tr("Cascade"), wsp, SLOT(cascade() ) ); |
||
1595 | int tileId = windowsMenu->insertItem(tr("Tile"), wsp, SLOT(tile() ) ); |
||
1596 | if ( wsp->windowList().isEmpty() ) |
||
1597 | { |
||
1598 | windowsMenu->setItemEnabled( cascadeId, false ); |
||
1599 | windowsMenu->setItemEnabled( tileId, false ); |
||
1600 | } |
||
1601 | windowsMenu->insertSeparator(); |
||
1602 | QWidgetList windows = wsp->windowList(); |
||
1603 | for ( int i = 0; i < static_cast<int>(windows.count()); ++i ) |
||
1604 | { |
||
1605 | int id = windowsMenu->insertItem(windows.at(i)->caption(), this, SLOT(windowsMenuActivated(int))); |
||
1606 | windowsMenu->setItemParameter( id, i ); |
||
1607 | windowsMenu->setItemChecked( id, wsp->activeWindow() == windows.at(i) ); |
||
1608 | } |
||
1609 | } |
||
1610 | |||
1611 | void ScribusApp::newActWin(QWidget *w) |
||
1612 | { |
||
1613 | ScribusWin* swin; |
||
1614 | if (w == NULL) |
||
1615 | { |
||
1616 | ActWin = NULL; |
||
1617 | return; |
||
1618 | } |
||
1619 | ActWin = (ScribusWin*)w; |
||
91 | Franz | 1620 | if (doc != NULL) |
1621 | { |
||
1622 | if ((HaveDoc) && (doc != ActWin->doc)) |
||
1623 | doc->OpenNodes = Tpal->buildReopenVals(); |
||
1624 | } |
||
3 | paul | 1625 | doc = ActWin->doc; |
1626 | view = ActWin->view; |
||
1627 | Sepal->SetView(view); |
||
1628 | if (!doc->loading) |
||
1629 | { |
||
1630 | SwitchWin(); |
||
1631 | QWidgetList windows = wsp->windowList(); |
||
1632 | for ( int i = 0; i < static_cast<int>(windows.count()); ++i ) |
||
1633 | { |
||
1634 | swin = (ScribusWin*)windows.at(i); |
||
1635 | if (swin->muster != NULL) |
||
1636 | swin->muster->hide(); |
||
1637 | } |
||
1638 | if (doc->TemplateMode) |
||
1639 | ActWin->muster->show(); |
||
1640 | setAppMode(doc->AppMode); |
||
1641 | } |
||
1642 | w->setFocus(); |
||
1643 | if (w->isMaximized()) |
||
1644 | wsp->setScrollBarsEnabled(false); |
||
1645 | else |
||
1646 | wsp->setScrollBarsEnabled(true); |
||
1647 | Sepal->Rebuild(); |
||
1648 | Tpal->BuildTree(view); |
||
91 | Franz | 1649 | Tpal->reopenTree(doc->OpenNodes); |
3 | paul | 1650 | BookPal->BView->NrItems = ActWin->NrItems; |
1651 | BookPal->BView->First = ActWin->First; |
||
1652 | BookPal->BView->Last = ActWin->Last; |
||
1653 | RestoreBookMarks(); |
||
1654 | } |
||
1655 | |||
1656 | void ScribusApp::windowsMenuActivated( int id ) |
||
1657 | { |
||
91 | Franz | 1658 | if (HaveDoc) |
1659 | doc->OpenNodes = Tpal->buildReopenVals(); |
||
3 | paul | 1660 | QWidget* w = wsp->windowList().at( id ); |
1661 | if ( w ) |
||
1662 | w->showNormal(); |
||
1663 | newActWin(w); |
||
1664 | } |
||
1665 | |||
1666 | bool ScribusApp::SetupDoc() |
||
1667 | { |
||
80 | Franz | 1668 | double tpr = doc->PageM.Top; |
1669 | double lr = doc->PageM.Left; |
||
1670 | double rr = doc->PageM.Right; |
||
1671 | double br = doc->PageM.Bottom; |
||
3 | paul | 1672 | bool fp = doc->PageFP; |
1673 | bool fpe = doc->FirstPageLeft; |
||
80 | Franz | 1674 | double tpr2, lr2, rr2, br2; |
3 | paul | 1675 | bool ret = false; |
36 | Franz | 1676 | ReformDoc* dia = new ReformDoc(this, tpr, lr, rr, br, doc->PageB, doc->PageH, fp, fpe, doc->Einheit); |
3 | paul | 1677 | if (dia->exec()) |
1678 | { |
||
1679 | tpr2 = dia->TopR->value() / UmReFaktor / 100.0; |
||
1680 | lr2 = dia->LeftR->value() / UmReFaktor / 100.0; |
||
1681 | rr2 = dia->RightR->value() / UmReFaktor / 100.0; |
||
1682 | br2 = dia->BottomR->value() / UmReFaktor / 100.0; |
||
1683 | fp = dia->Doppelseiten->isChecked(); |
||
1684 | if (fp) |
||
1685 | doc->FirstPageLeft = dia->ErsteSeite->isChecked(); |
||
1686 | doc->resetPage(tpr2, lr2, rr2, br2, fp); |
||
1687 | view->reformPages(); |
||
1688 | doc->setModified(); |
||
1689 | view->GotoPage(doc->ActPage->PageNr); |
||
1690 | view->DrawNew(); |
||
1691 | Sepal->RebuildPage(); |
||
1692 | ret = true; |
||
1693 | doc->PDF_Optionen.BleedBottom = doc->PageM.Bottom; |
||
1694 | doc->PDF_Optionen.BleedTop = doc->PageM.Top; |
||
1695 | doc->PDF_Optionen.BleedLeft = doc->PageM.Left; |
||
1696 | doc->PDF_Optionen.BleedRight = doc->PageM.Right; |
||
1697 | } |
||
1698 | delete dia; |
||
1699 | return ret; |
||
1700 | } |
||
1701 | |||
1702 | void ScribusApp::SwitchWin() |
||
1703 | { |
||
1704 | int a; |
||
1705 | CListe::Iterator it; |
||
1706 | QPixmap pm = QPixmap(15, 15); |
||
1707 | a = 0; |
||
1708 | ColorMenu->clear(); |
||
1709 | ColorMenu->insertItem(tr("None")); |
||
1710 | for (it = doc->PageColors.begin(); it != doc->PageColors.end(); ++it) |
||
1711 | { |
||
1712 | pm.fill(doc->PageColors[it.key()].getRGBColor()); |
||
1713 | ColorMenu->insertItem(QIconSet(pm), it.key()); |
||
1714 | if (it.key() == doc->Dbrush) |
||
1715 | { |
||
1716 | ColorMenu->setItemChecked(ColorMenu->idAt(a), true); |
||
1717 | } |
||
1718 | a++; |
||
1719 | } |
||
1720 | BuildFontMenu(); |
||
1721 | #ifdef HAVE_CMS |
||
1722 | SoftProofing = ActWin->SoftProofing; |
||
1723 | Gamut = ActWin->Gamut; |
||
1724 | IntentPrinter = ActWin->IntentPrinter; |
||
1725 | IntentMonitor = ActWin->IntentMonitor; |
||
1726 | stdProof = ActWin->stdProof; |
||
1727 | stdTrans = ActWin->stdTrans; |
||
1728 | stdProofImg = ActWin->stdProofImg; |
||
1729 | stdTransImg = ActWin->stdTransImg; |
||
1730 | CMSoutputProf = doc->DocOutputProf; |
||
1731 | CMSprinterProf = doc->DocPrinterProf; |
||
80 | Franz | 1732 | #endif |
3 | paul | 1733 | Mpal->Cpal->SetColors(doc->PageColors); |
1734 | Mpal->Cpal->ChooseGrad(0); |
||
1735 | ActWin->setCaption(tr(doc->DocName)); |
||
1736 | ShadeMenu->setItemChecked(ShadeMenu->idAt(11), true); |
||
1737 | Mpal->SetDoc(doc); |
||
68 | Franz | 1738 | Mpal->updateCList(); |
3 | paul | 1739 | Sepal->SetView(view); |
1740 | Mpal->Spal->SetFormats(doc); |
||
27 | Franz | 1741 | Mpal->SetLineFormats(doc); |
3 | paul | 1742 | Lpal->setLayers(&doc->Layers, &doc->ActiveLayer); |
1743 | view->LaMenu(); |
||
1744 | view->setLayMenTxt(doc->ActiveLayer); |
||
1745 | doc->CurrentABStil = 0; |
||
51 | Franz | 1746 | slotChangeUnit(doc->Einheit, false); |
3 | paul | 1747 | if (doc->EditClip) |
1748 | { |
||
1749 | doc->EditClip = !doc->EditClip; |
||
1750 | ToggleFrameEdit(); |
||
1751 | } |
||
1752 | if (doc->ShFrames) |
||
1753 | viewMenu->changeItem(FrameDr, tr("Hide Frames")); |
||
1754 | else |
||
1755 | viewMenu->changeItem(FrameDr, tr("Show Frames")); |
||
1756 | DatClo->setEnabled(true); |
||
1757 | if (doc->TemplateMode) |
||
1758 | { |
||
1759 | menuBar()->setItemEnabled(pgmm, 0); |
||
1760 | editMenu->setItemEnabled(tman, 0); |
||
1761 | DatNeu->setEnabled(false); |
||
1762 | DatSav->setEnabled(false); |
||
1763 | DatOpe->setEnabled(false); |
||
1764 | DatClo->setEnabled(false); |
||
1765 | fileMenu->setItemEnabled(fid1, 0); |
||
1766 | fileMenu->setItemEnabled(fid4, 0); |
||
1767 | fileMenu->setItemEnabled(fid5, 0); |
||
1768 | fileMenu->setItemEnabled(fid51, 0); |
||
1769 | fileMenu->setItemEnabled(fid12, 0); |
||
1770 | fileMenu->setItemEnabled(fid13, 0); |
||
1771 | fileMenu->setItemEnabled(fid14, 0); |
||
1772 | Sepal->DisablePal(); |
||
1773 | } |
||
1774 | else |
||
1775 | { |
||
1776 | menuBar()->setItemEnabled(pgmm, 1); |
||
1777 | editMenu->setItemEnabled(tman, 1); |
||
1778 | DatNeu->setEnabled(true); |
||
1779 | DatOpe->setEnabled(true); |
||
1780 | DatClo->setEnabled(true); |
||
81 | Franz | 1781 | DatSav->setEnabled(doc->isModified()); |
3 | paul | 1782 | fileMenu->setItemEnabled(fid1, 1); |
1783 | fileMenu->setItemEnabled(fid4, ActWin->MenuStat[2]); |
||
1784 | fileMenu->setItemEnabled(fid5, ActWin->MenuStat[3]); |
||
1785 | fileMenu->setItemEnabled(fid51, ActWin->MenuStat[3]); |
||
1786 | fileMenu->setItemEnabled(fid12, 1); |
||
1787 | fileMenu->setItemEnabled(fid13, 1); |
||
1788 | fileMenu->setItemEnabled(fid14, 1); |
||
1789 | if (view->Pages.count() > 1) |
||
1790 | { |
||
1791 | pageMenu->setItemEnabled(pgmd, 1); |
||
1792 | pageMenu->setItemEnabled(pgmv, 1); |
||
1793 | } |
||
1794 | else |
||
1795 | { |
||
1796 | pageMenu->setItemEnabled(pgmd, 0); |
||
1797 | pageMenu->setItemEnabled(pgmv, 0); |
||
1798 | } |
||
1799 | if (doc->isModified()) |
||
1800 | slotDocCh(); |
||
1801 | fileMenu->setItemEnabled(fid5, 1); |
||
1802 | fileMenu->setItemEnabled(fid51, 1); |
||
1803 | Sepal->EnablePal(); |
||
1804 | } |
||
1805 | } |
||
1806 | |||
1807 | void ScribusApp::HaveNewDoc() |
||
1808 | { |
||
1809 | int a; |
||
1810 | DatPri->setEnabled(true); |
||
1811 | DatPDF->setEnabled(true); |
||
68 | Franz | 1812 | DatSav->setEnabled(false); |
3 | paul | 1813 | fileMenu->setItemEnabled(fid1, 1); |
1814 | fileMenu->setItemEnabled(fid4, 0); |
||
1815 | fileMenu->setItemEnabled(fid5, 1); |
||
1816 | fileMenu->setItemEnabled(fid51, 1); |
||
1817 | fileMenu->setItemEnabled(fid6, 1); |
||
1818 | fileMenu->setItemEnabled(fid7, 1); |
||
1819 | exportMenu->setItemEnabled(fid8, 1); |
||
1820 | importMenu->setItemEnabled(fid2a, 1); |
||
1821 | fileMenu->setItemEnabled(fid9, 1); |
||
55 | Franz | 1822 | exportMenu->setItemEnabled(fid10, 1); |
3 | paul | 1823 | fileMenu->setItemEnabled(fid11, 1); |
1824 | editMenu->setItemEnabled(edid1, 0); |
||
1825 | editMenu->setItemEnabled(edid2, 0); |
||
1826 | editMenu->setItemEnabled(edid3, 0); |
||
1827 | editMenu->setItemEnabled(edid6, 1); |
||
27 | Franz | 1828 | editMenu->setItemEnabled(edid6a, 1); |
3 | paul | 1829 | for (a=0; a<6; ++a) |
1830 | { |
||
1831 | viewMenu->setItemEnabled(viewMenu->idAt(a), 1); |
||
1832 | } |
||
1833 | viewMenu->setItemEnabled(Markers, 1); |
||
1834 | viewMenu->setItemEnabled(FrameDr, 1); |
||
1835 | viewMenu->setItemEnabled(Bilder, 1); |
||
1836 | viewMenu->setItemEnabled(Ras, 1); |
||
1837 | viewMenu->setItemEnabled(uRas, 1); |
||
1838 | viewMenu->setItemChecked(uRas, doc->useRaster); |
||
1839 | viewMenu->setItemEnabled(Guide, 1); |
||
1840 | viewMenu->setItemEnabled(uGuide, 1); |
||
1841 | viewMenu->setItemChecked(uGuide, doc->SnapGuides); |
||
1842 | menuBar()->setItemEnabled(pgmm, 1); |
||
1843 | menuBar()->setItemEnabled(exmn, 1); |
||
1844 | WerkTools->setEnabled(true); |
||
14 | Franz | 1845 | WerkToolsP->setEnabled(true); |
80 | Franz | 1846 | int setter = 0; |
3 | paul | 1847 | if (view->Pages.count() > 1) |
80 | Franz | 1848 | setter = 1; |
1849 | pageMenu->setItemEnabled(pgmd, setter); |
||
1850 | pageMenu->setItemEnabled(pgmv, setter); |
||
3 | paul | 1851 | editMenu->setItemEnabled(tman, 1); |
1852 | editMenu->setItemEnabled(jman, 1); |
||
1853 | CListe::Iterator it; |
||
1854 | QPixmap pm = QPixmap(15, 15); |
||
1855 | a = 0; |
||
1856 | ColorMenu->clear(); |
||
1857 | ColorMenu->insertItem(tr("None")); |
||
1858 | for (it = doc->PageColors.begin(); it != doc->PageColors.end(); ++it) |
||
1859 | { |
||
1860 | pm.fill(doc->PageColors[it.key()].getRGBColor()); |
||
1861 | ColorMenu->insertItem(QIconSet(pm), it.key()); |
||
1862 | if (it.key() == doc->Dbrush) |
||
1863 | { |
||
1864 | ColorMenu->setItemChecked(ColorMenu->idAt(a), true); |
||
1865 | } |
||
1866 | a++; |
||
1867 | } |
||
1868 | Mpal->Cpal->SetColors(doc->PageColors); |
||
1869 | Mpal->Cpal->ChooseGrad(0); |
||
1870 | ActWin->setCaption(tr(doc->DocName)); |
||
1871 | ShadeMenu->setItemChecked(ShadeMenu->idAt(11), true); |
||
1872 | Mpal->SetDoc(doc); |
||
68 | Franz | 1873 | Mpal->updateCList(); |
3 | paul | 1874 | Sepal->SetView(view); |
1875 | Mpal->Spal->SetFormats(doc); |
||
27 | Franz | 1876 | Mpal->SetLineFormats(doc); |
3 | paul | 1877 | Lpal->setLayers(&doc->Layers, &doc->ActiveLayer); |
1878 | view->LaMenu(); |
||
1879 | view->setLayMenTxt(doc->ActiveLayer); |
||
1880 | doc->CurrentABStil = 0; |
||
1881 | slotChangeUnit(doc->Einheit); |
||
1882 | doc->Trenner = new Hyphenator(this, doc, this); |
||
1883 | BuildFontMenu(); |
||
1884 | connect(view, SIGNAL(changeUN(int)), this, SLOT(slotChangeUnit(int))); |
||
1885 | connect(view, SIGNAL(changeLA(int)), Lpal, SLOT(MarkActiveLayer(int))); |
||
1886 | doc->PDF_Optionen.BleedBottom = doc->PageM.Bottom; |
||
1887 | doc->PDF_Optionen.BleedTop = doc->PageM.Top; |
||
1888 | doc->PDF_Optionen.BleedLeft = doc->PageM.Left; |
||
1889 | doc->PDF_Optionen.BleedRight = doc->PageM.Right; |
||
1890 | } |
||
1891 | |||
1892 | void ScribusApp::HaveNewSel(int Nr) |
||
1893 | { |
||
1894 | PageItem *b; |
||
68 | Franz | 1895 | if (Nr != -1) |
1896 | b = doc->ActPage->SelItem.at(0); |
||
3 | paul | 1897 | switch (Nr) |
1898 | { |
||
1899 | case -1: |
||
1900 | importMenu->changeItem(fid2, tr("Get Text/Picture...")); |
||
1901 | importMenu->setItemEnabled(fid2, 0); |
||
1902 | exportMenu->setItemEnabled(fid3, 0); |
||
1903 | menuBar()->setItemEnabled(Obm, 0); |
||
1904 | ObjMenu->setItemEnabled(ShapeM, 0); |
||
1905 | ObjMenu->setItemEnabled(PfadTP, 0); |
||
1906 | ObjMenu->setItemEnabled(LockOb, 0); |
||
1907 | editMenu->setItemEnabled(edid1, 0); |
||
1908 | editMenu->setItemEnabled(edid2, 0); |
||
1909 | editMenu->setItemEnabled(edid4, 0); |
||
1910 | editMenu->setItemEnabled(edid5, 0); |
||
1911 | extraMenu->setItemEnabled(hyph, 0); |
||
1912 | StilMenu->clear(); |
||
1913 | WerkTools->KetteAus->setEnabled(false); |
||
1914 | WerkTools->KetteEin->setEnabled(false); |
||
1915 | WerkTools->Textedit->setEnabled(false); |
||
1916 | WerkTools->Rotiere->setEnabled(false); |
||
1917 | Mpal->Cpal->GradCombo->setCurrentItem(0); |
||
91 | Franz | 1918 | Tpal->slotShowSelect(doc->ActPage->PageNr, -1); |
3 | paul | 1919 | break; |
1920 | case 2: |
||
1921 | importMenu->changeItem(fid2, tr( |