56
70
#include <signal.h>
59
#include "sccombobox.h"
60
#include "scribusapp.h"
61
#include "scribuscore.h"
63
#include "scribus.moc"
68
#include "multipleduplicate.h"
70
#include "reformdoc.h"
71
#include "serializer.h"
72
#include "aligndistribute.h"
74
#include "fontprefs.h"
76
#include "prefscontext.h"
77
#include "prefstable.h"
83
#include "helpbrowser.h"
84
#include "scribusXml.h"
86
77
#include "aboutplugins.h"
89
#include "editformats.h"
78
#include "actionmanager.h"
79
#include "aligndistribute.h"
92
82
#include "applytemplatedialog.h"
93
#include "picstatus.h"
94
#include "customfdialog.h"
83
#include "arrowchooser.h"
85
#include "basepointwidget.h"
86
#include "bookmarkpalette.h"
87
#include "canvasmode.h"
88
#include "charselect.h"
89
#include "checkDocument.h"
95
90
#include "cmsprefs.h"
91
#include "collect4output.h"
92
#include "colorcombo.h"
99
93
#include "colorm.h"
100
#include "mpalette.h"
94
#include "commonstrings.h"
95
#include "contextmenu.h"
101
96
#include "cpalette.h"
102
#include "bookpalette.h"
105
#include "frameedit.h"
107
#include "measurements.h"
108
#include "gtgettext.h"
97
#include "customfdialog.h"
99
#include "desaxe/digester.h"
100
#include "desaxe/saxXML.h"
101
#include "desaxe/simple_actions.h"
103
#include "docitemattrprefs.h"
104
#include "documentchecker.h"
105
#include "documentinformation.h"
106
#include "effectsdialog.h"
109
107
#include "fileloader.h"
110
#include "arrowchooser.h"
111
#include "tabtypography.h"
112
#include "tabguides.h"
113
#include "tabtools.h"
115
108
#include "filewatcher.h"
116
#include "charselect.h"
117
#include "checkDocument.h"
118
#include "tabcheckdoc.h"
119
#include "tabpdfoptions.h"
120
#include "docitemattrprefs.h"
121
#include "pageitemattributes.h"
122
#include "pageitem_textframe.h"
123
#include "pageitem_imageframe.h"
124
#include "tocindexprefs.h"
125
#include "tocgenerator.h"
126
#include "collect4output.h"
109
#include "fontcombo.h"
110
#include "fontprefs.h"
127
111
#include "fpoint.h"
128
112
#include "fpointarray.h"
113
#include "gtgettext.h"
114
#include "guidemanager.h"
115
#include "helpbrowser.h"
117
#include "hyphenator.h"
129
118
#include "hysettings.h"
130
#include "guidemanager.h"
119
#include "imageinfodialog.h"
120
#include "insertaframe.h"
122
#include "javadocs.h"
125
#include "loremipsum.h"
126
#include "marginwidget.h"
127
#include "margindialog.h"
128
#include "masterpagepalette.h"
129
#include "menumanager.h"
131
130
#include "mergedoc.h"
132
#include "lineformats.h"
134
#include "autoform.h"
135
#include "tabmanager.h"
137
#include "fontcombo.h"
138
#include "colorcombo.h"
139
#include "prefsfile.h"
140
#include "undomanager.h"
141
#include "polygonwidget.h"
142
#include "werktoolb.h"
131
#include "movepage.h"
132
#include "multipleduplicate.h"
135
#include "nodeeditpalette.h"
136
#include "outlinepalette.h"
138
#include "pageitem_imageframe.h"
139
#include "pageitem_latexframe.h"
140
#include "pageitem_textframe.h"
141
#include "pageitemattributes.h"
142
#include "pagelayout.h"
143
#include "pagepalette.h"
146
144
#include "pageselector.h"
147
#include "scraction.h"
148
#include "menumanager.h"
149
#include "undostate.h"
145
#include "pagesize.h"
146
#include "patterndialog.h"
148
#include "pdfoptions.h"
150
#include "picstatus.h"
152
151
#include "pluginmanager.h"
154
#include "pdfoptions.h"
155
#include "actionmanager.h"
156
#include "documentinformation.h"
157
#include "effectsdialog.h"
158
#include "documentchecker.h"
160
#include "pagesize.h"
161
#include "loremipsum.h"
162
#include "marginWidget.h"
163
#include "margindialog.h"
152
#include "plugins/formatidlist.h"
153
#include "polygonwidget.h"
155
#include "prefscontext.h"
156
#include "prefsfile.h"
164
157
#include "prefsmanager.h"
165
#include "pagelayout.h"
166
#include "commonstrings.h"
158
#include "prefstable.h"
167
159
#include "preview.h"
160
#include "printdialog.h"
161
#include "propertiespalette.h"
164
#include "reformdoc.h"
165
#include "replacecolors.h"
166
#include "resourcecollection.h"
167
#include "sccolorengine.h"
168
#include "sccombobox.h"
169
#include "scgtplugin.h"
170
#include "scmessagebox.h"
171
#include "scmimedata.h"
173
#include "scprintengine_ps.h"
174
#include "scraction.h"
175
#include "scrapbookpalette.h"
177
#include "scribusXml.h"
178
#include "scribusapp.h"
179
#include "scribuscore.h"
168
180
#include "scribuswin.h"
169
#include "hyphenator.h"
170
#include "scmessagebox.h"
171
#include "imageinfodialog.h"
172
#include "resourcecollection.h"
173
182
#include "selection.h"
183
#include "selectobjects.h"
184
#include "serializer.h"
185
#include "smlinestyle.h"
186
#include "smtextstyles.h"
188
#include "stencilreader.h"
189
#include "storyeditor.h"
174
190
#include "stylemanager.h"
175
#include "smlinestyle.h"
191
#include "tabcheckdoc.h"
192
#include "tabguides.h"
193
#include "tabmanager.h"
194
#include "tabpdfoptions.h"
195
#include "tabtools.h"
196
#include "tabtypography.h"
197
#include "text/nlsconfig.h"
198
#include "tocgenerator.h"
199
#include "tocindexprefs.h"
200
#include "ui/copypagetomasterpagedialog.h"
201
#include "ui/edittoolbar.h"
202
#include "ui/filetoolbar.h"
203
#include "ui/modetoolbar.h"
204
#include "ui/pdftoolbar.h"
206
#include "undomanager.h"
207
#include "undostate.h"
209
#include "urllauncher.h"
176
210
#include "util.h"
177
#include "text/nlsconfig.h"
211
#include "util_formats.h"
212
#include "util_ghostscript.h"
213
#include "util_icon.h"
215
#include "loadsaveplugin.h"
178
216
#include "plugins/formatidlist.h"
179
#include "scgtplugin.h"
180
#include "stencilreader.h"
182
#include "smtextstyles.h"
183
#include "insertaframe.h"
184
#include "patterndialog.h"
185
#include "sccolorengine.h"
186
#include "desaxe/saxXML.h"
187
#include "desaxe/digester.h"
188
#include "desaxe/simple_actions.h"
190
219
#if defined(_WIN32)
191
#include "scwinprint.h"
192
220
#include "scdocoutput_ps2.h"
221
#include "scprintengine_gdi.h"
195
224
using namespace std;
289
339
DocDir = prefsManager->documentDir();
292
341
if (primaryMainWindow)
293
342
ScCore->setSplashStatus( tr("Initializing Hyphenator") );
294
343
QString preLang = prefsManager->appPrefs.Language;
295
344
initHyphenator();
296
if (Sprachen.contains(preLang))
345
if (!LanguageManager::instance()->getHyphFilename( preLang, false ).isEmpty() )
297
346
prefsManager->appPrefs.Language = preLang;
298
347
if (primaryMainWindow)
299
348
ScCore->setSplashStatus( tr("Reading Scrapbook") );
302
scrActions["helpTooltips"]->setOn(prefsManager->appPrefs.showToolTips);
303
scrActions["stickyTools"]->setOn(prefsManager->appPrefs.stickyTools);
351
scrActions["helpTooltips"]->setChecked(prefsManager->appPrefs.showToolTips);
352
scrActions["showMouseCoordinates"]->setChecked(prefsManager->appPrefs.showMouseCoordinates);
353
scrActions["stickyTools"]->setChecked(prefsManager->appPrefs.stickyTools);
305
356
propertiesPalette->setFontSize();
306
357
if (scrActions["SaveAsDocumentTemplate"])
307
358
scrActions["SaveAsDocumentTemplate"]->setEnabled(false);
309
360
connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecent(QString)));
310
361
connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&)));
312
connect(this, SIGNAL(TextIFont(const QString&)), this, SLOT(AdjustFontMenu(const QString&)));
313
connect(this, SIGNAL(TextIFont(const QString&)), propertiesPalette, SLOT(setFontFace(const QString&)));
314
connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int)));
315
connect(this, SIGNAL(TextISize(int)), propertiesPalette, SLOT(setSize(int)));
316
connect(this, SIGNAL(TextUSval(int)), propertiesPalette, SLOT(setExtra(int)));
362
connect(this, SIGNAL(TextIFont(QString)), propertiesPalette, SLOT(setFontFace(QString)));
363
connect(this, SIGNAL(TextISize(double)), propertiesPalette, SLOT(setSize(double)));
364
connect(this, SIGNAL(TextUSval(double)), propertiesPalette, SLOT(setExtra(double)));
317
365
connect(this, SIGNAL(TextStil(int)), propertiesPalette, SLOT(setStil(int)));
318
connect(this, SIGNAL(TextScale(int)), propertiesPalette, SLOT(setTScale(int)));
319
connect(this, SIGNAL(TextScaleV(int)), propertiesPalette, SLOT(setTScaleV(int)));
320
connect(this, SIGNAL(TextBase(int)), propertiesPalette, SLOT(setTBase(int)));
321
connect(this, SIGNAL(TextShadow(int, int )), propertiesPalette, SLOT(setShadowOffs(int, int )));
322
connect(this, SIGNAL(TextOutline(int)), propertiesPalette, SLOT(setOutlineW(int)));
323
connect(this, SIGNAL(TextUnderline(int, int)), propertiesPalette, SLOT(setUnderline(int, int)));
324
connect(this, SIGNAL(TextStrike(int, int)), propertiesPalette, SLOT(setStrike(int, int)));
325
connect(this, SIGNAL(TextFarben(QString, QString, int, int)), propertiesPalette, SLOT(setActFarben(QString, QString, int, int)));
366
connect(this, SIGNAL(TextScale(double)), propertiesPalette, SLOT(setTScale(double)));
367
connect(this, SIGNAL(TextScaleV(double)), propertiesPalette, SLOT(setTScaleV(double)));
368
connect(this, SIGNAL(TextBase(double)), propertiesPalette, SLOT(setTBase(double)));
369
connect(this, SIGNAL(TextShadow(double, double )), propertiesPalette, SLOT(setShadowOffs(double, double )));
370
connect(this, SIGNAL(TextOutline(double)), propertiesPalette, SLOT(setOutlineW(double)));
371
connect(this, SIGNAL(TextUnderline(double, double)), propertiesPalette, SLOT(setUnderline(double, double)));
372
connect(this, SIGNAL(TextStrike(double, double)), propertiesPalette, SLOT(setStrike(double, double)));
373
connect(this, SIGNAL(TextFarben(QString, QString, double, double)), propertiesPalette, SLOT(setActFarben(QString, QString, double, double)));
326
374
connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange()));
327
375
// connect(ClipB, SIGNAL(selectionChanged()), this, SLOT(ClipChange()));
328
376
setAcceptDrops(true);
377
QCoreApplication::instance()->installEventFilter(this);
378
scrActions["toolsSelect"]->setChecked(true);
332
384
ScribusMainWindow::~ScribusMainWindow()
388
void ScribusMainWindow::addScToolBar(ScToolBar *tb, QString name)
390
if (!scrToolBars.contains(name))
391
scrToolBars.insert(name, tb);
337
395
void ScribusMainWindow::initToolBars()
339
fileToolBar = new ScToolBar( tr("File"), "File", this);
340
scrActions["fileNew"]->addTo(fileToolBar);
341
scrActions["fileOpen"]->addTo(fileToolBar);
342
scrMenuMgr->addMenuToWidgetOfAction("FileOpenRecent", scrActions["fileOpen"]);
343
scrActions["fileSave"]->addTo(fileToolBar);
344
scrActions["fileClose"]->addTo(fileToolBar);
345
scrActions["filePrint"]->addTo(fileToolBar);
346
scrActions["toolsPreflightVerifier"]->addTo(fileToolBar);
347
scrActions["fileExportAsPDF"]->addTo(fileToolBar);
349
editToolBar = new ScToolBar( tr("Edit"), "Edit", this);
397
fileToolBar = new FileToolBar(this);
398
editToolBar = new EditToolBar(this);
350
399
UndoWidget* uWidget = new UndoWidget(editToolBar, "uWidget");
351
400
undoManager->registerGui(uWidget);
353
mainToolBar = new ModeToolBar(this);
401
modeToolBar = new ModeToolBar(this);
354
402
pdfToolBar = new PDFToolBar(this);
356
connect(mainToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarTools"], SLOT(setOn(bool)));
357
connect(scrActions["toolsToolbarPDF"], SIGNAL(toggled(bool)), pdfToolBar, SLOT(setShown(bool)));
358
connect(pdfToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarPDF"], SLOT(setOn(bool)));
359
connect(scrActions["toolsToolbarTools"], SIGNAL(toggled(bool)), mainToolBar, SLOT(setShown(bool)) );
404
addScToolBar(fileToolBar, "ToolBar-File");
405
addScToolBar(editToolBar, "ToolBar-Edit");
406
addScToolBar(modeToolBar, "ToolBar-Tools");
407
addScToolBar(pdfToolBar, "ToolBar-PDF_Tools");
409
connect(modeToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarTools"], SLOT(setChecked(bool)));
410
connect(scrActions["toolsToolbarPDF"], SIGNAL(toggled(bool)), pdfToolBar, SLOT(setVisible(bool)));
411
connect(pdfToolBar, SIGNAL(visibilityChanged(bool)), scrActions["toolsToolbarPDF"], SLOT(setChecked(bool)));
412
connect(scrActions["toolsToolbarTools"], SIGNAL(toggled(bool)), modeToolBar, SLOT(setVisible(bool)) );
362
416
void ScribusMainWindow::initDefaultValues()
365
419
ScriptRunning = false;
370
423
PrinterUsed = false;
416
471
guidePalette = new GuideManager(this);
417
472
charPalette = new CharSelect(this);
418
473
connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) );
419
connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setOn(bool)));
474
connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setChecked(bool)));
420
475
layerPalette->installEventFilter(this);
421
476
layerPalette->Table->installEventFilter(this);
422
477
scrapbookPalette = new Biblio(this);
423
478
connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) );
424
connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setOn(bool)));
479
connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setChecked(bool)));
480
connect( scrapbookPalette, SIGNAL(pasteToActualPage(QString)), this, SLOT(pasteFromScrapbook(QString)));
425
481
scrapbookPalette->installEventFilter(this);
426
482
pagePalette = new PagePalette(this);
427
483
connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) );
428
484
connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , this, SLOT(setPagePalette(bool)) );
429
connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setOn(bool)));
485
connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setChecked(bool)));
430
486
pagePalette->installEventFilter(this);
431
487
bookmarkPalette = new BookPalette(this);
432
488
connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) );
433
connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setOn(bool)));
489
connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setChecked(bool)));
434
490
bookmarkPalette->installEventFilter(this);
435
measurementPalette = new Measurements(this);
436
connect( scrActions["toolsMeasurements"], SIGNAL(toggled(bool)) , measurementPalette, SLOT(setPaletteShown(bool)) );
491
// measurementPalette = new Measurements(this);
492
// connect( scrActions["toolsMeasurements"], SIGNAL(toggled(bool)) , measurementPalette, SLOT(setPaletteShown(bool)) );
437
493
connect( scrActions["toolsMeasurements"], SIGNAL(toggledData(bool, int)) , this, SLOT(setAppModeByToggle(bool, int)) );
438
connect( measurementPalette, SIGNAL(paletteShown(bool)), scrActions["toolsMeasurements"], SLOT(setOn(bool)));
439
measurementPalette->installEventFilter(this);
440
measurementPalette->hide();
494
// connect( measurementPalette, SIGNAL(paletteShown(bool)), scrActions["toolsMeasurements"], SLOT(setChecked(bool)));
495
// measurementPalette->installEventFilter(this);
496
// measurementPalette->hide();
441
497
docCheckerPalette = new CheckDocument(this, false);
442
498
connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , docCheckerPalette, SLOT(setPaletteShown(bool)) );
443
499
connect( scrActions["toolsPreflightVerifier"], SIGNAL(toggled(bool)) , this, SLOT(docCheckToggle(bool)) );
444
connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setOn(bool)));
500
connect( docCheckerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsPreflightVerifier"], SLOT(setChecked(bool)));
445
501
connect( docCheckerPalette, SIGNAL(paletteShown(bool)), this, SLOT(docCheckToggle(bool)));
446
502
docCheckerPalette->installEventFilter(this);
447
503
docCheckerPalette->hide();
449
505
alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette", false);
450
506
connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) );
451
connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setOn(bool)));
507
connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setChecked(bool)));
452
508
connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh()));
453
509
alignDistributePalette->installEventFilter(this);
896
934
scrMenuMgr->setMenuEnabled("Extras", false);
897
935
scrActions["extrasHyphenateText"]->setEnabled(false);
898
936
scrActions["extrasDeHyphenateText"]->setEnabled(false);
937
connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow()));
901
scrMenuMgr->createMenu("Windows", tr("&Windows"), QString::null, true);
902
connect(FontMenu, SIGNAL(aboutToShow()), this, SLOT(fontMenuAboutToShow()));
940
scrMenuMgr->createMenu("Windows", ActionManager::defaultMenuNameEntryTranslated("Windows"), QString::null, true);
903
941
connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow()));
904
942
addDefaultWindowMenuItems();
907
scrMenuMgr->createMenu("Help", tr("&Help"));
945
scrMenuMgr->createMenu("Help", ActionManager::defaultMenuNameEntryTranslated("Help"));
908
946
scrMenuMgr->addMenuItem(scrActions["helpManual"], "Help");
947
scrMenuMgr->addMenuItem(scrActions["helpManual2"], "Help");
909
948
scrMenuMgr->addMenuSeparator("Help");
910
949
scrMenuMgr->addMenuItem(scrActions["helpTooltips"], "Help");
911
950
scrMenuMgr->addMenuSeparator("Help");
951
scrMenuMgr->addMenuItem(scrActions["helpOnlineWWW"], "Help");
952
scrMenuMgr->addMenuItem(scrActions["helpOnlineDocs"], "Help");
953
scrMenuMgr->addMenuItem(scrActions["helpOnlineWiki"], "Help");
954
scrMenuMgr->createMenu("HelpOnlineTutorials", tr("Online &Tutorials"), "Help");
955
scrMenuMgr->addMenuItem(scrActions["helpOnlineTutorial1"], "HelpOnlineTutorials");
956
scrMenuMgr->addMenuSeparator("Help");
957
scrMenuMgr->addMenuItem(scrActions["helpCheckUpdates"], "Help");
958
scrMenuMgr->addMenuSeparator("Help");
912
959
scrMenuMgr->addMenuItem(scrActions["helpAboutScribus"], "Help");
913
960
scrMenuMgr->addMenuItem(scrActions["helpAboutPlugins"], "Help");
914
961
scrMenuMgr->addMenuItem(scrActions["helpAboutQt"], "Help");
916
963
scrMenuMgr->addMenuToMenuBar("File");
917
964
scrMenuMgr->addMenuToMenuBar("Edit");
918
scrMenuMgr->addMenuToMenuBar("Style");
919
scrMenuMgr->setMenuEnabled("Style", false);
920
965
scrMenuMgr->addMenuToMenuBar("Item");
921
966
scrMenuMgr->setMenuEnabled("Item", false);
922
967
scrMenuMgr->addMenuToMenuBar("Insert");
1119
1129
bool ScribusMainWindow::eventFilter( QObject* /*o*/, QEvent *e )
1122
if ( e->type() == QEvent::KeyPress ) {
1132
if (e->type() == QEvent::ToolTip)
1134
return (!prefsManager->appPrefs.showToolTips);
1136
if ( e->type() == QEvent::KeyPress )
1123
1138
QKeyEvent *k = (QKeyEvent *)e;
1125
if (k->state() & ShiftButton)
1127
if (k->state() & ControlButton)
1129
if (k->state() & AltButton)
1140
if (k->modifiers() & Qt::ShiftModifier)
1141
keyMod |= Qt::SHIFT;
1142
if (k->modifiers() & Qt::ControlModifier)
1144
if (k->modifiers() & Qt::AltModifier)
1132
1147
QKeySequence currKeySeq = QKeySequence(k->key() | keyMod);
1133
1148
if (QString(currKeySeq).isNull())
1136
1151
//Palette actions
1137
if (currKeySeq == scrActions["specialToggleAllPalettes"]->accel())
1138
scrActions["specialToggleAllPalettes"]->activate();
1140
if (currKeySeq == scrActions["toolsProperties"]->accel())
1141
scrActions["toolsProperties"]->toggle();
1143
if (currKeySeq == scrActions["toolsOutline"]->accel())
1144
scrActions["toolsOutline"]->toggle();
1146
if (currKeySeq == scrActions["toolsScrapbook"]->accel())
1147
scrActions["toolsScrapbook"]->toggle();
1149
if (currKeySeq == scrActions["toolsLayers"]->accel())
1150
scrActions["toolsLayers"]->toggle();
1152
if (currKeySeq == scrActions["toolsPages"]->accel())
1153
scrActions["toolsPages"]->toggle();
1155
if (currKeySeq == scrActions["toolsBookmarks"]->accel())
1156
scrActions["toolsBookmarks"]->toggle();
1158
if (currKeySeq == scrActions["toolsActionHistory"]->accel())
1159
scrActions["toolsActionHistory"]->toggle();
1161
if (currKeySeq == scrActions["toolsPreflightVerifier"]->accel())
1162
scrActions["toolsPreflightVerifier"]->toggle();
1164
if (currKeySeq == scrActions["toolsAlignDistribute"]->accel())
1165
scrActions["toolsAlignDistribute"]->toggle();
1152
if (currKeySeq == scrActions["specialToggleAllPalettes"]->shortcut())
1153
scrActions["specialToggleAllPalettes"]->activate(QAction::Trigger);
1155
// CB These were moved to ActionManager via the setShortcutContext(Qt::ApplicationShortcut) calls, leaving for notes for now
1156
// if (currKeySeq == scrActions["toolsProperties"]->accel())
1157
// scrActions["toolsProperties"]->toggle();
1159
// if (currKeySeq == scrActions["toolsOutline"]->accel())
1160
// scrActions["toolsOutline"]->toggle();
1162
// if (currKeySeq == scrActions["toolsScrapbook"]->accel())
1163
// scrActions["toolsScrapbook"]->toggle();
1165
// if (currKeySeq == scrActions["toolsLayers"]->accel())
1166
// scrActions["toolsLayers"]->toggle();
1168
// if (currKeySeq == scrActions["toolsPages"]->accel())
1169
// scrActions["toolsPages"]->toggle();
1171
// if (currKeySeq == scrActions["toolsBookmarks"]->accel())
1172
// scrActions["toolsBookmarks"]->toggle();
1174
// if (currKeySeq == scrActions["toolsActionHistory"]->accel())
1175
// scrActions["toolsActionHistory"]->toggle();
1177
// if (currKeySeq == scrActions["toolsPreflightVerifier"]->accel())
1178
// scrActions["toolsPreflightVerifier"]->toggle();
1180
// if (currKeySeq == scrActions["toolsAlignDistribute"]->accel())
1181
// scrActions["toolsAlignDistribute"]->toggle();
1168
if (currKeySeq == scrActions["editStyles"]->accel())
1184
if (currKeySeq == scrActions["editStyles"]->shortcut())
1169
1185
scrActions["editStyles"]->toggle();
1171
if (currKeySeq == scrActions["editUndoAction"]->accel() && scrActions["editUndoAction"]->isEnabled())
1172
scrActions["editUndoAction"]->activate();
1187
if (currKeySeq == scrActions["editUndoAction"]->shortcut() && scrActions["editUndoAction"]->isEnabled())
1188
scrActions["editUndoAction"]->activate(QAction::Trigger);
1174
if (currKeySeq == scrActions["editRedoAction"]->accel() && scrActions["editRedoAction"]->isEnabled())
1175
scrActions["editRedoAction"]->activate();
1190
if (currKeySeq == scrActions["editRedoAction"]->shortcut() && scrActions["editRedoAction"]->isEnabled())
1191
scrActions["editRedoAction"]->activate(QAction::Trigger);
1177
1193
//Other actions
1178
if (currKeySeq == scrActions["fileQuit"]->accel())
1179
scrActions["fileQuit"]->activate();
1194
if (currKeySeq == scrActions["fileQuit"]->shortcut())
1195
scrActions["fileQuit"]->activate(QAction::Trigger);
1182
if (currKeySeq == scrActions["toolsZoomIn"]->accel())
1183
scrActions["toolsZoomIn"]->activate();
1198
if (currKeySeq == scrActions["toolsZoomIn"]->shortcut())
1199
scrActions["toolsZoomIn"]->activate(QAction::Trigger);
1185
if (currKeySeq == scrActions["toolsZoomOut"]->accel())
1186
scrActions["toolsZoomOut"]->activate();
1201
if (currKeySeq == scrActions["toolsZoomOut"]->shortcut())
1202
scrActions["toolsZoomOut"]->activate(QAction::Trigger);
2326
2484
dia->updateDocumentSettings();
2327
2485
if (dia->imageResolutionChanged())
2329
setStatusBarInfoText( tr("Updating Pictures"));
2487
setStatusBarInfoText( tr("Updating Images"));
2330
2488
mainWindowProgressBar->reset();
2331
qApp->setOverrideCursor(QCursor(waitCursor), true);
2489
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
2332
2490
qApp->processEvents();
2333
2491
doc->recalcPicturesRes(true);
2334
qApp->setOverrideCursor(QCursor(arrowCursor), true);
2492
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
2335
2493
setStatusBarInfoText("");
2336
2494
mainWindowProgressBar->reset();
2495
view->previewQualitySwitcher->blockSignals(true);
2496
view->previewQualitySwitcher->setCurrentIndex(doc->toolSettings.lowResType);
2497
view->previewQualitySwitcher->blockSignals(false);
2338
FontSub->RebuildList(doc);
2339
2499
propertiesPalette->Fonts->RebuildList(doc);
2340
scrActions["viewShowMargins"]->setOn(doc->guidesSettings.marginsShown);
2341
scrActions["viewShowBleeds"]->setOn(doc->guidesSettings.showBleed);
2342
scrActions["viewShowFrames"]->setOn(doc->guidesSettings.framesShown);
2343
scrActions["viewShowLayerMarkers"]->setOn(doc->guidesSettings.layerMarkersShown);
2344
scrActions["viewShowGrid"]->setOn(doc->guidesSettings.gridShown);
2345
scrActions["viewShowGuides"]->setOn(doc->guidesSettings.guidesShown);
2346
scrActions["viewShowColumnBorders"]->setOn(doc->guidesSettings.colBordersShown);
2347
scrActions["viewShowBaseline"]->setOn(doc->guidesSettings.baseShown);
2348
scrActions["viewShowImages"]->setOn(doc->guidesSettings.showPic);
2349
scrActions["viewShowTextChain"]->setOn(doc->guidesSettings.linkShown);
2350
scrActions["viewShowTextControls"]->setOn(doc->guidesSettings.showControls);
2351
scrActions["viewShowRulers"]->setOn(doc->guidesSettings.rulersShown);
2352
scrActions["viewRulerMode"]->setOn(doc->guidesSettings.rulerMode);
2500
scrActions["viewShowMargins"]->setChecked(doc->guidesSettings.marginsShown);
2501
scrActions["viewShowBleeds"]->setChecked(doc->guidesSettings.showBleed);
2502
scrActions["viewShowFrames"]->setChecked(doc->guidesSettings.framesShown);
2503
scrActions["viewShowLayerMarkers"]->setChecked(doc->guidesSettings.layerMarkersShown);
2504
scrActions["viewShowGrid"]->setChecked(doc->guidesSettings.gridShown);
2505
scrActions["viewShowGuides"]->setChecked(doc->guidesSettings.guidesShown);
2506
scrActions["viewShowColumnBorders"]->setChecked(doc->guidesSettings.colBordersShown);
2507
scrActions["viewShowBaseline"]->setChecked(doc->guidesSettings.baseShown);
2508
scrActions["viewShowImages"]->setChecked(doc->guidesSettings.showPic);
2509
scrActions["viewShowTextChain"]->setChecked(doc->guidesSettings.linkShown);
2510
scrActions["viewShowTextControls"]->setChecked(doc->guidesSettings.showControls);
2511
scrActions["viewShowRulers"]->setChecked(doc->guidesSettings.rulersShown);
2512
scrActions["viewRulerMode"]->setChecked(doc->guidesSettings.rulerMode);
2353
2513
scrActions["extrasGenerateTableOfContents"]->setEnabled(doc->hasTOCSetup());
2354
view->cmsToolbarButton->setOn(doc->HasCMS);
2514
view->cmsToolbarButton->setChecked(doc->HasCMS);
2355
2515
//doc emits changed() via this
2356
2516
doc->setMasterPageMode(true);
2357
2517
view->reformPages();
2568
2738
// connect(view, SIGNAL(ItemTrans(double, double)), propertiesPalette->Cpal, SLOT(setActTrans(double, double)));
2569
2739
// connect(view, SIGNAL(ItemBlend(int, int)), propertiesPalette->Cpal, SLOT(setActBlend(int, int)));
2570
2740
connect(view, SIGNAL(ItemTextAttr(double)), propertiesPalette, SLOT(setLsp(double)));
2571
connect(view, SIGNAL(ItemTextUSval(int)), propertiesPalette, SLOT(setExtra(int)));
2741
connect(view, SIGNAL(ItemTextUSval(double)), propertiesPalette, SLOT(setExtra(double)));
2572
2742
// connect(view, SIGNAL(ItemTextCols(int, double)), propertiesPalette, SLOT(setCols(int, double)));
2573
connect(view, SIGNAL(SetDistValues(double, double, double, double)), propertiesPalette, SLOT(setDvals(double, double, double, double)));
2743
connect(view, SIGNAL(SetDistValues(double, double, double, double)), propertiesPalette, SLOT(setTextToFrameDistances(double, double, double, double)));
2574
2744
connect(view, SIGNAL(ItemTextAbs(int)), propertiesPalette, SLOT(setAli(int)));
2575
connect(view, SIGNAL(ItemTextFont(const QString&)), this, SLOT(AdjustFontMenu(const QString&)));
2576
2745
connect(view, SIGNAL(ItemTextFont(const QString&)), propertiesPalette, SLOT(setFontFace(const QString&)));
2577
connect(view, SIGNAL(ItemTextSize(int)), propertiesPalette, SLOT(setSize(int)));
2746
connect(view, SIGNAL(ItemTextSize(double)), propertiesPalette, SLOT(setSize(double)));
2578
2747
//connect(view, SIGNAL(ItemRadius(double)), propertiesPalette, SLOT(setRR(double)));
2579
connect(view, SIGNAL(Amode(int)), this, SLOT(setAppMode(int)));
2748
// connect(view, SIGNAL(Amode(int)), this, SLOT(setAppMode(int)));
2580
2749
connect(view, SIGNAL(PaintingDone()), this, SLOT(slotSelect()));
2581
2750
connect(view, SIGNAL(DocChanged()), this, SLOT(slotDocCh()));
2582
2751
//connect(view, SIGNAL(HavePoint(bool, bool)), nodePalette, SLOT(HaveNode(bool, bool)));
2583
2752
connect(view, SIGNAL(MousePos(double, double)), this, SLOT(setStatusBarMousePosition(double, double)));
2584
2753
//connect(view, SIGNAL(ItemRadius(double)), propertiesPalette, SLOT(setRR(double)));
2585
2754
connect(view, SIGNAL(ItemTextStil(int)), propertiesPalette, SLOT(setStil(int)));
2586
connect(view, SIGNAL(ItemTextSca(int)), propertiesPalette, SLOT(setTScale(int)));
2587
connect(view, SIGNAL(ItemTextScaV(int)), propertiesPalette, SLOT(setTScaleV(int)));
2588
connect(view, SIGNAL(ItemTextBase(int)), propertiesPalette, SLOT(setTBase(int)));
2589
connect(view, SIGNAL(ItemTextShadow(int, int )), propertiesPalette, SLOT(setShadowOffs(int, int )));
2590
connect(view, SIGNAL(ItemTextUnderline(int, int)), propertiesPalette, SLOT(setUnderline(int, int)));
2591
connect(view, SIGNAL(ItemTextStrike(int, int)), propertiesPalette, SLOT(setStrike(int, int)));
2592
connect(view, SIGNAL(ItemTextOutline(int)), propertiesPalette, SLOT(setOutlineW(int)));
2593
connect(view, SIGNAL(ItemTextSize(int)), this, SLOT(setFSizeMenu(int)));
2755
connect(view, SIGNAL(ItemTextSca(double)), propertiesPalette, SLOT(setTScale(double)));
2756
connect(view, SIGNAL(ItemTextScaV(double)), propertiesPalette, SLOT(setTScaleV(double)));
2757
connect(view, SIGNAL(ItemTextBase(double)), propertiesPalette, SLOT(setTBase(double)));
2758
connect(view, SIGNAL(ItemTextShadow(double, double )), propertiesPalette, SLOT(setShadowOffs(double, double )));
2759
connect(view, SIGNAL(ItemTextUnderline(double, double)), propertiesPalette, SLOT(setUnderline(double, double)));
2760
connect(view, SIGNAL(ItemTextStrike(double, double)), propertiesPalette, SLOT(setStrike(double, double)));
2761
connect(view, SIGNAL(ItemTextOutline(double)), propertiesPalette, SLOT(setOutlineW(double)));
2594
2762
connect(view, SIGNAL(ItemTextStil(int)), this, SLOT(setStilvalue(int)));
2595
2763
connect(view, SIGNAL(ItemTextAbs(int)), this, SLOT(setAbsValue(int)));
2596
connect(view, SIGNAL(ItemTextFarben(QString, QString, int, int)), propertiesPalette, SLOT(setActFarben(QString, QString, int, int)));
2764
connect(view, SIGNAL(ItemTextFarben(QString, QString, double, double)), propertiesPalette, SLOT(setActFarben(QString, QString, double, double)));
2597
2765
connect(view, SIGNAL(HasTextSel()), this, SLOT(EnableTxEdit()));
2598
2766
connect(view, SIGNAL(HasNoTextSel()), this, SLOT(DisableTxEdit()));
2599
2767
connect(view, SIGNAL(CopyItem()), this, SLOT(slotEditCopy()));
2600
2768
connect(view, SIGNAL(CutItem()), this, SLOT(slotEditCut()));
2601
2769
connect(view, SIGNAL(LoadPic()), this, SLOT(slotGetContent()));
2770
connect(view, SIGNAL(StatusPic()), this, SLOT(StatusPic()));
2602
2771
connect(view, SIGNAL(AppendText()), this, SLOT(slotFileAppend()));
2603
2772
connect(view, SIGNAL(AnnotProps()), this, SLOT(ModifyAnnot()));
2604
2773
//connect(view, SIGNAL(EditGuides()), this, SLOT(ManageGuides()));
2605
2774
connect(view, SIGNAL(LoadElem(QString, double ,double, bool, bool, ScribusDoc *, ScribusView*)), this, SLOT(slotElemRead(QString, double, double, bool, bool, ScribusDoc *, ScribusView*)));
2606
2775
connect(view, SIGNAL(AddBM(PageItem *)), this, SLOT(AddBookMark(PageItem *)));
2607
2776
connect(view, SIGNAL(DelBM(PageItem *)), this, SLOT(DelBookMark(PageItem *)));
2608
connect(view, SIGNAL(RasterPic(bool)), this, SLOT(HaveRaster(bool)));
2609
2777
connect(view, SIGNAL(DoGroup()), this, SLOT(GroupObj()));
2610
connect(view, SIGNAL(EndNodeEdit()), this, SLOT(ToggleFrameEdit()));
2778
// connect(view, SIGNAL(EndNodeEdit()), this, SLOT(ToggleFrameEdit()));
2611
2779
connect(view, SIGNAL(LevelChanged(uint )), propertiesPalette, SLOT(setLevel(uint)));
2612
2780
connect(view, SIGNAL(callGimp()), this, SLOT(callImageEditor()));
2615
void ScribusMainWindow::HaveNewSel(int Nr)
2783
void ScribusMainWindow::HaveNewSel(int SelectedType)
2785
bool isRaster = false;
2617
2786
PageItem *currItem = NULL;
2787
const uint docSelectionCount=doc->m_Selection->count();
2788
if (SelectedType != -1)
2620
if (doc->m_Selection->count() != 0)
2790
if (docSelectionCount != 0)
2622
uint lowestItem = 999999;
2623
for (uint a=0; a<doc->m_Selection->count(); ++a)
2792
PageItem *lowestItem = doc->m_Selection->itemAt(0);
2793
for (uint a=0; a < docSelectionCount; ++a)
2625
2795
currItem = doc->m_Selection->itemAt(a);
2626
lowestItem = QMIN(lowestItem, currItem->ItemNr);
2796
if (currItem->ItemNr < lowestItem->ItemNr)
2797
lowestItem = currItem;
2628
currItem = doc->Items->at(lowestItem);
2799
currItem = lowestItem;
2800
if ((docSelectionCount == 1) && currItem && currItem->asImageFrame())
2801
isRaster = currItem->isRaster;
2629
2802
// doc->m_Selection->removeItem(currItem);
2630
2803
// doc->m_Selection->prependItem(currItem);
2631
2804
// currItem = doc->m_Selection->itemAt(0);
2812
else if (docSelectionCount > 0)
2814
currItem = doc->m_Selection->itemAt(0);
2816
assert (docSelectionCount == 0 || currItem != NULL); // help coverity analysis
2638
2818
actionManager->disconnectNewSelectionActions();
2639
scrActions["editDeselectAll"]->setEnabled(Nr!=-1);
2819
scrActions["editSelectAllOnLayer"]->setEnabled(true);
2820
scrActions["editDeselectAll"]->setEnabled(SelectedType != -1);
2640
2821
scrActions["itemDetachTextFromPath"]->setEnabled(false);
2641
2822
charPalette->setEnabled(false, 0);
2642
scrActions["itemUpdateImage"]->setEnabled(Nr==PageItem::ImageFrame && currItem->PicAvail);
2643
scrActions["itemAdjustFrameToImage"]->setEnabled(Nr==PageItem::ImageFrame && currItem->PicAvail && !currItem->isTableItem);
2644
scrActions["itemExtendedImageProperties"]->setEnabled(Nr==PageItem::ImageFrame && currItem->PicAvail && currItem->pixm.imgInfo.valid);
2645
scrMenuMgr->setMenuEnabled("ItemPreviewSettings", Nr==PageItem::ImageFrame);
2646
scrActions["itemImageIsVisible"]->setEnabled(Nr==PageItem::ImageFrame);
2647
scrActions["itemPreviewLow"]->setEnabled(Nr==PageItem::ImageFrame);
2648
scrActions["itemPreviewNormal"]->setEnabled(Nr==PageItem::ImageFrame);
2649
scrActions["itemPreviewFull"]->setEnabled(Nr==PageItem::ImageFrame);
2650
scrActions["styleImageEffects"]->setEnabled(Nr==PageItem::ImageFrame);
2651
scrActions["editCopyContents"]->setEnabled(Nr==PageItem::ImageFrame && currItem->PicAvail);
2652
scrActions["editPasteContents"]->setEnabled(Nr==PageItem::ImageFrame);
2653
scrActions["editPasteContentsAbs"]->setEnabled(Nr==PageItem::ImageFrame);
2654
scrActions["editEditWithImageEditor"]->setEnabled(Nr==PageItem::ImageFrame && currItem->PicAvail && currItem->isRaster);
2655
if (Nr!=PageItem::ImageFrame)
2823
scrActions["itemUpdateImage"]->setEnabled(SelectedType==PageItem::ImageFrame && (currItem->PictureIsAvailable || currItem->asLatexFrame()));
2824
scrActions["itemAdjustFrameToImage"]->setEnabled(SelectedType==PageItem::ImageFrame && currItem->PictureIsAvailable && !currItem->isTableItem);
2825
scrActions["itemAdjustImageToFrame"]->setEnabled(SelectedType==PageItem::ImageFrame && currItem->PictureIsAvailable);
2826
scrActions["itemExtendedImageProperties"]->setEnabled(SelectedType==PageItem::ImageFrame && currItem->PictureIsAvailable && currItem->pixm.imgInfo.valid);
2827
scrMenuMgr->setMenuEnabled("ItemPreviewSettings", SelectedType==PageItem::ImageFrame);
2828
scrActions["itemImageIsVisible"]->setEnabled(SelectedType==PageItem::ImageFrame);
2829
scrActions["itemPreviewLow"]->setEnabled(SelectedType==PageItem::ImageFrame);
2830
scrActions["itemPreviewNormal"]->setEnabled(SelectedType==PageItem::ImageFrame);
2831
scrActions["itemPreviewFull"]->setEnabled(SelectedType==PageItem::ImageFrame);
2832
scrActions["styleImageEffects"]->setEnabled(SelectedType==PageItem::ImageFrame && isRaster);
2833
scrActions["editCopyContents"]->setEnabled(SelectedType==PageItem::ImageFrame && currItem->PictureIsAvailable);
2834
scrActions["editPasteContents"]->setEnabled(SelectedType==PageItem::ImageFrame);
2835
scrActions["editPasteContentsAbs"]->setEnabled(SelectedType==PageItem::ImageFrame);
2836
scrActions["editEditWithImageEditor"]->setEnabled(SelectedType==PageItem::ImageFrame && currItem->PictureIsAvailable && currItem->isRaster);
2837
scrActions["editEditRenderSource"]->setEnabled(SelectedType==PageItem::ImageFrame && currItem && currItem->asLatexFrame());
2838
if (SelectedType!=PageItem::ImageFrame)
2657
scrActions["itemImageIsVisible"]->setOn(false);
2658
scrActions["itemPreviewLow"]->setOn(false);
2659
scrActions["itemPreviewNormal"]->setOn(false);
2660
scrActions["itemPreviewFull"]->setOn(false);
2840
scrActions["itemImageIsVisible"]->setChecked(false);
2841
scrActions["itemPreviewLow"]->setChecked(false);
2842
scrActions["itemPreviewNormal"]->setChecked(false);
2843
scrActions["itemPreviewFull"]->setChecked(false);
2662
if ((Nr==-1) || (Nr!=-1 && !currItem->asTextFrame()))
2845
if ((SelectedType==-1) || (SelectedType!=-1 && !currItem->asTextFrame()))
2663
2846
enableTextActions(&scrActions, false);
2664
2847
scrActions["insertSampleText"]->setEnabled(false);
2666
2849
view->horizRuler->ItemPosValid = false;
2667
view->horizRuler->repaint();
2850
view->horizRuler->update();
2851
switch (SelectedType)
2670
2853
case -1: // None
2671
2854
scrActions["fileImportText"]->setEnabled(false);
3025
3230
scrActions["itemSendToScrapbook"]->setEnabled(setter);
3026
3231
scrActions["itemSendToPattern"]->setEnabled(setter);
3028
scrActions["itemLock"]->setOn(currItem->locked());
3029
scrActions["itemLockSize"]->setOn(currItem->sizeLocked());
3030
scrActions["itemPrintingEnabled"]->setOn(currItem->printEnabled());
3233
scrActions["itemLock"]->setChecked(currItem->locked());
3234
scrActions["itemLockSize"]->setChecked(currItem->sizeLocked());
3235
scrActions["itemPrintingEnabled"]->setChecked(currItem->printEnabled());
3033
//propertiesPalette->NewSel(Nr);
3238
//propertiesPalette->NewSel(SelectedType);
3239
if (SelectedType != -1)
3036
3241
//propertiesPalette->SetCurItem(currItem);
3037
3242
outlinePalette->slotShowSelect(currItem->OwnPage, currItem->ItemNr);
3038
if (currItem->FrameType == 0)
3039
SCustom->setPixmap(SCustom->getIconPixmap(0));
3040
if (currItem->FrameType == 1)
3041
SCustom->setPixmap(SCustom->getIconPixmap(1));
3042
if (currItem->FrameType > 3)
3043
SCustom->setPixmap(SCustom->getIconPixmap(currItem->FrameType-2));
3044
3243
actionManager->connectNewSelectionActions(view, doc);
3045
// propertiesPalette->NewSel(Nr);
3244
// propertiesPalette->NewSel(SelectedType);
3048
propertiesPalette->NewSel(Nr);
3247
propertiesPalette->NewSel(SelectedType);
3051
void ScribusMainWindow::rebuildStyleMenu(int itemType)
3053
scrMenuMgr->clearMenu("Style");
3249
PluginManager& pluginManager(PluginManager::instance());
3250
QStringList pluginNames(pluginManager.pluginNames(false));
3252
ScActionPlugin* ixplug;
3253
ScrAction* pluginAction = 0;
3255
for (int i = 0; i < pluginNames.count(); ++i)
3059
if (doc->m_Selection->count() == 0)
3257
pName = pluginNames.at(i);
3258
plugin = pluginManager.getPlugin(pName, true);
3259
Q_ASSERT(plugin); // all the returned names should represent loaded plugins
3260
if (plugin->inherits("ScActionPlugin"))
3063
PageItem *currItem = doc->m_Selection->itemAt(0);
3262
ixplug = dynamic_cast<ScActionPlugin*>(plugin);
3264
ScActionPlugin::ActionInfo ai(ixplug->actionInfo());
3265
pluginAction = ScCore->primaryMainWindow()->scrActions[ai.name];
3266
if (pluginAction != 0)
3267
pluginAction->setEnabled(ixplug->handleSelection(doc, SelectedType));
3068
if (iT==PageItem::TextFrame || iT==PageItem::PathText)
3070
scrMenuMgr->addMenuToMenu("Font","Style");
3071
scrMenuMgr->addMenuToMenu("FontSize","Style");
3072
scrMenuMgr->addMenuToMenu("TypeEffects","Style");
3073
scrMenuMgr->addMenuToMenu("Alignment","Style");
3074
scrMenuMgr->addMenuToMenu("Color","Style");
3075
scrMenuMgr->addMenuToMenu("Shade","Style");
3076
if (itemType==PageItem::TextFrame)
3077
scrMenuMgr->addMenuItem(scrActions["styleTabulators"], "Style");
3078
scrMenuMgr->setMenuEnabled("Style", true);
3081
scrMenuMgr->setMenuEnabled("Style", false);
3084
3272
void ScribusMainWindow::slotDocCh(bool /*reb*/)
3152
3348
void ScribusMainWindow::rebuildRecentFileMenu()
3154
for( QMap<QString, QGuardedPtr<ScrAction> >::Iterator it = scrRecentFileActions.begin(); it!=scrRecentFileActions.end(); ++it )
3350
for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrRecentFileActions.begin(); it!=scrRecentFileActions.end(); ++it )
3155
3351
scrMenuMgr->removeMenuItem((*it), recentFileMenuName);
3157
3353
scrRecentFileActions.clear();
3158
uint max = QMIN(prefsManager->appPrefs.RecentDCount, RecentDocs.count());
3354
uint max = qMin(prefsManager->appPrefs.RecentDCount, RecentDocs.count());
3159
3355
QString strippedName, localName;
3160
3356
for (uint m = 0; m < max; ++m)
3162
3358
strippedName=RecentDocs[m];
3163
3359
strippedName.remove(QDir::separator());
3164
3360
localName=QDir::convertSeparators(RecentDocs[m]);
3165
scrRecentFileActions.insert(strippedName, new ScrAction(ScrAction::RecentFile, QIconSet(), QString("&%1 %2").arg(m+1).arg(localName), QKeySequence(), this, strippedName,0,0.0,RecentDocs[m]));
3166
connect( scrRecentFileActions[strippedName], SIGNAL(activatedData(QString)), this, SLOT(loadRecent(QString)) );
3361
scrRecentFileActions.insert(strippedName, new ScrAction(ScrAction::RecentFile, QPixmap(), QPixmap(), QString("&%1 %2").arg(m+1).arg(localName), QKeySequence(), this, 0,0.0,RecentDocs[m]));
3362
connect( scrRecentFileActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(loadRecent(QString)) );
3167
3363
scrMenuMgr->addMenuItem(scrRecentFileActions[strippedName], recentFileMenuName);
3171
3367
void ScribusMainWindow::rebuildRecentPasteMenu()
3173
for( QMap<QString, QGuardedPtr<ScrAction> >::Iterator it = scrRecentPasteActions.begin(); it!=scrRecentPasteActions.end(); ++it )
3369
for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrRecentPasteActions.begin(); it!=scrRecentPasteActions.end(); ++it )
3174
3370
scrMenuMgr->removeMenuItem((*it), recentPasteMenuName);
3176
3372
scrRecentPasteActions.clear();
3177
uint max = QMIN(static_cast<uint>(prefsManager->appPrefs.numScrapbookCopies), scrapbookPalette->tempBView->objectMap.count());
3373
int max = qMin(prefsManager->appPrefs.numScrapbookCopies, scrapbookPalette->tempBView->objectMap.count());
3180
3376
QMap<QString,BibView::Elem>::Iterator it;
3181
3377
it = scrapbookPalette->tempBView->objectMap.end();
3183
3379
QString strippedName;
3184
for (uint m = 0; m < max; ++m)
3380
for (int m = 0; m < max; ++m)
3186
3382
strippedName = it.key();
3187
QPixmap pm = it.data().Preview;
3188
scrRecentPasteActions.insert(strippedName, new ScrAction(ScrAction::RecentPaste, QIconSet(pm), QString("&%1 %2").arg(m+1).arg(strippedName), QKeySequence(), this, strippedName,0,0.0,it.key()));
3189
connect( scrRecentPasteActions[strippedName], SIGNAL(activatedData(QString)), this, SLOT(pasteRecent(QString)) );
3383
QPixmap pm = it.value().Preview;
3384
scrRecentPasteActions.insert(strippedName, new ScrAction(ScrAction::RecentPaste, pm, QPixmap(), QString("&%1 %2").arg(m+1).arg(strippedName), QKeySequence(), this, 0,0.0,it.key()));
3385
connect( scrRecentPasteActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(pasteRecent(QString)) );
3190
3386
scrMenuMgr->addMenuItem(scrRecentPasteActions[strippedName], recentPasteMenuName);
3392
void ScribusMainWindow::pasteFromScrapbook(QString fn)
3394
doPasteRecent(scrapbookPalette->activeBView->objectMap[fn].Data);
3196
3397
void ScribusMainWindow::pasteRecent(QString fn)
3198
QString data = scrapbookPalette->tempBView->objectMap[fn].Data;
3200
if (fi.extension(true).lower() == "sml")
3204
StencilReader *pre = new StencilReader();
3205
data = pre->createObjects(f);
3208
else if (fi.extension(true).lower() == "shape")
3212
StencilReader *pre = new StencilReader();
3213
data = pre->createShape(f);
3216
else if (fi.extension(true).lower() == "sce")
3222
view->Deselect(true);
3223
uint ac = doc->Items->count();
3224
bool savedAlignGrid = doc->useRaster;
3225
bool savedAlignGuides = doc->SnapGuides;
3226
doc->useRaster = false;
3227
doc->SnapGuides = false;
3228
slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
3229
doc->useRaster = savedAlignGrid;
3230
doc->SnapGuides = savedAlignGuides;
3231
for (uint as = ac; as < doc->Items->count(); ++as)
3233
PageItem* currItem = doc->Items->at(as);
3234
if (currItem->isBookmark)
3235
AddBookMark(currItem);
3236
view->SelectItemNr(as);
3399
doPasteRecent(scrapbookPalette->tempBView->objectMap[fn].Data);
3402
void ScribusMainWindow::doPasteRecent(QString data)
3406
UndoTransaction pasteAction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Create,"",Um::ICreate));
3408
if (fi.suffix().toLower() == "sml")
3412
StencilReader *pre = new StencilReader();
3413
data = pre->createObjects(f);
3416
else if (fi.suffix().toLower() == "shape")
3420
StencilReader *pre = new StencilReader();
3421
data = pre->createShape(f);
3424
view->Deselect(true);
3425
uint ac = doc->Items->count();
3426
bool savedAlignGrid = doc->useRaster;
3427
bool savedAlignGuides = doc->SnapGuides;
3428
doc->useRaster = false;
3429
doc->SnapGuides = false;
3430
if (fi.suffix().toLower() == "sce")
3431
slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, true, doc, view);
3433
slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
3434
doc->useRaster = savedAlignGrid;
3435
doc->SnapGuides = savedAlignGuides;
3436
Selection tmpSelection(this, false);
3437
tmpSelection.copy(*doc->m_Selection, true);
3438
for (int as = ac; as < doc->Items->count(); ++as)
3440
PageItem* currItem = doc->Items->at(as);
3441
doc->setRedrawBounding(currItem);
3442
tmpSelection.addItem(currItem, true);
3443
if (currItem->isBookmark)
3444
AddBookMark(currItem);
3446
doc->m_Selection->copy(tmpSelection, false);
3447
pasteAction.commit();
3238
3448
slotDocCh(false);
3449
doc->regionsChanged()->update(QRectF());
3453
void ScribusMainWindow::importVectorFile()
3455
QString fileName = "";
3456
QString formats = "";
3457
QString allFormats = tr("All Supported Formats")+" (";
3458
int fmtCode = FORMATID_ODGIMPORT;
3459
const FileFormat *fmt = LoadSavePlugin::getFormatById(fmtCode);
3464
formats += fmt->filter + ";;";
3465
int an = fmt->filter.indexOf("(");
3466
int en = fmt->filter.indexOf(")");
3469
allFormats += fmt->filter.mid(an+1, en-an-1)+" ";
3470
an = fmt->filter.indexOf("(", en);
3471
en = fmt->filter.indexOf(")", an);
3475
fmt = LoadSavePlugin::getFormatById(fmtCode);
3477
allFormats += "*.sce *.SCE ";
3478
allFormats += "*.shape *.SHAPE ";
3479
allFormats += "*.sml *.SML);;";
3480
formats += "Scribus Objects (*.sce *.SCE);;";
3481
formats += "Dia Shapes (*.shape *.SHAPE);;";
3482
formats += "Kivio Stencils (*.sml *.SML)";
3483
allFormats += formats;
3484
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
3485
QString wdir = dirs->get("pastefile", ".");
3486
CustomFDialog dia(this, wdir, tr("Open"), allFormats, fdHidePreviewCheckBox | fdExistingFiles);
3487
if (dia.exec() == QDialog::Accepted)
3488
fileName = dia.selectedFile();
3491
if (!fileName.isEmpty())
3493
PrefsManager::instance()->prefsFile->getContext("dirs")->set("pastefile", fileName.left(fileName.lastIndexOf("/")));
3494
QFileInfo fi(fileName);
3495
QString suffix = fi.suffix().toLower();
3496
if ((suffix == "sce") || (suffix == "sml") || (suffix == "shape"))
3499
QMimeData* md = new QMimeData();
3500
urls.append( QUrl::fromLocalFile(fileName) );
3502
QDrag* dr = new QDrag(this);
3503
dr->setMimeData(md);
3504
const QPixmap& dragCursor = loadIcon("DragPix.xpm");
3505
dr->setDragCursor(dragCursor, Qt::CopyAction);
3506
dr->setDragCursor(dragCursor, Qt::MoveAction);
3507
dr->setDragCursor(dragCursor, Qt::LinkAction);
3512
FileLoader *fileLoader = new FileLoader(fileName);
3513
int testResult = fileLoader->TestFile();
3515
if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
3517
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
3519
fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive);
3241
3525
void ScribusMainWindow::rebuildLayersList()
3245
for( QMap<QString, QGuardedPtr<ScrAction> >::Iterator it0 = scrLayersActions.begin(); it0 != scrLayersActions.end(); ++it0 )
3529
for( QMap<QString, QPointer<ScrAction> >::Iterator it0 = scrLayersActions.begin(); it0 != scrLayersActions.end(); ++it0 )
3246
3530
scrMenuMgr->removeMenuItem((*it0), layerMenuName);
3247
3531
scrLayersActions.clear();
3248
QValueList<Layer>::iterator it;
3532
ScLayers::iterator it;
3249
3533
if (doc->Layers.count()!= 0)
3251
3535
for (it = doc->Layers.begin(); it != doc->Layers.end(); ++it)
3253
scrLayersActions.insert(QString("%1").arg((*it).LNr), new ScrAction( ScrAction::Layer, QIconSet(), (*it).Name, QKeySequence(), this, (*it).Name, (*it).LNr));
3537
scrLayersActions.insert(QString("%1").arg((*it).LNr), new ScrAction( ScrAction::Layer, QPixmap(), QPixmap(), (*it).Name, QKeySequence(), this, (*it).LNr));
3254
3538
scrLayersActions[QString("%1").arg((*it).LNr)]->setToggleAction(true);
3540
pm.fill((*it).markerColor);
3541
scrLayersActions[QString("%1").arg((*it).LNr)]->setIcon(pm);
3257
3544
int currActiveLayer=doc->activeLayer();
4113
4452
undoManager->removeStack(doc->DocName);
4114
4453
closeActiveWindowMasterPageEditor();
4115
setAppMode(modeNormal);
4116
4455
doc->autoSaveTimer->stop();
4456
ScCore->fileWatcher->stop();
4117
4457
disconnect(doc->autoSaveTimer, SIGNAL(timeout()), doc->WinHan, SLOT(slotAutoSave()));
4118
4458
disconnect(doc->WinHan, SIGNAL(AutoSaved()), this, SLOT(slotAutoSaved()));
4119
4459
disconnect(ScCore->fileWatcher, SIGNAL(fileChanged(QString )), doc, SLOT(updatePict(QString)));
4120
4460
disconnect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), doc, SLOT(removePict(QString)));
4121
for (uint a = 0; a < doc->DocItems.count(); ++a)
4461
disconnect(ScCore->fileWatcher, SIGNAL(dirChanged(QString )), doc, SLOT(updatePictDir(QString )));
4462
for (int a = 0; a < doc->DocItems.count(); ++a)
4123
4464
PageItem *currItem = doc->DocItems.at(a);
4124
if (currItem->PicAvail)
4465
if (currItem->PictureIsAvailable)
4125
4466
ScCore->fileWatcher->removeFile(currItem->Pfile);
4467
if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
4469
QFileInfo fi(currItem->Pfile);
4470
ScCore->fileWatcher->removeDir(fi.absolutePath());
4127
for (uint a = 0; a < doc->MasterItems.count(); ++a)
4473
for (int a = 0; a < doc->MasterItems.count(); ++a)
4129
4475
PageItem *currItem = doc->MasterItems.at(a);
4130
if (currItem->PicAvail)
4476
if (currItem->PictureIsAvailable)
4131
4477
ScCore->fileWatcher->removeFile(currItem->Pfile);
4478
if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
4480
QFileInfo fi(currItem->Pfile);
4481
ScCore->fileWatcher->removeDir(fi.absolutePath());
4133
for (uint a = 0; a < doc->FrameItems.count(); ++a)
4484
for (int a = 0; a < doc->FrameItems.count(); ++a)
4135
4486
PageItem *currItem = doc->FrameItems.at(a);
4136
if (currItem->PicAvail)
4487
if (currItem->PictureIsAvailable)
4137
4488
ScCore->fileWatcher->removeFile(currItem->Pfile);
4489
if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
4491
QFileInfo fi(currItem->Pfile);
4492
ScCore->fileWatcher->removeDir(fi.absolutePath());
4139
4495
QStringList patterns = doc->docPatterns.keys();
4140
for (uint c = 0; c < patterns.count(); ++c)
4496
for (int c = 0; c < patterns.count(); ++c)
4142
4498
ScPattern pa = doc->docPatterns[patterns[c]];
4143
for (uint o = 0; o < pa.items.count(); o++)
4499
for (int o = 0; o < pa.items.count(); o++)
4145
4501
PageItem *currItem = pa.items.at(o);
4146
if (currItem->PicAvail)
4502
if (currItem->PictureIsAvailable)
4147
4503
ScCore->fileWatcher->removeFile(currItem->Pfile);
4504
if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
4506
QFileInfo fi(currItem->Pfile);
4507
ScCore->fileWatcher->removeDir(fi.absolutePath());
4150
4511
if (ScCore->haveCMS())
4314
4693
docCheckerPalette->setIgnoreEnabled(false);
4315
4694
docCheckerPalette->hide();
4316
4695
docCheckerPalette->checkMode = CheckDocument::checkNULL;
4317
scrActions["toolsPreflightVerifier"]->setOn(false);
4696
scrActions["toolsPreflightVerifier"]->setChecked(false);
4318
4697
disconnect(docCheckerPalette, SIGNAL(ignoreAllErrors()), this, SLOT(slotReallyPrint()));
4320
4700
PrintOptions options;
4321
4701
mainWindowStatusLabel->setText( tr("Printing..."));
4324
doc->Print_Options.printer = PDef.Pname;
4325
doc->Print_Options.filename = PDef.Dname;
4329
doc->Print_Options.printer = "";
4702
if (doc->Print_Options.firstUse)
4704
doc->Print_Options.printer = QString();
4330
4705
if (!doc->DocName.startsWith( tr("Document")))
4332
4707
QFileInfo fi(doc->DocName);
4333
doc->Print_Options.filename = fi.dirPath()+"/"+fi.baseName()+".ps";
4708
doc->Print_Options.filename = fi.path()+"/"+fi.baseName()+".ps";
4337
4712
QDir di = QDir();
4338
doc->Print_Options.filename = di.currentDirPath()+"/"+doc->DocName+".ps";
4713
doc->Print_Options.filename = di.currentPath()+"/"+doc->DocName+".ps";
4341
4716
doc->Print_Options.copies = 1;
4342
4717
ColorList usedSpots;
4343
4718
doc->getUsedColors(usedSpots, true);
4344
4719
QStringList spots = usedSpots.keys();
4345
qDebug(QString("scribus.cpp: before print dialog color=%1 copies = %2").arg(doc->Print_Options.useColor).arg(doc->Print_Options.copies));
4346
Druck *printer = new Druck(this, doc, doc->Print_Options.filename, doc->Print_Options.printer, PDef.Command, PDef.DevMode, prefsManager->appPrefs.GCRMode, spots);
4720
PrintDialog *printer = new PrintDialog(this, doc, doc->Print_Options.filename, doc->Print_Options.printer, PDef.Command, doc->Print_Options.devMode, prefsManager->appPrefs.GCRMode, spots);
4347
4721
printer->setMinMax(1, doc->Pages->count(), doc->currentPage()->pageNr()+1);
4348
4722
printDinUse = true;
4349
4723
connect(printer, SIGNAL(doPreview()), this, SLOT(doPrintPreview()));
4350
4724
if (printer->exec())
4352
qDebug(QString("scribus.cpp: before print dialog color=%1 copies = %2").arg(doc->Print_Options.useColor).arg(doc->Print_Options.copies));
4353
4726
ReOrderText(doc, view);
4354
qApp->setOverrideCursor(QCursor(waitCursor), true);
4727
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
4355
4728
doc->Print_Options.pageNumbers.clear();
4356
if (printer->CurrentPage->isChecked())
4729
if (printer->doPrintCurrentPage())
4358
4730
doc->Print_Options.pageNumbers.push_back(doc->currentPage()->pageNr()+1);
4362
if (printer->RadioButton1->isChecked())
4733
if (printer->doPrintAll())
4363
4734
parsePagesString("*", &doc->Print_Options.pageNumbers, doc->DocPages.count());
4365
parsePagesString(printer->pageNr->text(), &doc->Print_Options.pageNumbers, doc->DocPages.count());
4736
parsePagesString(printer->getPageString(), &doc->Print_Options.pageNumbers, doc->DocPages.count());
4367
4738
PrinterUsed = true;
4369
SHORT shiftState = GetKeyState( VK_SHIFT );
4370
bool forceGDI = ( shiftState & 0x8000 ) ? true : false;
4371
if (doc->Print_Options.toFile == false)
4373
ScWinPrint winPrint;
4374
done = winPrint.print( doc, doc->Print_Options, printer->DevMode, forceGDI );
4377
done = doPrint(doc->Print_Options);
4379
done = doPrint(doc->Print_Options);
4739
done = doPrint(doc->Print_Options, printError);
4383
qApp->setOverrideCursor(QCursor(arrowCursor), true);
4384
QMessageBox::warning(this, CommonStrings::trWarning, tr("Printing failed!"), CommonStrings::tr_OK);
4742
QString message = tr("Printing failed!");
4743
if (!printError.isEmpty())
4744
message += QString("\n%1").arg(printError);
4745
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
4746
QMessageBox::warning(this, CommonStrings::trWarning, message, CommonStrings::tr_OK);
4387
4749
doc->Print_Options.firstUse = false;
4388
qApp->setOverrideCursor(QCursor(arrowCursor), true);
4750
getDefaultPrinter(PDef.Pname, PDef.Pname, PDef.Command);
4751
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
4390
4753
printDinUse = false;
4391
4754
disconnect(printer, SIGNAL(doPreview()), this, SLOT(doPrintPreview()));
4393
4756
mainWindowStatusLabel->setText( tr("Ready"));
4396
bool ScribusMainWindow::doPrint(PrintOptions &options)
4759
bool ScribusMainWindow::doPrint(PrintOptions &options, QString& error)
4399
QMap<QString, QMap<uint, FPointArray> > ReallyUsed;
4761
bool printDone = false;
4400
4762
QString filename(options.filename);
4402
doc->getUsedFonts(ReallyUsed);
4403
ColorList usedColors;
4404
doc->getUsedColors(usedColors);
4765
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
4766
if (!overwrite(this, filename))
4770
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
4405
4772
ScCore->fileWatcher->forceScan();
4406
4773
ScCore->fileWatcher->stop();
4407
PSLib *dd = new PSLib(options, true, prefsManager->appPrefs.AvailFonts, ReallyUsed, usedColors, false, options.useSpotColors);
4410
if (!options.toFile)
4411
filename = prefsManager->preferencesLocation()+"/tmp.ps";
4414
qApp->setOverrideCursor(QCursor(arrowCursor), true);
4415
if (!overwrite(this, filename))
4418
ScCore->fileWatcher->start();
4421
qApp->setOverrideCursor(QCursor(waitCursor), true);
4423
bool PSfile = dd->PS_set_file(filename);
4424
filename = QDir::convertSeparators(filename);
4427
// Write the PS to a file
4428
int psCreationRetVal=dd->CreatePS(doc, options);
4429
if (psCreationRetVal!=0)
4432
if (psCreationRetVal==2)
4437
if (options.PSLevel != 3)
4439
// use gs to convert our PS to a lower version
4442
opts.append( QString("-dDEVICEWIDTHPOINTS=%1").arg(tmp.setNum(doc->pageWidth)) );
4443
opts.append( QString("-dDEVICEHEIGHTPOINTS=%1").arg(tmp.setNum(doc->pageHeight)) );
4444
convertPS2PS(filename, filename + ".tmp", opts, options.PSLevel);
4445
moveFile( filename + ".tmp", filename );
4447
if (!options.toFile)
4449
// print and delete the PS file
4451
if (options.useAltPrintCommand)
4453
cmd = options.printerCommand + " "+filename;
4459
cmd = "lpr -P '" + options.printer + "'";
4460
if (options.copies > 1)
4461
cmd += " -#" + cc.setNum(options.copies);
4462
cmd += options.printerOptions;
4463
cmd += " "+filename;
4466
// Disabled that for now, as kprinter won't work otherwise
4467
// leaving that file around doesn't harm, as it will be overwritten the next time.
4468
// unlink(filename);
4774
ScPrintEngine* prnEngine = NULL;
4776
SHORT shiftState = GetKeyState( VK_SHIFT );
4777
bool forceGDI = ( shiftState & 0x8000 ) ? true : false;
4778
if (doc->Print_Options.toFile)
4779
prnEngine = dynamic_cast<ScPrintEngine*>(new ScPrintEngine_PS());
4782
ScPrintEngine_GDI* gdiEngine = new ScPrintEngine_GDI();
4783
gdiEngine->setForceGDI( forceGDI );
4784
prnEngine = dynamic_cast<ScPrintEngine*>(gdiEngine);
4787
prnEngine = dynamic_cast<ScPrintEngine*>(new ScPrintEngine_PS());
4791
printDone = prnEngine->print(*doc, options);
4793
error = prnEngine->errorMessage();
4797
error = tr( "Print engine initialization failed");
4476
4798
ScCore->fileWatcher->start();
4480
4802
void ScribusMainWindow::slotFileQuit()
4528
4851
StoryText itemText(doc);
4529
4852
itemText.setDefaultStyle(currItem->itemText.defaultStyle());
4530
4853
itemText.insert(0, currItem->itemText, true);
4532
BufferI = itemText.text(0, itemText.length());
4534
4855
std::ostringstream xmlString;
4535
4856
SaxXML xmlStream(xmlString);
4536
4857
xmlStream.beginDoc();
4537
4858
itemText.saxx(xmlStream, "SCRIBUSTEXT");
4538
4859
xmlStream.endDoc();
4539
4860
std::string xml(xmlString.str());
4540
Buffer2 = QString::fromUtf8(xml.c_str(), xml.length());
4542
/* PageItem *nextItem = currItem;
4543
while (nextItem != 0)
4545
if (nextItem->prevInChain() != 0)
4546
nextItem = nextItem->prevInChain();
4552
for (a = 0; a < nextItem->itemText.length(); ++a)
4554
if (nextItem->itemText.selected(a))
4556
if (nextItem->itemText.text(a) == QChar(13))
4558
Buffer2 += QChar(5);
4559
BufferI += QChar(10);
4561
else if (nextItem->itemText.text(a) == QChar(9))
4563
Buffer2 += QChar(4);
4564
BufferI += QChar(9);
4568
Buffer2 += nextItem->itemText.text(a);
4569
BufferI += nextItem->itemText.text(a);
4572
Buffer2 += nextItem->itemText.charStyle(a).font().scName()+"\t";
4573
Buffer2 += QString::number(nextItem->itemText.charStyle(a).fontSize())+"\t";
4574
Buffer2 += nextItem->itemText.charStyle(a).fillColor()+"\t";
4575
Buffer2 += QString::number(nextItem->itemText.charStyle(a).tracking())+"\t";
4576
Buffer2 += QString::number(nextItem->itemText.charStyle(a).fillShade())+'\t';
4577
Buffer2 += QString::number(nextItem->itemText.charStyle(a).effects())+'\t';
4578
Buffer2 += QString::number(findParagraphStyle(doc, nextItem->itemText.paragraphStyle(a)))+'\t';
4579
Buffer2 += nextItem->itemText.charStyle(a).strokeColor()+"\t";
4580
Buffer2 += QString::number(nextItem->itemText.charStyle(a).strokeShade())+'\t';
4581
Buffer2 += QString::number(nextItem->itemText.charStyle(a).scaleH())+"\t";
4582
Buffer2 += QString::number(nextItem->itemText.charStyle(a).scaleV())+'\t';
4583
Buffer2 += QString::number(nextItem->itemText.charStyle(a).baselineOffset())+'\t';
4584
Buffer2 += QString::number(nextItem->itemText.charStyle(a).shadowXOffset())+'\t';
4585
Buffer2 += QString::number(nextItem->itemText.charStyle(a).shadowYOffset())+'\t';
4586
Buffer2 += QString::number(nextItem->itemText.charStyle(a).outlineWidth())+'\t';
4587
Buffer2 += QString::number(nextItem->itemText.charStyle(a).underlineOffset())+'\t';
4588
Buffer2 += QString::number(nextItem->itemText.charStyle(a).underlineWidth())+'\t';
4589
Buffer2 += QString::number(nextItem->itemText.charStyle(a).strikethruOffset())+'\t';
4590
Buffer2 += QString::number(nextItem->itemText.charStyle(a).strikethruWidth())+'\n';
4593
dynamic_cast<PageItem_TextFrame*>(nextItem)->deleteSelectedTextFromFrame();
4594
nextItem = nextItem->nextInChain();
4862
ScTextMimeData* mimeData = new ScTextMimeData();
4863
mimeData->setScribusText (QByteArray(xml.c_str(), xml.length()));
4864
mimeData->setText( itemText.text(0, itemText.length()) ) ;
4865
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
4597
4867
dynamic_cast<PageItem_TextFrame*>(currItem)->deleteSelectedTextFromFrame();
4598
view->RefreshItem(currItem);
4602
4872
if (((currItem->isSingleSel) && (currItem->isGroupControl)) || ((currItem->isSingleSel) && (currItem->isTableItem)))
4606
ScriXmlDoc *ss = new ScriXmlDoc();
4607
Buffer2 = ss->WriteElem(doc, view, doc->m_Selection);
4609
4875
// new version:
4610
4876
std::ostringstream xmlString;
4611
4877
SaxXML xmlStream(xmlString);
4612
// qDebug(QString("call serializer: %1").arg((ulong) & (doc->m_Selection)));
4878
// qDebug() << QString("call serializer: %1").arg((ulong) & (doc->m_Selection));
4613
4879
Serializer::serializeObjects(*doc->m_Selection, xmlStream);
4614
4880
std::string xml(xmlString.str());
4615
4881
BufferI = QString::fromUtf8(xml.c_str(), xml.length());
4617
4883
if (prefsManager->appPrefs.doCopyToScrapbook)
4619
scrapbookPalette->ObjFromCopyAction(Buffer2);
4886
QString buffer = ss.WriteElem(doc, view, doc->m_Selection);
4887
scrapbookPalette->ObjFromCopyAction(buffer, currItem->itemName());
4620
4888
rebuildRecentPasteMenu();
4623
for (uint i=0; i < doc->m_Selection->count(); ++i)
4891
ScFragmentMimeData* mimeData = new ScFragmentMimeData();
4892
mimeData->setScribusFragment ( QByteArray(xml.c_str(), xml.length()) );
4893
mimeData->setText( QString::fromUtf8(xml.c_str(), xml.length()) );
4894
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
4896
for (int i=0; i < doc->m_Selection->count(); ++i)
4625
4898
PageItem* frame = doc->m_Selection->itemAt(i);
4626
4899
if (frame->asTextFrame() && frame->prevInChain() == NULL)
4627
4900
frame->clearContents();
4629
4902
doc->itemSelection_DeleteItem();
4634
ClipB->setText(BufferI);
4635
4905
scrActions["editPaste"]->setEnabled(true);
4636
4906
scrMenuMgr->setMenuEnabled("EditPasteRecent", scrapbookPalette->tempBView->objectMap.count() != 0);
4637
if (UndoManager::undoEnabled())
4638
undoManager->commit();
4907
if (activeTransaction)
4909
activeTransaction->commit();
4910
delete activeTransaction;
4911
activeTransaction = NULL;
4642
4916
void ScribusMainWindow::slotEditCopy()
4919
if (HaveDoc && doc->appMode == modeEditClip)
4920
view->requestMode(submodeEndNodeEdit);
4646
4921
QString BufferI = "";
4647
4922
if ((HaveDoc) && (doc->m_Selection->count() != 0))
4649
Buffer2 = "<SCRIBUSTEXT/>";
4650
4924
PageItem *currItem = doc->m_Selection->itemAt(0);
4651
4925
if ((doc->appMode == modeEdit) && (currItem->HasSel))
4653
4927
StoryText itemText(doc);
4654
4928
itemText.setDefaultStyle(currItem->itemText.defaultStyle());
4655
4929
itemText.insert(0, currItem->itemText, true);
4657
4931
BufferI = itemText.text(0, itemText.length());
4659
4933
std::ostringstream xmlString;
4660
4934
SaxXML xmlStream(xmlString);
4661
4935
xmlStream.beginDoc();
4662
4936
itemText.saxx(xmlStream, "SCRIBUSTEXT");
4663
4937
xmlStream.endDoc();
4664
4938
std::string xml(xmlString.str());
4665
Buffer2 = QString::fromUtf8(xml.c_str(), xml.length());
4668
/* PageItem *nextItem = currItem;
4669
while (nextItem != 0)
4671
if (nextItem->prevInChain() != 0)
4672
nextItem = nextItem->prevInChain();
4678
for (a = 0; a < nextItem->itemText.length(); ++a)
4680
if (nextItem->itemText.selected(a))
4682
if (nextItem->itemText.text(a) == SpecialChars::PARSEP)
4684
Buffer2 += QChar(5);
4685
BufferI += QChar(10);
4687
else if (nextItem->itemText.text(a) == SpecialChars::TAB)
4689
Buffer2 += QChar(4);
4690
BufferI += QChar(9);
4694
Buffer2 += nextItem->itemText.text(a);
4695
BufferI += nextItem->itemText.text(a);
4698
Buffer2 += nextItem->itemText.charStyle(a).font().scName()+"\t";
4699
Buffer2 += QString::number(nextItem->itemText.charStyle(a).fontSize())+"\t";
4700
Buffer2 += nextItem->itemText.charStyle(a).fillColor()+"\t";
4701
Buffer2 += QString::number(nextItem->itemText.charStyle(a).tracking())+"\t";
4702
Buffer2 += QString::number(nextItem->itemText.charStyle(a).fillShade())+"\t";
4703
Buffer2 += QString::number(nextItem->itemText.charStyle(a).effects())+"\t";
4704
Buffer2 += QString::number(findParagraphStyle(doc, nextItem->itemText.paragraphStyle(a)))+"\t";
4705
Buffer2 += nextItem->itemText.charStyle(a).strokeColor()+"\t";
4706
Buffer2 += QString::number(nextItem->itemText.charStyle(a).strokeShade())+"\t";
4707
Buffer2 += QString::number(nextItem->itemText.charStyle(a).scaleH())+"\t";
4708
Buffer2 += QString::number(nextItem->itemText.charStyle(a).scaleV())+'\t';
4709
Buffer2 += QString::number(nextItem->itemText.charStyle(a).baselineOffset())+'\t';
4710
Buffer2 += QString::number(nextItem->itemText.charStyle(a).shadowXOffset())+'\t';
4711
Buffer2 += QString::number(nextItem->itemText.charStyle(a).shadowYOffset())+'\t';
4712
Buffer2 += QString::number(nextItem->itemText.charStyle(a).outlineWidth())+'\t';
4713
Buffer2 += QString::number(nextItem->itemText.charStyle(a).underlineOffset())+'\t';
4714
Buffer2 += QString::number(nextItem->itemText.charStyle(a).underlineWidth())+'\t';
4715
Buffer2 += QString::number(nextItem->itemText.charStyle(a).strikethruOffset())+'\t';
4716
Buffer2 += QString::number(nextItem->itemText.charStyle(a).strikethruWidth())+'\n';
4719
nextItem = nextItem->nextInChain();
4940
ScTextMimeData* mimeData = new ScTextMimeData();
4941
mimeData->setScribusText( QByteArray(xml.c_str(), xml.length()) );
4942
mimeData->setText( itemText.text(0, itemText.length()) );
4943
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
4725
4947
if (((currItem->isSingleSel) && (currItem->isGroupControl)) || ((currItem->isSingleSel) && (currItem->isTableItem)))
4729
ScriXmlDoc *ss = new ScriXmlDoc();
4730
Buffer2 = ss->WriteElem(doc, view, doc->m_Selection);
4732
4950
// new version:
4733
4951
std::ostringstream xmlString;
4734
4952
SaxXML xmlStream(xmlString);
4735
4953
Serializer::serializeObjects(*doc->m_Selection, xmlStream);
4736
4954
std::string xml(xmlString.str());
4737
BufferI = QString::fromUtf8(xml.c_str(), xml.length());
4739
4956
#ifdef DESAXE_DEBUG
4741
4958
SaxXML tmpfile1("tmp-scribus1.xml", true);
4782
5005
currItem->CPos = 0;
4783
5006
if (currItem->CPos > currItem->itemText.length())
4784
5007
currItem->CPos = currItem->itemText.length();
4786
if (hasXMLRootElem(Buffer2, "<SCRIBUSTEXT"))
5009
if (ScMimeData::clipboardHasScribusText())
4788
5011
Serializer dig(*doc);
4789
5012
dig.store<ScribusDoc>("<scribusdoc>", doc);
4790
5013
StoryText::desaxeRules("/", dig, "SCRIBUSTEXT");
4791
5014
dig.addRule("/SCRIBUSTEXT", desaxe::Result<StoryText>());
4793
QCString xml( Buffer2.utf8() );
5016
QByteArray xml = ScMimeData::clipboardScribusText();
4794
5017
dig.parseMemory(xml, xml.length());
4796
5019
StoryText* story = dig.result<StoryText>();
4798
5021
currItem->itemText.insert(currItem->CPos, *story);
4799
5022
currItem->CPos += story->length();
4803
/* QString Buf = Buffer2.mid(13);
4804
QTextStream t(&Buf, IO_ReadOnly);
4810
QStringList::Iterator it;
4811
wt = QStringList::split("\t", cc);
4816
ch = SpecialChars::PARSEP;
4818
ch = SpecialChars::TAB;
4819
Don't copy inline frames for now, as this is a very complicated thing.
4820
We need to figure out a good way to copy inline frames, this must
4821
be able to preserve them across documents. No idea how to solve
4823
if (ch == SpecialChars::OBJECT)
4826
nstyle.setFont((*doc->AllFonts)[*it]);
4828
nstyle.setFontSize((*it).toInt());
4830
nstyle.setFillColor(*it);
4832
nstyle.setTracking((*it).toInt());
4834
nstyle.setFillShade((*it).toInt());
4836
nstyle.setFeatures(static_cast<StyleFlag>((*it).toInt()).featureList());
4838
int cab = (*it).toInt();
4841
nstyle.setStrokeColor(CommonStrings::None);
4843
nstyle.setStrokeColor(*it);
4846
nstyle.setStrokeShade(100);
4848
nstyle.setStrokeShade((*it).toInt());
4851
nstyle.setScaleH(1000);
4853
nstyle.setScaleH((*it).toInt());
4856
nstyle.setScaleV(1000);
4858
nstyle.setScaleV(QMIN(QMAX((*it).toInt(), 100), 4000));
4860
nstyle.setBaselineOffset(it == NULL ? 0 : (*it).toInt());
4862
nstyle.setShadowXOffset(it == NULL ? 50 : (*it).toInt());
4864
nstyle.setShadowYOffset(it == NULL ? -50 : (*it).toInt());
4866
nstyle.setOutlineWidth(it == NULL ? 10 : (*it).toInt());
4868
nstyle.setUnderlineOffset(it == NULL ? -1 : (*it).toInt());
4870
nstyle.setUnderlineWidth(it == NULL ? -1 : (*it).toInt());
4872
nstyle.setStrikethruOffset(it == NULL ? -1 : (*it).toInt());
4874
nstyle.setStrikethruWidth(it == NULL ? -1 : (*it).toInt());
4875
currItem->itemText.insertChars(currItem->CPos, ch);
4876
if (ch == SpecialChars::PARSEP) {
4877
currItem->itemText.applyStyle(currItem->CPos, doc->paragraphStyles()[cab]);
4880
currItem->itemText.applyCharStyle(currItem->CPos, 1, nstyle);
4882
currItem->CPos += 1;
4886
else if (hasXMLRootElem(Buffer2, "<SCRIBUSELEM") || hasXMLRootElem(Buffer2, "<SCRIBUSFRAGMENT"))
5026
else if (ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment())
4888
5028
bool savedAlignGrid = doc->useRaster;
4889
5029
bool savedAlignGuides = doc->SnapGuides;
4890
uint ac = doc->Items->count();
5030
int ac = doc->Items->count();
4891
5031
bool isGroup = false;
4892
5032
double gx, gy, gh, gw;
4893
5033
FPoint minSize = doc->minCanvasCoordinate;
4894
5034
FPoint maxSize = doc->maxCanvasCoordinate;
4895
5035
doc->useRaster = false;
4896
5036
doc->SnapGuides = false;
4897
if (hasXMLRootElem(Buffer2, "<SCRIBUSELEM"))
4898
slotElemRead(Buffer2, 0, 0, false, true, doc, view);
4900
Serializer(*doc).deserializeObjects(Buffer2.utf8());
5037
// HACK #6541 : undo does not handle text modification => do not record embedded item creation
5038
// if embedded item is deleted, undo system will not be aware of its deletion => crash - JG
5039
undoManager->setUndoEnabled(false);
5041
if (ScMimeData::clipboardHasScribusElem())
5043
QString buffer = ScMimeData::clipboardScribusElem();
5044
slotElemRead(buffer, 0, 0, false, true, doc, view);
5048
QByteArray fragment = ScMimeData::clipboardScribusFragment();
5049
Serializer(*doc).deserializeObjects(fragment);
4902
5052
// update style lists:
4903
5053
styleManager->setDoc(doc);
4904
5054
propertiesPalette->unsetDoc();
4905
5055
propertiesPalette->setDoc(doc);
4907
5057
doc->useRaster = savedAlignGrid;
4908
5058
doc->SnapGuides = savedAlignGuides;
4909
5059
//int tempList=doc->m_Selection->backupToTempList(0);
5024
5185
view->DrawNew();
5026
if (UndoManager::undoEnabled())
5027
undoManager->commit();
5187
if (activeTransaction)
5189
activeTransaction->commit();
5190
delete activeTransaction;
5191
activeTransaction = NULL;
5028
5193
slotDocCh(false);
5032
5197
//CB-->Doc ?????
5033
void ScribusMainWindow::SelectAll()
5198
void ScribusMainWindow::SelectAllOnLayer()
5201
doc->getUsedColors(UsedC);
5202
selectDialog *dia = new selectDialog(this, UsedC, doc->unitIndex());
5207
uint docItemsCount = doc->Items->count();
5208
int docCurrentPage = doc->currentPageNumber();
5209
doc->m_Selection->delaySignalsOn();
5210
int range = dia->getSelectionRange();
5211
for (uint a = 0; a < docItemsCount; ++a)
5213
currItem = doc->Items->at(a);
5214
if ((currItem->LayerNr == doc->activeLayer()) && (!doc->layerLocked(currItem->LayerNr)))
5216
if ((range == 0) && (currItem->OwnPage != docCurrentPage))
5218
if ((range == 2) && (currItem->OwnPage != -1))
5220
if (dia->useAttributes())
5222
bool useType = false;
5223
bool useFill = false;
5224
bool useLine = false;
5225
bool useLWidth = false;
5226
bool usePrint = false;
5227
bool useLocked = false;
5228
bool useResize = false;
5229
dia->getUsedAttributes(useType, useFill, useLine, useLWidth, usePrint, useLocked, useResize);
5233
double LWidth = 0.0;
5235
bool Locked = false;
5236
bool Resize = false;
5237
dia->getUsedAttributesValues(Type, Fill, Line, LWidth, Print, Locked, Resize);
5238
LWidth = LWidth / doc->unitRatio();
5239
if ((useType) && (Type != currItem->realItemType()))
5241
if ((useFill) && ((Fill != currItem->fillColor()) || (currItem->GrType != 0)))
5243
if ((useLine) && (Line != currItem->lineColor()))
5245
if ((useLWidth) && ((LWidth != currItem->lineWidth()) || (currItem->lineColor() == CommonStrings::None)))
5247
if ((usePrint) && (Print != currItem->printEnabled()))
5249
if ((useLocked) && (Locked != currItem->locked()))
5251
if ((useResize) && (Resize != currItem->sizeLocked()))
5253
doc->m_Selection->addItem(currItem);
5256
doc->m_Selection->addItem(currItem);
5259
doc->m_Selection->delaySignalsOff();
5260
int docSelectionCount = doc->m_Selection->count();
5261
if (docSelectionCount > 1)
5264
doc->m_Selection->setGroupRect();
5265
doc->m_Selection->getGroupRect(&x, &y, &w, &h);
5266
propertiesPalette->setXY(x, y);
5267
propertiesPalette->setBH(w, h);
5269
if (docSelectionCount > 0)
5271
currItem = doc->m_Selection->itemAt(0);
5272
HaveNewSel(currItem->itemType());
5279
void ScribusMainWindow::SelectAll(bool docWideSelect)
5035
5281
if (doc->appMode == modeEdit)
5037
5283
PageItem *currItem = doc->m_Selection->itemAt(0);
5038
5284
PageItem *nextItem = currItem;
5285
nextItem->itemText.selectAll();
5039
5286
while (nextItem != 0)
5041
5288
if (nextItem->prevInChain() != 0)
5895
6206
// undoManager->setUndoEnabled(true);
6209
/** This is the safest method to return to modeNormal
5898
6211
void ScribusMainWindow::slotSelect()
5900
setAppMode(modeNormal);
6214
view->requestMode(modeNormal);
6216
setAppMode(modeNormal);
5903
6219
void ScribusMainWindow::setAppModeByToggle(bool isOn, int newMode)
5907
setAppMode(newMode);
6223
view->requestMode(newMode);
5909
setAppMode(modeNormal);
5912
6228
void ScribusMainWindow::setAppMode(int mode)
6230
assert(mode < submodeFirstSubmode);
5914
6232
//disconnect the tools actions so we dont fire them off
5915
6233
actionManager->disconnectModeActions();
5916
6234
//set the actions state based on incoming mode
5917
scrActions["toolsSelect"]->setOn(mode==modeNormal);
5918
scrActions["toolsInsertTextFrame"]->setOn(mode==modeDrawText);
5919
scrActions["toolsInsertImageFrame"]->setOn(mode==modeDrawPicture);
5920
scrActions["toolsInsertTableFrame"]->setOn(mode==modeDrawTable);
5921
scrActions["toolsInsertShape"]->setOn(mode==modeDrawShapes);
5922
scrActions["toolsInsertPolygon"]->setOn(mode==modeDrawRegularPolygon);
5923
scrActions["toolsInsertLine"]->setOn(mode==modeDrawLine);
5924
scrActions["toolsInsertBezier"]->setOn(mode==modeDrawBezierLine);
5925
scrActions["toolsInsertFreehandLine"]->setOn(mode==modeDrawFreehandLine);
5926
scrActions["toolsRotate"]->setOn(mode==modeRotation);
5927
scrActions["toolsZoom"]->setOn(mode==modeMagnifier);
5928
scrActions["toolsEditContents"]->setOn(mode==modeEdit);
5929
scrActions["toolsEditWithStoryEditor"]->setOn(mode==modeStoryEditor);
5930
scrActions["toolsLinkTextFrame"]->setOn(mode==modeLinkFrames);
5931
scrActions["toolsUnlinkTextFrame"]->setOn(mode==modeUnlinkFrames);
5932
scrActions["toolsEyeDropper"]->setOn(mode==modeEyeDropper);
5933
scrActions["toolsCopyProperties"]->setOn(mode==modeCopyProperties);
5934
scrActions["toolsPDFPushButton"]->setOn(mode==modeInsertPDFButton);
5935
scrActions["toolsPDFTextField"]->setOn(mode==modeInsertPDFTextfield);
5936
scrActions["toolsPDFCheckBox"]->setOn(mode==modeInsertPDFCheckbox);
5937
scrActions["toolsPDFComboBox"]->setOn(mode==modeInsertPDFCombobox);
5938
scrActions["toolsPDFListBox"]->setOn(mode==modeInsertPDFListbox);
5939
scrActions["toolsPDFAnnotText"]->setOn(mode==modeInsertPDFTextAnnotation);
5940
scrActions["toolsPDFAnnotLink"]->setOn(mode==modeInsertPDFLinkAnnotation);
6235
scrActions["toolsSelect"]->setChecked(mode==modeNormal);
6236
scrActions["toolsInsertTextFrame"]->setChecked(mode==modeDrawText);
6237
scrActions["toolsInsertImageFrame"]->setChecked(mode==modeDrawImage);
6238
scrActions["toolsInsertTableFrame"]->setChecked(mode==modeDrawTable);
6239
scrActions["toolsInsertShape"]->setChecked(mode==modeDrawShapes);
6240
scrActions["toolsInsertPolygon"]->setChecked(mode==modeDrawRegularPolygon);
6241
scrActions["toolsInsertLine"]->setChecked(mode==modeDrawLine);
6242
scrActions["toolsInsertBezier"]->setChecked(mode==modeDrawBezierLine);
6243
scrActions["toolsInsertFreehandLine"]->setChecked(mode==modeDrawFreehandLine);
6244
scrActions["toolsInsertRenderFrame"]->setChecked(mode==modeDrawLatex);
6245
scrActions["toolsRotate"]->setChecked(mode==modeRotation);
6246
scrActions["toolsZoom"]->setChecked(mode==modeMagnifier);
6247
scrActions["toolsEditContents"]->setChecked(mode==modeEdit);
6248
scrActions["toolsEditWithStoryEditor"]->setChecked(mode==modeStoryEditor);
6249
scrActions["toolsLinkTextFrame"]->setChecked(mode==modeLinkFrames);
6250
scrActions["toolsUnlinkTextFrame"]->setChecked(mode==modeUnlinkFrames);
6251
scrActions["toolsEyeDropper"]->setChecked(mode==modeEyeDropper);
6252
scrActions["toolsMeasurements"]->setChecked(mode==modeMeasurementTool);
6253
scrActions["toolsCopyProperties"]->setChecked(mode==modeCopyProperties);
6254
scrActions["toolsPDFPushButton"]->setChecked(mode==modeInsertPDFButton);
6255
scrActions["toolsPDFTextField"]->setChecked(mode==modeInsertPDFTextfield);
6256
scrActions["toolsPDFCheckBox"]->setChecked(mode==modeInsertPDFCheckbox);
6257
scrActions["toolsPDFComboBox"]->setChecked(mode==modeInsertPDFCombobox);
6258
scrActions["toolsPDFListBox"]->setChecked(mode==modeInsertPDFListbox);
6259
scrActions["toolsPDFAnnotText"]->setChecked(mode==modeInsertPDFTextAnnotation);
6260
scrActions["toolsPDFAnnotLink"]->setChecked(mode==modeInsertPDFLinkAnnotation);
6019
6340
scrActions["editClearContents"]->setEnabled(currItem->HasSel);
6020
6341
scrActions["editSearchReplace"]->setEnabled(true);
6022
view->RefreshItem(currItem);
6343
// Why the hell do you want to update the item here? - pm
6344
// currItem->update();
6025
6347
int docSelectionCount=doc->m_Selection->count();
6026
6348
if (mode == modeDrawBezierLine)
6028
if (docSelectionCount != 0)
6350
if ((docSelectionCount != 0) && (!prefsManager->appPrefs.stickyTools))
6029
6351
view->Deselect(true);
6030
6352
view->FirstPoly = true;
6032
6354
if (mode == modeEditGradientVectors)
6033
6355
propertiesPalette->setGradientEditMode(true);
6034
if (mode == modeMeasurementTool)
6036
measurementPalette->show();
6037
connect(view, SIGNAL(MVals(double, double, double, double, double, double, int)), measurementPalette, SLOT(setValues(double, double, double, double, double, double, int )));
6356
// if (mode == modeMeasurementTool)
6358
// measurementPalette->show();
6359
// connect(view, SIGNAL(MVals(double, double, double, double, double, double, int)), measurementPalette, SLOT(setValues(double, double, double, double, double, double, int )));
6041
6363
case modeDrawShapes:
6042
6364
if (docSelectionCount!=0)
6043
6365
view->Deselect(true);
6044
qApp->setOverrideCursor(QCursor(loadIcon("DrawFrame.xpm")), true);
6046
case modeDrawPicture:
6047
if (docSelectionCount!=0)
6048
view->Deselect(true);
6049
qApp->setOverrideCursor(QCursor(loadIcon("DrawImageFrame.xpm")), true);
6366
qApp->changeOverrideCursor(QCursor(loadIcon("DrawFrame.xpm")));
6369
if (docSelectionCount!=0)
6370
view->Deselect(true);
6371
qApp->changeOverrideCursor(QCursor(loadIcon("DrawImageFrame.xpm")));
6374
if (docSelectionCount!=0)
6375
view->Deselect(true);
6376
qApp->changeOverrideCursor(QCursor(loadIcon("DrawLatexFrame.xpm")));
6051
6378
case modeDrawText:
6052
6379
if (docSelectionCount!=0)
6053
6380
view->Deselect(true);
6054
qApp->setOverrideCursor(QCursor(loadIcon("DrawTextFrame.xpm")), true);
6381
qApp->changeOverrideCursor(QCursor(loadIcon("DrawTextFrame.xpm")));
6056
6383
case modeDrawTable:
6057
6384
if (docSelectionCount!=0)
6058
6385
view->Deselect(true);
6059
qApp->setOverrideCursor(QCursor(loadIcon("DrawTable.xpm")), true);
6386
qApp->changeOverrideCursor(QCursor(loadIcon("DrawTable.xpm")));
6061
6388
case modeDrawRegularPolygon:
6062
6389
if (docSelectionCount!=0)
6063
6390
view->Deselect(true);
6064
qApp->setOverrideCursor(QCursor(loadIcon("DrawPolylineFrame.xpm")), true);
6391
qApp->changeOverrideCursor(QCursor(loadIcon("DrawPolylineFrame.xpm")));
6066
6393
case modeMagnifier:
6067
6394
if (docSelectionCount!=0)
6068
6395
view->Deselect(true);
6069
qApp->setOverrideCursor(QCursor(loadIcon("LupeZ.xpm")), true);
6396
view->Magnify = true;
6397
qApp->changeOverrideCursor(QCursor(loadIcon("LupeZ.xpm")));
6071
6399
case modePanning:
6072
qApp->setOverrideCursor(QCursor(loadIcon("HandC.xpm")), true);
6400
qApp->changeOverrideCursor(QCursor(loadIcon("HandC.xpm")));
6074
6402
case modeDrawLine:
6075
6403
case modeDrawBezierLine:
6076
qApp->setOverrideCursor(QCursor(crossCursor), true);
6404
qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
6078
6406
case modeDrawFreehandLine:
6079
qApp->setOverrideCursor(QCursor(loadIcon("DrawFreeLine.png"), 0, 32), true);
6407
qApp->changeOverrideCursor(QCursor(loadIcon("DrawFreeLine.png"), 0, 32));
6081
6409
case modeEyeDropper:
6082
qApp->setOverrideCursor(QCursor(loadIcon("colorpickercursor.png"), 0, 32), true);
6410
qApp->changeOverrideCursor(QCursor(loadIcon("colorpickercursor.png"), 0, 32));
6084
6412
case modeInsertPDFButton:
6085
6413
case modeInsertPDFTextfield:
6156
scrActions["typeEffectNormal"]->setOn(true);
6157
scrActions["typeEffectUnderline"]->setOn(false);
6158
scrActions["typeEffectUnderlineWords"]->setOn(false);
6159
scrActions["typeEffectStrikeThrough"]->setOn(false);
6160
scrActions["typeEffectSmallCaps"]->setOn(false);
6161
scrActions["typeEffectAllCaps"]->setOn(false);
6162
scrActions["typeEffectSuperscript"]->setOn(false);
6163
scrActions["typeEffectSubscript"]->setOn(false);
6164
scrActions["typeEffectOutline"]->setOn(false);
6165
scrActions["typeEffectShadow"]->setOn(false);
6514
scrActions["typeEffectNormal"]->setChecked(true);
6515
scrActions["typeEffectUnderline"]->setChecked(false);
6516
scrActions["typeEffectUnderlineWords"]->setChecked(false);
6517
scrActions["typeEffectStrikeThrough"]->setChecked(false);
6518
scrActions["typeEffectSmallCaps"]->setChecked(false);
6519
scrActions["typeEffectAllCaps"]->setChecked(false);
6520
scrActions["typeEffectSuperscript"]->setChecked(false);
6521
scrActions["typeEffectSubscript"]->setChecked(false);
6522
scrActions["typeEffectOutline"]->setChecked(false);
6523
scrActions["typeEffectShadow"]->setChecked(false);
6169
scrActions["typeEffectNormal"]->setOn(false);
6527
scrActions["typeEffectNormal"]->setChecked(false);
6171
scrActions["typeEffectSubscript"]->setOn(false);
6529
scrActions["typeEffectSubscript"]->setChecked(false);
6173
scrActions["typeEffectSuperscript"]->setOn(false);
6531
scrActions["typeEffectSuperscript"]->setChecked(false);
6175
scrActions["typeEffectAllCaps"]->setOn(false);
6533
scrActions["typeEffectAllCaps"]->setChecked(false);
6177
scrActions["typeEffectSmallCaps"]->setOn(false);
6535
scrActions["typeEffectSmallCaps"]->setChecked(false);
6179
scrActions["typeEffectUnderline"]->setOn(false);
6537
scrActions["typeEffectUnderline"]->setChecked(false);
6181
scrActions["typeEffectUnderlineWords"]->setOn(false);
6182
if (scrActions["typeEffectUnderline"]->isOn())
6539
scrActions["typeEffectUnderlineWords"]->setChecked(false);
6540
if (scrActions["typeEffectUnderline"]->isChecked())
6184
if (scrActions["typeEffectUnderlineWords"]->isOn())
6542
if (scrActions["typeEffectUnderlineWords"]->isChecked())
6186
if (scrActions["typeEffectShadow"]->isOn())
6544
if (scrActions["typeEffectShadow"]->isChecked())
6188
if (scrActions["typeEffectStrikeThrough"]->isOn())
6546
if (scrActions["typeEffectStrikeThrough"]->isChecked())
6190
if (scrActions["typeEffectAllCaps"]->isOn())
6548
if (scrActions["typeEffectAllCaps"]->isChecked())
6192
if (scrActions["typeEffectSmallCaps"]->isOn())
6550
if (scrActions["typeEffectSmallCaps"]->isChecked())
6194
if (scrActions["typeEffectSuperscript"]->isOn())
6552
if (scrActions["typeEffectSuperscript"]->isChecked())
6196
if (scrActions["typeEffectSubscript"]->isOn())
6554
if (scrActions["typeEffectSubscript"]->isChecked())
6198
if (scrActions["typeEffectOutline"]->isOn())
6556
if (scrActions["typeEffectOutline"]->isChecked())
6201
6559
setItemHoch(b);
6231
6589
//CB-->Doc partly
6232
6590
void ScribusMainWindow::DeletePage2(int pg)
6592
if (HaveDoc && doc->appMode == modeEditClip)
6593
view->requestMode(submodeEndNodeEdit);
6594
view->Deselect(true);
6236
6595
if (doc->Pages->count() == 1)
6238
uint oldPg = doc->currentPageNumber();
6239
guidePalette->setDoc(NULL);
6240
if (UndoManager::undoEnabled())
6241
undoManager->beginTransaction(doc->DocName, Um::IDocument, Um::DeletePage, "", Um::IDelete);
6242
/* if (!doc->masterPageMode)
6243
disconnect(doc->currentPage, SIGNAL(DelObj(uint, uint)), outlinePalette, SLOT(slotRemoveElement(uint, uint))); */
6244
doc->m_Selection->clear();
6245
for (uint d = 0; d < doc->Items->count(); ++d)
6247
ite = doc->Items->at(d);
6248
if (ite->OwnPage == pg)
6250
ite->setLocked(false);
6251
ite->isSingleSel = false;
6252
if (ite->isBookmark)
6254
ite->isBookmark = false;
6255
doc->m_Selection->addItem(ite);
6258
if (doc->m_Selection->count() != 0)
6259
doc->itemSelection_DeleteItem();
6260
Page *page = doc->Pages->at(pg); // need to remove guides too to get their undo/redo actions working
6261
page->guides.clearHorizontals(GuideManagerCore::Standard);
6262
page->guides.clearHorizontals(GuideManagerCore::Auto);
6263
page->guides.clearVerticals(GuideManagerCore::Standard);
6264
page->guides.clearVerticals(GuideManagerCore::Auto);
6265
if (UndoManager::undoEnabled())
6267
SimpleState *ss = new SimpleState(Um::DeletePage, "", Um::ICreate);
6268
ss->set("DELETE_PAGE", "delete_page");
6269
ss->set("PAGENR", pg + 1);
6270
ss->set("MASTERPAGE", doc->Pages->at(pg)->MPageNam);
6271
// replace the deleted page in the undostack by a dummy object that will
6272
// replaced with the "undone" page if user choose to undo the action
6273
DummyUndoObject *duo = new DummyUndoObject();
6274
uint id = static_cast<uint>(duo->getUId());
6275
undoManager->replaceObject(doc->Pages->at(pg)->getUId(), duo);
6276
ss->set("DUMMY_ID", id);
6277
undoManager->action(this, ss);
6279
if (doc->masterPageMode())
6280
doc->deleteMasterPage(pg);
6282
doc->deletePage(pg);
6283
disconnect(view->pageSelector, SIGNAL(GotoPage(int)), view, SLOT(GotoPa(int)));
6284
view->pageSelector->setMaxValue(doc->Pages->count());
6285
view->pageSelector->GotoPg(0);
6286
connect(view->pageSelector, SIGNAL(GotoPage(int)), view, SLOT(GotoPa(int)));
6287
undoManager->setUndoEnabled(false); // ugly hack to prevent object moving when undoing page deletion
6288
view->reformPages();
6289
undoManager->setUndoEnabled(true); // ugly hack continues
6290
view->GotoPage(QMIN(doc->Pages->count()-1, oldPg));
6292
if (outlinePalette->isVisible())
6293
outlinePalette->BuildTree();
6294
//CB done by doc::reformpages
6296
pagePalette->RebuildPage();
6297
if (UndoManager::undoEnabled())
6298
undoManager->commit();
6597
DeletePage(pg+1, pg+1);
6301
6600
void ScribusMainWindow::DeletePage()
6602
if (HaveDoc && doc->appMode == modeEditClip)
6603
view->requestMode(submodeEndNodeEdit);
6304
6604
view->Deselect(true);
6305
6605
DelPages *dia = new DelPages(this, doc->currentPage()->pageNr()+1, doc->Pages->count());
6306
6606
if (dia->exec())
7043
7308
doc->replaceNamedResources(colorrsc);
7044
7309
// Temporary code until LineStyle is effectively used
7045
7310
doc->replaceLineStyleColors(dia->replaceMap);
7047
// ers == colorrsc.fonts()
7048
QMap<QString,QString>::Iterator it;
7049
for (it = ers.begin(); it != ers.end(); ++it)
7051
if (it.key() == doc->currentStyle.charStyle().fillColor())
7052
doc->currentStyle.charStyle().setFillColor(it.data());
7053
if (it.key() == doc->currentStyle.charStyle().strokeColor())
7054
doc->currentStyle.charStyle().setStrokeColor(it.data());
7055
for (c=0; c<doc->DocItems.count(); ++c)
7057
ite = doc->DocItems.at(c);
7058
if ((ite->asTextFrame()) || (ite->asPathText()))
7060
CharStyle lastStyle;
7061
int lastStyleStart = 0;
7062
for (d=0; d<ite->itemText.length(); ++d)
7065
if (it.key() == ite->itemText.charStyle(d).fillColor())
7066
newStyle.setFillColor(it.data());
7067
if (it.key() == ite->itemText.charStyle(d).strokeColor())
7068
newStyle.setStrokeColor(it.data());
7069
if (newStyle != lastStyle) {
7070
ite->itemText.applyCharStyle(lastStyleStart, d-lastStyleStart, lastStyle);
7071
lastStyle = newStyle;
7075
ite->itemText.applyCharStyle(lastStyleStart, ite->itemText.length()-lastStyleStart, lastStyle);
7077
if (it.key() == ite->fillColor())
7078
ite->setFillColor(it.data());
7079
if (it.key() == ite->lineColor())
7080
ite->setLineColor(it.data());
7081
QPtrVector<VColorStop> cstops = ite->fill_gradient.colorStops();
7082
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
7084
if (it.key() == cstops.at(cst)->name)
7085
cstops.at(cst)->name = it.data();
7089
for (it = ers.begin(); it != ers.end(); ++it)
7091
for (c=0; c<doc->FrameItems.count(); ++c)
7093
ite = doc->FrameItems.at(c);
7094
if ((ite->asTextFrame()) || (ite->asPathText()))
7096
CharStyle lastStyle;
7097
int lastStyleStart = 0;
7098
for (d=0; d<ite->itemText.length(); ++d)
7101
if (it.key() == ite->itemText.charStyle(d).fillColor())
7102
newStyle.setFillColor(it.data());
7103
if (it.key() == ite->itemText.charStyle(d).strokeColor())
7104
newStyle.setStrokeColor(it.data());
7105
if (newStyle != lastStyle) {
7106
ite->itemText.applyCharStyle(lastStyleStart, d-lastStyleStart, lastStyle);
7107
lastStyle = newStyle;
7110
ite->itemText.applyCharStyle(lastStyleStart, ite->itemText.length()-lastStyleStart, lastStyle);
7113
if (it.key() == ite->fillColor())
7114
ite->setFillColor(it.data());
7115
if (it.key() == ite->lineColor())
7116
ite->setLineColor(it.data());
7117
QPtrVector<VColorStop> cstops = ite->fill_gradient.colorStops();
7118
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
7120
if (it.key() == cstops.at(cst)->name)
7121
cstops.at(cst)->name = it.data();
7125
for (it = ers.begin(); it != ers.end(); ++it)
7127
for (c=0; c<doc->MasterItems.count(); ++c)
7129
ite = doc->MasterItems.at(c);
7130
if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText))
7132
CharStyle lastStyle;
7133
int lastStyleStart = 0;
7134
for (d=0; d<ite->itemText.length(); ++d)
7137
if (it.key() == ite->itemText.charStyle(d).fillColor())
7138
newStyle.setFillColor(it.data());
7139
if (it.key() == ite->itemText.charStyle(d).strokeColor())
7140
newStyle.setStrokeColor(it.data());
7141
if (newStyle != lastStyle) {
7142
ite->itemText.applyCharStyle(lastStyleStart, d-lastStyleStart, lastStyle);
7143
lastStyle = newStyle;
7147
ite->itemText.applyCharStyle(lastStyleStart, ite->itemText.length()-lastStyleStart, lastStyle);
7149
if (it.key() == ite->fillColor())
7150
ite->setFillColor(it.data());
7151
if (it.key() == ite->lineColor())
7152
ite->setLineColor(it.data());
7153
QPtrVector<VColorStop> cstops = ite->fill_gradient.colorStops();
7154
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
7156
if (it.key() == cstops.at(cst)->name)
7157
cstops.at(cst)->name = it.data();
7161
for (it = ers.begin(); it != ers.end(); ++it)
7163
QStringList patterns = doc->docPatterns.keys();
7164
for (uint c = 0; c < patterns.count(); ++c)
7166
ScPattern pa = doc->docPatterns[patterns[c]];
7167
for (uint o = 0; o < pa.items.count(); o++)
7169
PageItem *ite = pa.items.at(o);
7170
if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText))
7172
CharStyle lastStyle;
7173
int lastStyleStart = 0;
7174
for (d=0; d<ite->itemText.length(); ++d)
7177
if (it.key() == ite->itemText.charStyle(d).fillColor())
7178
newStyle.setFillColor(it.data());
7179
if (it.key() == ite->itemText.charStyle(d).strokeColor())
7180
newStyle.setStrokeColor(it.data());
7181
if (newStyle != lastStyle) {
7182
ite->itemText.applyCharStyle(lastStyleStart, d-lastStyleStart, lastStyle);
7183
lastStyle = newStyle;
7187
ite->itemText.applyCharStyle(lastStyleStart, ite->itemText.length()-lastStyleStart, lastStyle);
7189
if (it.key() == ite->fillColor())
7190
ite->setFillColor(it.data());
7191
if (it.key() == ite->lineColor())
7192
ite->setLineColor(it.data());
7193
QPtrVector<VColorStop> cstops = ite->fill_gradient.colorStops();
7194
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
7196
if (it.key() == cstops.at(cst)->name)
7198
cstops.at(cst)->name = it.data();
7206
7312
doc->recalculateColors();
7207
7313
doc->recalcPicturesRes();
7208
7314
propertiesPalette->updateColorList();
7315
//3102: update the line styles in PP too
7316
propertiesPalette->SetLineFormats(doc);
7209
7317
styleManager->updateColorList();
7211
7318
if (doc->m_Selection->count() != 0)
7212
7319
doc->m_Selection->itemAt(0)->emitAllToGUI();
7213
7320
view->DrawNew();
8151
if (doc->m_Selection->count() < 2)
8305
Selection* itemSelection = doc->m_Selection;
8306
if (itemSelection->count() < 2)
8156
QString tooltip = Um::ItemsInvolved + "\n";
8157
uint selectedItemCount=doc->m_Selection->count();
8308
bool lockObject = false;
8309
bool modifyLock = false;
8310
uint selectedItemCount=itemSelection->count();
8158
8311
if (showLockDia)
8160
8313
uint lockedCount=0;
8161
8314
for (uint a=0; a<selectedItemCount; ++a)
8163
if (doc->m_Selection->itemAt(a)->locked())
8316
if (itemSelection->itemAt(a)->locked())
8167
8319
if (lockedCount!=0 && lockedCount!=selectedItemCount)
8169
t = QMessageBox::warning(this, CommonStrings::trWarning,
8170
tr("Some objects are locked."),
8171
CommonStrings::tr_Cancel,
8173
tr("&Unlock All"), 0, 0);
8175
return; // user chose cancel -> do not group but return
8176
for (uint a=0; a<selectedItemCount; ++a)
8178
currItem = doc->m_Selection->itemAt(a);
8179
if (currItem->locked())
8181
for (uint c=0; c<selectedItemCount; ++c)
8183
bb = doc->m_Selection->itemAt(c);
8186
scrActions["itemLock"]->setOn(t1);
8187
tooltip += "\t" + currItem->getUName() + "\n";
8193
doc->m_Selection->getGroupRect(&x, &y, &w, &h);
8194
uint lowestItem = 999999;
8195
uint highestItem = 0;
8196
for (uint a=0; a<selectedItemCount; ++a)
8198
currItem = doc->m_Selection->itemAt(a);
8199
currItem->gXpos = currItem->xPos() - x;
8200
currItem->gYpos = currItem->yPos() - y;
8201
currItem->gWidth = w;
8202
currItem->gHeight = h;
8203
lowestItem = QMIN(lowestItem, currItem->ItemNr);
8204
highestItem = QMAX(highestItem, currItem->ItemNr);
8206
double minx = 99999.9;
8207
double miny = 99999.9;
8208
double maxx = -99999.9;
8209
double maxy = -99999.9;
8210
for (uint ep = 0; ep < selectedItemCount; ++ep)
8212
PageItem* currItem = doc->m_Selection->itemAt(ep);
8213
double lw = currItem->lineWidth() / 2.0;
8214
if (currItem->rotation() != 0)
8218
pb.addPoint(FPoint(currItem->xPos()-lw, currItem->yPos()-lw));
8219
pb.addPoint(FPoint(currItem->width()+lw*2.0, -lw, currItem->xPos()-lw, currItem->yPos()-lw, currItem->rotation(), 1.0, 1.0));
8220
pb.addPoint(FPoint(currItem->width()+lw*2.0, currItem->height()+lw*2.0, currItem->xPos()-lw, currItem->yPos()-lw, currItem->rotation(), 1.0, 1.0));
8221
pb.addPoint(FPoint(-lw, currItem->height()+lw*2.0, currItem->xPos()-lw, currItem->yPos()-lw, currItem->rotation(), 1.0, 1.0));
8222
for (uint pc = 0; pc < 4; ++pc)
8224
minx = QMIN(minx, pb.point(pc).x());
8225
miny = QMIN(miny, pb.point(pc).y());
8226
maxx = QMAX(maxx, pb.point(pc).x());
8227
maxy = QMAX(maxy, pb.point(pc).y());
8232
minx = QMIN(minx, currItem->xPos()-lw);
8233
miny = QMIN(miny, currItem->yPos()-lw);
8234
maxx = QMAX(maxx, currItem->xPos()-lw + currItem->width()+lw*2.0);
8235
maxy = QMAX(maxy, currItem->yPos()-lw + currItem->height()+lw*2.0);
8240
double gw = maxx - minx;
8241
double gh = maxy - miny;
8242
PageItem *high = doc->Items->at(highestItem);
8243
undoManager->setUndoEnabled(false);
8244
int z = doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, doc->toolSettings.dBrush, doc->toolSettings.dPen, true);
8245
PageItem *neu = doc->Items->take(z);
8246
doc->Items->insert(lowestItem, neu);
8247
neu->setItemName( tr("Group%1").arg(doc->GroupCounter));
8248
neu->AutoName = false;
8249
neu->isGroupControl = true;
8250
neu->groupsLastItem = high;
8251
undoManager->setUndoEnabled(true);
8253
QMap<int, uint> ObjOrder;
8254
for (uint c = 0; c < selectedItemCount; ++c)
8256
currItem = doc->m_Selection->itemAt(c);
8257
ObjOrder.insert(currItem->ItemNr, c);
8258
int d = doc->Items->findRef(currItem);
8259
doc->Items->take(d);
8261
QValueList<uint> Oindex = ObjOrder.values();
8262
for (int c = static_cast<int>(Oindex.count()-1); c > -1; c--)
8264
doc->Items->insert(lowestItem+1, doc->m_Selection->itemAt(Oindex[c]));
8267
doc->renumberItemsInListOrder();
8268
doc->m_Selection->prependItem(neu);
8269
selectedItemCount=doc->m_Selection->count();
8270
SimpleState *ss = new SimpleState(Um::Group, tooltip);
8271
ss->set("GROUP", "group");
8272
ss->set("itemcount", selectedItemCount);
8274
for (uint a=0; a<selectedItemCount; ++a)
8276
currItem = doc->m_Selection->itemAt(a);
8277
currItem->Groups.push(doc->GroupCounter);
8278
ss->set(QString("item%1").arg(a), currItem->uniqueNr);
8280
doc->GroupCounter++;
8281
view->updateContents(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10)));
8283
scrActions["itemAttachTextToPath"]->setEnabled(false);
8284
scrActions["itemGroup"]->setEnabled(false);
8285
scrActions["itemUngroup"]->setEnabled(true);
8286
undoManager->action(this, ss, Um::SelectionGroup, Um::IGroup);
8322
QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel);
8323
QPushButton *lockButton = msgBox.addButton(tr("&Lock All"), QMessageBox::AcceptRole);
8324
QPushButton *unlockButton = msgBox.addButton(tr("&Unlock All"), QMessageBox::AcceptRole);
8325
msgBox.setIcon(QMessageBox::Warning);
8326
msgBox.setWindowTitle(CommonStrings::trWarning);
8327
msgBox.setText( tr("Some objects are locked."));
8329
if (msgBox.clickedButton() == abortButton)
8331
else if (msgBox.clickedButton() == lockButton)
8334
unlockButton = NULL; // just to silence the compiler
8337
doc->itemSelection_GroupObjects(modifyLock, lockObject);
9205
9254
//Update menu texts
9206
9255
if (scrMenuMgr!=NULL && !scrMenuMgr->empty())
9208
scrMenuMgr->setMenuText("File", tr("&File"));
9209
scrMenuMgr->setMenuText(recentFileMenuName, tr("Open &Recent"));
9210
scrMenuMgr->setMenuText(recentPasteMenuName, tr("Paste Recent"));
9211
scrMenuMgr->setMenuText("FileImport", tr("&Import"));
9212
scrMenuMgr->setMenuText("FileExport", tr("&Export"));
9213
scrMenuMgr->setMenuText("Edit", tr("&Edit"));
9214
scrMenuMgr->setMenuText("EditContents", tr("Contents"));
9215
scrMenuMgr->setMenuText("Style", tr("St&yle"));
9216
scrMenuMgr->setMenuText("Color", tr("&Color"));
9217
scrMenuMgr->setMenuText("FontSize", tr("&Size"));
9218
scrMenuMgr->setMenuText("Shade", tr("&Shade"));
9219
scrMenuMgr->setMenuText("Font", tr("&Font"));
9220
scrMenuMgr->setMenuText("TypeEffects", tr("&Effects"));
9221
scrMenuMgr->setMenuText("Item", tr("&Item"));
9222
scrMenuMgr->setMenuText("ItemLevel", tr("&Level"));
9223
scrMenuMgr->setMenuText("ItemLayer", tr("Send to Layer"));
9224
scrMenuMgr->setMenuText("ItemPreviewSettings", tr("Previe&w Settings"));
9225
scrMenuMgr->setMenuText("ItemPDFOptions", tr("&PDF Options"));
9226
scrMenuMgr->setMenuText("ItemShapes", tr("&Shape"));
9227
scrMenuMgr->setMenuText("ItemConvertTo", tr("C&onvert To"));
9228
scrMenuMgr->setMenuText("Insert", tr("I&nsert"));
9229
scrMenuMgr->setMenuText("InsertChar", tr("Character"));
9230
scrMenuMgr->setMenuText("InsertQuote", tr("Quote"));
9231
scrMenuMgr->setMenuText("InsertSpace", tr("Space"));
9232
scrMenuMgr->setMenuText("InsertLigature", tr("Liga&ture"));
9233
scrMenuMgr->setMenuText("Page", tr("&Page"));
9234
scrMenuMgr->setMenuText("View", tr("&View"));
9235
scrMenuMgr->setMenuText("Tools", tr("&Tools"));
9236
scrMenuMgr->setMenuText("Extras", tr("E&xtras"));
9237
scrMenuMgr->setMenuText("Windows", tr("&Windows"));
9238
scrMenuMgr->setMenuText("Help", tr("&Help"));
9239
scrMenuMgr->setMenuText("Alignment", tr("&Alignment"));
9241
rebuildStyleMenu(HaveDoc ? doc->CurrentSel : -1);
9257
scrMenuMgr->setText("File", ActionManager::defaultMenuNameEntryTranslated("File"));
9258
scrMenuMgr->setText(recentFileMenuName, tr("Open &Recent"));
9259
scrMenuMgr->setText(recentPasteMenuName, tr("Paste Recent"));
9260
scrMenuMgr->setText("FileImport", tr("&Import"));
9261
scrMenuMgr->setText("FileExport", tr("&Export"));
9262
scrMenuMgr->setText("Edit", ActionManager::defaultMenuNameEntryTranslated("Edit"));
9263
scrMenuMgr->setText("EditContents", tr("Contents"));
9264
scrMenuMgr->setText("Item", ActionManager::defaultMenuNameEntryTranslated("Item"));
9265
scrMenuMgr->setText("ItemLevel", tr("&Level"));
9266
scrMenuMgr->setText("ItemLayer", tr("Send to Layer"));
9267
scrMenuMgr->setText("ItemPreviewSettings", tr("Previe&w Settings"));
9268
scrMenuMgr->setText("ItemPDFOptions", tr("&PDF Options"));
9269
//scrMenuMgr->setText("ItemShapes", tr("&Shape"));
9270
scrMenuMgr->setText("ItemConvertTo", tr("C&onvert To"));
9271
// scrMenuMgr->setText("ItemPathOps", tr("Path Tools"));
9272
scrMenuMgr->setText("Insert", ActionManager::defaultMenuNameEntryTranslated("Insert"));
9273
scrMenuMgr->setText("InsertChar", tr("Character"));
9274
scrMenuMgr->setText("InsertQuote", tr("Quote"));
9275
scrMenuMgr->setText("InsertSpace", tr("Space"));
9276
scrMenuMgr->setText("InsertLigature", tr("Liga&ture"));
9277
scrMenuMgr->setText("Page", ActionManager::defaultMenuNameEntryTranslated("Page"));
9278
scrMenuMgr->setText("View", ActionManager::defaultMenuNameEntryTranslated("View"));
9279
// scrMenuMgr->setText("Tools", tr("&Tools"));
9280
scrMenuMgr->setText("Extras", ActionManager::defaultMenuNameEntryTranslated("Extras"));
9281
scrMenuMgr->setText("Windows", ActionManager::defaultMenuNameEntryTranslated("Windows"));
9282
scrMenuMgr->setText("Help", ActionManager::defaultMenuNameEntryTranslated("Help"));
9283
scrMenuMgr->setText("Alignment", tr("&Alignment"));
9284
scrMenuMgr->setText("HelpOnlineTutorials", tr("Online &Tutorials"));
9243
9286
if (undoManager!=NULL)
9244
9287
undoManager->languageChange();
9444
9493
void ScribusMainWindow::PutToPatterns()
9446
undoManager->setUndoEnabled(false);
9447
9495
QString patternName = "Pattern_"+doc->m_Selection->itemAt(0)->itemName();
9448
patternName = patternName.stripWhiteSpace().simplifyWhiteSpace().replace(" ", "_");
9449
ScriXmlDoc *ss = new ScriXmlDoc();
9450
QString objectString = ss->WriteElem(doc, view, doc->m_Selection);
9451
uint ac = doc->Items->count();
9496
patternName = patternName.trimmed().simplified().replace(" ", "_");
9497
Query dia(this, "tt", 1, 0, tr("&Name:"), tr("New Entry"));
9498
dia.setEditText(patternName, true);
9501
patternName = dia.getEditText();
9502
while (doc->docPatterns.contains(patternName))
9506
patternName = dia.getEditText();
9511
undoManager->setUndoEnabled(false);
9512
int ac = doc->Items->count();
9513
uint oldNum = doc->TotalItems;
9452
9514
bool savedAlignGrid = doc->useRaster;
9453
9515
bool savedAlignGuides = doc->SnapGuides;
9516
internalCopy = true;
9454
9517
doc->useRaster = false;
9455
9518
doc->SnapGuides = false;
9456
slotElemRead(objectString, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
9519
Selection itemSelection(this, false);
9520
itemSelection.copy(*doc->m_Selection, false);
9522
doc->m_Selection->delaySignalsOn();
9523
view->Deselect(true);
9457
9525
doc->useRaster = savedAlignGrid;
9458
9526
doc->SnapGuides = savedAlignGuides;
9459
uint ae = doc->Items->count();
9527
internalCopy = false;
9528
int ae = doc->Items->count();
9460
9529
ScPattern pat = ScPattern();
9461
9530
pat.setDoc(doc);
9462
9531
PageItem* currItem = doc->Items->at(ac);
9463
9532
pat.pattern = currItem->DrawObj_toImage();
9464
9533
pat.width = currItem->gWidth;
9465
9534
pat.height = currItem->gHeight;
9466
for (uint as = ac; as < ae; ++as)
9535
for (int as = ac; as < ae; ++as)
9468
pat.items.append(doc->Items->take(ac));
9537
pat.items.append(doc->Items->takeAt(ac));
9470
9539
doc->addPattern(patternName, pat);
9471
9540
propertiesPalette->updateColorList();
9541
if (outlinePalette->isVisible())
9542
outlinePalette->BuildTree();
9543
doc->TotalItems = oldNum;
9544
view->Deselect(true);
9545
// doc->m_Selection->delaySignalsOn();
9546
doc->m_Selection->copy(itemSelection, false);
9547
doc->m_Selection->delaySignalsOff();
9473
9549
undoManager->setUndoEnabled(true);