View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0013544 | Scribus | Documentation | public | 2015-11-19 06:40 | 2016-01-18 13:36 |
Reporter | as.bahanta | Assigned To | cbradney | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Product Version | 1.5.1svn | ||||
Fixed in Version | 1.5.1svn | ||||
Summary | 0013544: Cleaning up scribus code | ||||
Description | clean up Scribus source code from dead code, unused variables, uncalled functions...etc | ||||
Tags | HOST-Oman | ||||
Patch | Yes | ||||
|
CleanUp_Scribusdoc_Scribus.diff (59,972 bytes)
Index: scribus/scribus.cpp =================================================================== --- scribus/scribus.cpp (revision 20560) +++ scribus/scribus.cpp (working copy) @@ -308,20 +308,6 @@ } /* -static QCoreApplication::EventFilter origEventFilter = 0; - -bool reportFocusChanges(void *message, long *result) -{ - unsigned* data = static_cast<unsigned*>(message); - if (QApplication::focusWidget()) - qDebug() << QApplication::applicationFilePath() << reinterpret_cast<void*>(QApplication::focusWidget()) << typeid(*QApplication::focusWidget()).name() << QApplication::focusWidget()->objectName() << message << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7]; - else - qDebug() << QApplication::applicationFilePath() << "no focus" << message << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7]; - return origEventFilter && origEventFilter(message, result); -} -*/ - -/* * retval 0 - ok, 1 - no fonts, ... */ int ScribusMainWindow::initScMW(bool primaryMainWindow) @@ -334,8 +320,6 @@ qApp->setStyleSheet(QString(stylesheet)); } -// origEventFilter = qApp->setEventFilter(reportFocusChanges); - previewDinUse = false; printDinUse = false; internalCopy = false; @@ -380,10 +364,6 @@ actionManager->init(this); -// if (primaryMainWindow) -// ScCore->setSplashStatus( tr("Applying User Shortcuts") ); -// prefsManager->applyLoadedShortCuts(); -// initKeyboardShortcuts(); initMenuBar(); createMenuBar(); initToolBars(); @@ -721,18 +701,14 @@ connect( nsEditor, SIGNAL(paletteShown(bool)), scrActions["editNotesStyles"], SLOT(setChecked(bool))); nsEditor->installEventFilter(this); -// connect(docCheckerPalette, SIGNAL(selectElement(int, int)), this, SLOT(selectItemsFromOutlines(int, int))); connect(docCheckerPalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); connect(docCheckerPalette, SIGNAL(selectElement(PageItem *, bool, int)), this, SLOT(selectItemFromOutlines(PageItem *, bool, int))); connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(editMasterPagesStart(QString))); -// connect(outlinePalette, SIGNAL(selectElement(int, int, bool)), this, SLOT(selectItemsFromOutlines(int, int, bool))); connect(outlinePalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); connect(outlinePalette, SIGNAL(editElementByItem(PageItem *)), this, SLOT(editItemsFromOutlines(PageItem *))); connect(outlinePalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); connect(outlinePalette, SIGNAL(selectMasterPage(QString)), this, SLOT(editMasterPagesStart(QString))); -// connect(propertiesPalette, SIGNAL(EditLSt()), this, SLOT(slotEditLineStyles())); -// connect(nodePalette, SIGNAL(paletteClosed()), propertiesPalette, SLOT(endEdit2())); connect(nodePalette, SIGNAL(paletteClosed()), this, SLOT(slotSelect())); connect(nodePalette, SIGNAL(DocChanged()), this, SLOT(slotDocCh())); connect(layerPalette, SIGNAL(LayerChanged()), this, SLOT(showLayer())); @@ -1210,7 +1186,6 @@ scrMenuMgr->addMenuItemString("toolsPages", "Windows"); scrMenuMgr->addMenuItemString("toolsLayers", "Windows"); scrMenuMgr->addMenuItemString("toolsBookmarks", "Windows"); -// scrMenuMgr->addMenuItemString("toolsDownloads", "Windows"); scrMenuMgr->addMenuItemString("toolsResources", "Windows"); scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); scrMenuMgr->addMenuItemString("toolsScrapbook", "Windows"); @@ -1307,17 +1282,6 @@ mainWindowYPosDataLabel->setMinimumWidth(mainWindowYPosDataLabel->fontMetrics().width("99999.999")); statusBarLanguageChange(); - /* - QByteArray stylesheet; - if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet)) - { - QString downArrow(IconManager::instance()->pathForIcon("16/go-down.png")); - QByteArray da; - da.append(downArrow); - stylesheet.replace("___downArrow___", da); - } - */ - layerMenu->setObjectName("layerMenu"); unitSwitcher->setObjectName("unitSwitcher"); zoomDefaultToolbarButton->setObjectName("zoomDefaultToolbarButton"); @@ -1325,15 +1289,6 @@ zoomOutToolbarButton->setObjectName("zoomOutToolbarButton"); zoomSpinBox->setObjectName("zoomSpinBox"); - /* - layerMenu->setStyleSheet(stylesheet); - unitSwitcher->setStyleSheet(stylesheet); - zoomDefaultToolbarButton->setStyleSheet(stylesheet); - zoomInToolbarButton->setStyleSheet(stylesheet); - zoomOutToolbarButton->setStyleSheet(stylesheet); - zoomSpinBox->setStyleSheet(stylesheet); - */ - statusBar()->setFont(fo); statusBar()->addPermanentWidget(mainWindowStatusLabel, 5); QLabel *s=new QLabel(""); @@ -2275,9 +2230,6 @@ { w->setSubWin(mdiArea->addSubWindow(w)); //#9250 : transfered to newActWin() - //connect(undoManager, SIGNAL(undoRedoBegin()), tempDoc, SLOT(undoRedoBegin())); - //connect(undoManager, SIGNAL(undoRedoDone()), tempDoc, SLOT(undoRedoDone())); - //connect(undoManager, SIGNAL(undoRedoDone()), tempView, SLOT(DrawNew())); connect(tempView, SIGNAL(signalGuideInformation(int, qreal)), alignDistributePalette, SLOT(setGuide(int, qreal))); } //Independent finishing tasks after tempDoc setup @@ -2364,8 +2316,6 @@ if (windowsListNotEmpty) { int windowCount=static_cast<int>(windows.count()); - // if (windowCount>1) - // scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); for ( int i = 0; i < windowCount; ++i ) { QString docInWindow(windows.at(i)->windowTitle()); @@ -2515,9 +2465,7 @@ connect(view, SIGNAL(signalGuideInformation(int, qreal)), alignDistributePalette, SLOT(setGuide(int, qreal))); if (ScCore->usingGUI()) { - //connect(doc->m_Selection, SIGNAL(selectionIsMultiple(bool)), propertiesPalette, SLOT( setMultipleSelection(bool))); connect(doc->m_Selection, SIGNAL(selectionIsMultiple(bool)), actionManager, SLOT( handleMultipleSelections(bool))); - //connect(doc->m_Selection, SIGNAL(empty()), propertiesPalette, SLOT( unsetItem())); } pagePalette->setView(view); alignDistributePalette->setDoc(doc); @@ -3207,7 +3155,6 @@ else docDir = docContext->get("docsopen", "."); QString formats(FileLoader::getLoadFilterString()); -// formats.remove("PDF (*.pdf *.PDF);;"); QString fileName(CFileDialog( docDir, tr("Open"), formats)); if (fileName.isEmpty()) // User cancelled return false; @@ -3350,8 +3297,6 @@ for (uint i = oldItemsCount; i < docItemsCount; ++i) { PageItem *ite = doc->Items->at(i); -// if ((docItemsCount - oldItemsCount) > 1) -// ite->Groups.push(doc->GroupCounter); // #5386: allow locked imported items to remain locked // if (ite->locked()) // ite->setLocked(false); @@ -3358,17 +3303,9 @@ if ((ite->asTextFrame()) && (ite->isBookmark)) AddBookMark(ite); } -// if ((docItemsCount - oldItemsCount) > 1) -// doc->GroupCounter++; propertiesPalette->updateColorList(); emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate); symbolPalette->updateSymbolList(); -// inlinePalette->updateItemList(); -// if (!Mpa) -// { -// scanDocument(); -// docCheckerPalette->buildErrorList(doc); -// } slotDocCh(); rebuildLayersList(); updateLayerMenu(); @@ -3514,7 +3451,6 @@ { view->close(); delete fileLoader; -// delete view; delete doc; doc=NULL; mdiArea->removeSubWindow(w->getSubWin()); @@ -3673,8 +3609,6 @@ { doc->cmsSettings().CMSinUse = false; } -// propertiesPalette->updateColorList(); -// propertiesPalette->Cpal->showGradient(0); if (fileLoader->fileType() > FORMATID_NATIVEIMPORTEND) { doc->setName(FName+ tr("(converted)")); @@ -3685,11 +3619,8 @@ else doc->setName(FName); doc->setMasterPageMode(false); - //IL doc->setHyphLanguage(GetLang(doc->hyphLanguage())); doc->createHyphenator(); HaveNewDoc(); -// propertiesPalette->Cpal->showGradient(0); -// propertiesPalette->updateCList(); doc->hasName = true; if (doc->MasterPages.count() == 0) { @@ -3724,10 +3655,7 @@ // qDebug() << QString("load M: %1 %2 %3").arg(azz).arg((uint)ite).arg(ite->itemType()); ite->layout(); } -// RestoreBookMarks(); doc->setMasterPageMode(false); - /*QTime t; - t.start();*/ int docItemsCount=doc->Items->count(); doc->flag_Renumber = false; for (int i=0; i<docItemsCount; ++i) @@ -3763,8 +3691,6 @@ } view->reformPages(false); doc->setLoading(false); -// if (fileLoader->fileType() > FORMATID_NATIVEIMPORTEND) -// scrActions["fileSave"]->setEnabled(false); delete fileLoader; view->updatesOn(true); w->setUpdatesEnabled(true); @@ -4055,7 +3981,6 @@ if (doc->docHyphenator->AutoCheck) doc->itemSelection_DoHyphenate(); view->DrawNew(); - //slotDocCh(); } } @@ -4731,7 +4656,6 @@ doc->SnapGrid = savedAlignGrid; doc->SnapGuides = savedAlignGuides; doc->SnapElement = savedAlignElement; - //int tempList=doc->m_Selection->backupToTempList(0); Selection tempSelection(*doc->m_Selection); doc->m_Selection->clear(); if (doc->Items->count() - ac > 1) @@ -4760,10 +4684,7 @@ doc->Items->takeAt(ac); } doc->m_Selection->clear(); - //doc->m_Selection->restoreFromTempList(0, tempList); *doc->m_Selection=tempSelection; -// view->resizeContents(qRound((maxSize.x() - minSize.x()) * view->scale()), qRound((maxSize.y() - minSize.y()) * view->scale())); -// view->scrollBy(qRound((doc->minCanvasCoordinate.x() - minSize.x()) * view->scale()), qRound((doc->minCanvasCoordinate.y() - minSize.y()) * view->scale())); doc->minCanvasCoordinate = minSize; doc->maxCanvasCoordinate = maxSize; if (outlinePalette->isVisible()) @@ -5868,7 +5789,6 @@ if (!doc->m_Selection->isEmpty()) { PageItem *currItem = doc->m_Selection->itemAt(0); -// view->MarkClip(currItem, currItem->PoLine, true); nodePalette->EditCont->setEnabled(currItem->ContourLine.size() != 0); nodePalette->ResetCont->setEnabled(false); nodePalette->ResetContClip->setEnabled(false); @@ -6715,31 +6635,6 @@ int ScribusMainWindow::ShowSubs() { bool showGSHelp=false; - /* - if (!ScCore->haveGS()) - { - ScMessageBox mb(this); - QString msg = tr("Ghostscript is not installed on your system, or Scribus is not configured with the path to the software."); - QString msg2("<qt>"); -#ifndef _WIN32 - msg2 += tr("Until this is remedied, you cannot import EPS images or use Print Preview. ")+"\n"; -#else - msg2 += tr("Until this is remedied, you cannot import EPS images or use PostScript Print Preview. ")+"\n"; -#endif - //msg2 += tr("Please read our <a href=\"http://wiki.scribus.net/index.php/Ghostscript\">help and installation instructions</a>.") + "</qt>"; - msg2 += tr("Click the Help button to read Scribus-related Ghostscript help and installation instructions.") + "</qt>"; - ScMessageBox msgBox; - msgBox.addButton(QMessageBox::Ok); - msgBox.addButton(QMessageBox::Help); - msgBox.setIcon(QMessageBox::Warning); - msgBox.setWindowTitle( tr("Ghostscript is missing") ); - msgBox.setText(msg); - msgBox.setInformativeText(msg2); - int i=msgBox.exec(); - if (i==QMessageBox::Help) - showGSHelp=true; - } -*/ propertiesPalette->startup(); outlinePalette->startup(); scrapbookPalette->startup(); @@ -6747,7 +6642,6 @@ downloadsPalette->startup(); pagePalette->startup(); layerPalette->startup(); -// measurementPalette->startup(); docCheckerPalette->startup(); alignDistributePalette->startup(); undoPalette->startup(); @@ -6825,7 +6719,6 @@ prefsManager->appPrefs.printPreviewPrefs.PrPr_InkCoverage = dia->EnableInkCover->isChecked(); prefsManager->appPrefs.printPreviewPrefs.PrPr_InkThreshold = dia->CoverThresholdValue->value(); } -// prefsManager->appPrefs.Gcr_Mode = dia->EnableGCR->isChecked(); disconnect(dia, SIGNAL(doPrint()), this, SLOT(slotReallyPrint())); previewDinUse = false; delete dia; @@ -7061,11 +6954,9 @@ scrActions["toolsPreflightVerifier"]->setChecked(false); disconnect(docCheckerPalette, SIGNAL(ignoreAllErrors()), this, SLOT(doSaveAsPDF())); } -/* if (bookmarkPalette->BView->childCount() == 0) - doc->PDF_Options.Bookmarks = false; */ // reenabling the following line fixes Bug #7630, not sure why this line was commented out. // doc->reorganiseFonts(); - QMap<QString, int> ReallyUsed = doc->reorganiseFonts(); //doc->UsedFonts; + QMap<QString, int> ReallyUsed = doc->reorganiseFonts(); if (doc->pdfOptions().EmbedList.count() != 0) { QList<QString> tmpEm; @@ -7315,8 +7206,6 @@ Boma.Aktion = ip->Action; Boma.ItemNr = ip->ItemNr; Boma.PageObject = ip->PageObject; -// Boma.Seite = ip->Seite; -// Boma.Element = ip->Element; Boma.Parent = ip->Pare; Boma.First = ip->First; Boma.Prev = ip->Prev; @@ -7611,7 +7500,7 @@ if (dia->exec()) { QString masterPageName = dia->getMasterPageName(); - int pageSelection = dia->getPageSelection(); //0=current, 1=even, 2=odd, 3=all + int pageSelection = dia->getPageSelection(); if (pageSelection==0) //current page only Apply_MasterPage(masterPageName, doc->currentPage()->pageNr(), false); else @@ -8114,22 +8003,6 @@ //Insert the name as key and a new string list into the map QString hyphDirName = QDir::toNativeSeparators(ScPaths::instance().dictDir()+"/hyph/"); QDir hyphDir(hyphDirName, "hyph*.dic", QDir::Name, QDir::Files | QDir::NoSymLinks); -//IL if ((hyphDir.exists()) && (hyphDir.count() != 0)) -//IL { -// LanguageManager langmgr; -// langmgr.init(false); -//IL QString languageOfHyphFile; -//IL for (uint dc = 0; dc < hyphDir.count(); ++dc) -//IL { -//IL QFileInfo fi(hyphDir[dc]); -//IL QString fileLangAbbrev=fi.baseName().section('_', 1); -//IL InstLang.insert(fileLangAbbrev, QStringList()); -//<<hunspell -// languageOfHyphFile = LanguageManager::instance()->getLangFromAbbrev(fileLangAbbrev, false); -// InstLang.insert(languageOfHyphFile, QStringList()); -//>>hunspell -//IL } -//IL } //For each qm file existing, load the file and find the translations of the names QString pfad = ScPaths::instance().translationDir(); @@ -8140,50 +8013,13 @@ { QFileInfo fi(pfad + d2[dc]); QString ext = fi.suffix().toLower(); - if (ext == "qm") - { - //IL QTranslator *trans = new QTranslator(0); -//IL trans->load(pfad + d2[dc]); - -//IL QString translatedLang; -//IL for (QMap<QString, QStringList>::Iterator it=InstLang.begin(); it!=InstLang.end(); ++it) -//IL { -//IL translatedLang=""; -//IL translatedLang = trans->translate("QObject", LanguageManager::instance()->getLangFromAbbrev(it.key(), false).toLocal8Bit().data(), ""); -//IL if (!translatedLang.isEmpty()) -//IL it.value().append(translatedLang); -//IL } -//IL delete trans; - } } } //For each hyphenation file, grab the strings and the hyphenation data. QString lang = QString(QLocale::system().name()).left(2); -//IL LangTransl.clear(); prefsManager->appPrefs.hyphPrefs.Language = "en_GB"; if (!LanguageManager::instance()->getHyphFilename(lang).isEmpty() ) prefsManager->appPrefs.hyphPrefs.Language = lang; - -/* - if ((hyphDir.exists()) && (hyphDir.count() != 0)) - { - LanguageManager *langmgr(LanguageManager::instance()); -// langmgr.init(false); - QString tLang = ""; - for (uint dc = 0; dc < hyphDir.count(); ++dc) - { - QFileInfo fi(hyphDir[dc]); - QString fileLangAbbrev = fi.baseName().section('_', 1); - tLang = langmgr->getLangFromAbbrev(fileLangAbbrev); -//IL LangTransl.insert(fileLangAbbrev, tLang); - langmgr->addHyphLang(fileLangAbbrev, hyphDir[dc]); - if (fileLangAbbrev == lang) - prefsManager->appPrefs.hyphPrefs.Language = fileLangAbbrev; - } - if (tLang.isEmpty()) - prefsManager->appPrefs.hyphPrefs.Language = "en_GB"; - } - */ } void ScribusMainWindow::ImageEffects() @@ -9948,27 +9784,6 @@ qqview->deleteLater(); } -/* -void ScribusMainWindow::adjustCMS() -{ - if (!HaveDoc) - return; - AdjustCmsDialog* dia = new AdjustCmsDialog(this, doc); - if (dia->exec()) - { - dia->tabColorManagement->updateDocSettings(doc); - if (dia->tabColorManagement->changed) - { - doc->enableCMS(doc->cmsSettings().CMSinUse); - cmsToolbarButton->setChecked(doc->HasCMS); - requestUpdate(reqCmsOptionsUpdate); - doc->view()->DrawNew(); - } - } - delete dia; -} -*/ - void ScribusMainWindow::changePreviewQuality(int index) { if (!HaveDoc) Index: scribus/scribus.h =================================================================== --- scribus/scribus.h (revision 20560) +++ scribus/scribus.h (working copy) @@ -447,7 +447,6 @@ void slotSelect(); /** \brief Switch appMode \param mode TODO learn modes*/ - //void setAppMode(int mode); void setAppModeByToggle(bool isOn, int newMode); /** \brief Neues Dokument erzeugt */ void HaveNewDoc(); @@ -455,7 +454,6 @@ /** Dokument ist geaendert worden */ void slotDocCh(bool reb = true); /** Setzt die Abstufung */ - //void setItemShade(int id); /** Setzt den Font */ /** Korrigiert das FontMenu */ void SetNewFont(const QString& nf); @@ -569,7 +567,6 @@ void testQT_slot2(double); void testQT_slot3(int); void testQT_slot4(); - //void adjustCMS(); void changePreviewQuality(int index); void enablePalettes(bool b); void ToggleFrameEdit(); @@ -576,7 +573,6 @@ void NoFrameEdit(); signals: - //void AppModeChanged(int oldMode, int newMode); void TextStyle(const ParagraphStyle&); //deprecated: (av) void TextEffects(int); Index: scribus/scribusdoc.cpp =================================================================== --- scribus/scribusdoc.cpp (revision 20560) +++ scribus/scribusdoc.cpp (working copy) @@ -914,7 +914,6 @@ //AV: eeks. That should not be used ScribusView* ScribusDoc::view() const { -// return (WinHan ? (((ScribusWin*) WinHan)->view()) : 0); return m_View; } @@ -1165,8 +1164,6 @@ docTableStyles[i].getNamedResources(lists); for (int i = 0; i < docCellStyles.count(); ++i) docCellStyles[i].getNamedResources(lists); -// for (uint i = 0; i < docLineStyles.count(); ++i) -// docLineStyles[i].getNamedResources(lists); QHash<QString,ScPattern>::ConstIterator it; for (it = docPatterns.begin(); it != docPatterns.end(); ++it) @@ -1337,11 +1334,6 @@ { // replace names in items -//#ifndef QT_NO_CONCURRENT -// QtConcurrent::blockingMap(DocItems, ResMapped(newNames)); -// QtConcurrent::blockingMap(MasterItems, ResMapped(newNames)); -//#else - QList<PageItem*> * itemlist = & MasterItems; while (itemlist != NULL) { @@ -1356,7 +1348,6 @@ else itemlist = NULL; } -//#endif foreach (NotesStyle* nStyle, m_docNotesStylesList) { //update styles names in notes styles if (nStyle == NULL) @@ -1468,44 +1459,6 @@ ResourceCollection newNames; newNames.mapCharStyles(newNameForOld); replaceNamedResources(newNames); - - /* - // replace style in items - QPtrList<PageItem> * itemlist = & MasterItems; - while (itemlist != NULL) - { - for (uint i=0; i < itemlist->count(); ++i) - { - PageItem_TextFrame * currItem = itemlist->at(i)->asTextFrame(); - if (currItem) - currItem->itemText.replaceCharStyles(newNameForOld); - } - if (itemlist == &MasterItems) - itemlist = &DocItems; - else if (itemlist == &DocItems) - itemlist = &FrameItems; - else - itemlist = NULL; - } - // replace names in styles - for (uint i=0; i < docParagraphStyles.count(); ++i) - { - // ...parent of parstyle's charstyle - const QString& parent(docParagraphStyles[i].charStyle().parent()); - if (newNameForOld.contains(parent)) - docParagraphStyles[i].charStyle().setParent(newNameForOld[parent]); - } - for (int i=docCharStyles.count()-1; i >= 0; --i) - { - // ...parent of charstyle - const QString& parent(docCharStyles[i].parent()); - if (newNameForOld.contains(parent)) - docCharStyles[i].setParent(newNameForOld[parent]); - // ... as name - if (newNameForOld.contains(docCharStyles[i].name())) - docCharStyles.remove(i); - } - */ } void ScribusDoc::replaceTableStyles(const QMap<QString, QString>& newNameForOld) @@ -2413,10 +2366,6 @@ } setMasterPageMode(oldMPMode); setCurrentPage(oldPage); -// m_View->reformPages(); -// m_View->DrawNew(); -// scMW()->pagePalette->Rebuild(); -// scMW()->guidePalette->setupPage(false); } void ScribusDoc::restoreGrouping(SimpleState* ss, bool isUndo) @@ -2482,12 +2431,6 @@ PageSpa = ab; docPrefsData.docSetupPrefs.pagePositioning = fp; automaticTextFrames = atf; - - //CB Moved from scribus.cpp. Overrides the defaults... -// PDF_Options.BleedTop = pageMargins.top(); -// PDF_Options.BleedLeft = pageMargins.left(); -// PDF_Options.BleedRight = pageMargins.right(); -// PDF_Options.BleedBottom = pageMargins.bottom(); } void ScribusDoc::resetPage(int fp, MarginStruct* newMargins) @@ -2501,7 +2444,6 @@ bool ScribusDoc::AddFont(QString name, int fsize) { bool ret = false; -// FT_Face face; if (UsedFonts.contains(name)) return true; @@ -2509,41 +2451,7 @@ if (! AllFonts->contains(name) || name == "" ) return false; -// face = (*AllFonts)[name]->ftFace(); -// if ( !face ) -// return false; -/* if ((*AllFonts)[name].ReadMetrics()) FIXME: needed? - { -// (*AllFonts)[name]->CharWidth[13] = 0; -// (*AllFonts)[name]->CharWidth[28] = 0; -// (*AllFonts)[name]->CharWidth[26] = 0; -// (*AllFonts)[name]->CharWidth[9] = 1; - QString afnm = (*AllFonts)[name].fontFilePath().left((*AllFonts)[name].fontFilePath().length()-3); - QFile afm(afnm+"afm"); - if (!(afm.exists())) - { - afm.setName(afnm+"pfm"); - } - if (!(afm.exists())) { - afm.setName(afnm+"AFM"); - } - if (!(afm.exists())) - { - afm.setName(afnm+"PFM"); - } - if (!(afm.exists())) - { - afm.setName(afnm+"Afm"); - } - if (!(afm.exists())) - { - afm.setName(afnm+"Pfm"); - } - if (afm.exists()) - FT_Attach_File(face, afm.name()); - } - */ UsedFonts[name] = fsize; (*AllFonts)[name].increaseUsage(); ret = true; @@ -2681,14 +2589,11 @@ DocPages.insert(pageIndex, addedPage); assert(DocPages.at(pageIndex)!=NULL); setCurrentPage(addedPage); - //if (!masterPageMode()) if (!masterPageName.isEmpty()) applyMasterPage(masterPageName, pageIndex); setLocationBasedPageLRMargins(pageIndex); if (addAutoFrame && automaticTextFrames) addAutomaticTextFrame(pageIndex); -// if (!isLoading()) -// changed(); return addedPage; } @@ -2788,15 +2693,6 @@ // remove the master page from the master page name list //MasterNames.remove(page->PageNam); /*CB TODO moved back to muster.cpp for now as this must happen after reformPages - MasterNames.clear(); - for (uint a = 0; a < Pages->count(); ++a) - MasterNames[Pages->at(a)->PageNam] = Pages->at(a)->pageNr(); - // and fix up any pages that refer to the deleted master page - for (Page* docPage = DocPages.first(); docPage; docPage = DocPages.next() ) - { - if (docPage->MPageNam == oldPageName) - docPage->MPageNam = CommonStrings::masterPageNormal; - } */ //QPtrList docs: The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last item is removed, the new last item becomes the current item. changed(); @@ -2818,7 +2714,6 @@ QListIterator<ScPage *> dpIt(DocPages); ScPage* docPage=NULL; while(dpIt.hasNext()) - //for (Page* docPage = currentDoc->DocPages.first(); docPage; docPage = currentDoc->DocPages.next() ) { docPage=dpIt.next(); if (docPage->MPageNam == oldMasterPage) @@ -4358,12 +4253,8 @@ QMap<QString,int> ScribusDoc::reorganiseFonts() { -// QTime t; -// t.start(); QMap<QString,int> Really; QList<PageItem*> allItems; - //QMap<QString,QFont> DocF; - //DocF = UsedFonts; uint counter = 0; for (uint lc = 0; lc < 2; ++lc) { @@ -4502,8 +4393,8 @@ } } PrefsManager* prefsManager=PrefsManager::instance(); - AddFont(prefsManager->appPrefs.itemToolPrefs.textFont);//, prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.itemToolPrefs.textFont]->Font); - AddFont(docPrefsData.itemToolPrefs.textFont);//, prefsManager->appPrefs.AvailFonts[itemToolPrefs.textFont]->Font); + AddFont(prefsManager->appPrefs.itemToolPrefs.textFont); + AddFont(docPrefsData.itemToolPrefs.textFont); // qDebug( "Time elapsed: %d ms", t.elapsed() ); return Really; } @@ -4677,12 +4568,11 @@ //Our page number collection string QString pageNumberText(QString::null); if (chr == 30) - {//ch == SpecialChars::PAGENUMBER + { if (e > 0 && it->itemText.text(e-1) == SpecialChars::PAGENUMBER) pageNumberText=SpecialChars::ZWNBSPACE; else if (lc!=0) //If not on a master page just get the page number for the page and the text { -// pageNumberText=getSectionPageNumberForPageIndex(it->OwnPage); pageNumberText = QString("%1").arg(getSectionPageNumberForPageIndex(it->OwnPage), getSectionPageNumberWidthForPageIndex(it->OwnPage), getSectionPageNumberFillCharForPageIndex(it->OwnPage)); @@ -4699,7 +4589,6 @@ { if (DocPages.at(a)->MPageNam == it->OnMasterPage) { -// newText=getSectionPageNumberForPageIndex(a); newText = QString("%1").arg(getSectionPageNumberForPageIndex(a), getSectionPageNumberWidthForPageIndex(a), getSectionPageNumberFillCharForPageIndex(a)); @@ -4711,7 +4600,7 @@ } } else - {//ch == SpecialChars::PAGECOUNT + { if (lc!=0) { int key = getSectionKeyForPageIndex(it->OwnPage); @@ -4890,12 +4779,6 @@ undoManager->action(this, ss); } } - -// QString mna = pageName; -// if (mna == CommonStrings::trMasterPageNormal) -// mna = CommonStrings::masterPageNormal; -// if (!MasterNames.contains(mna)) -// mna = CommonStrings::masterPageNormal; ScPage* Ap = DocPages.at(pageNumber); Ap->MPageNam = pageName; const int MpNr = MasterNames[pageName]; @@ -4902,15 +4785,6 @@ ScPage* Mp = MasterPages.at(MpNr); PageItem *currItem; -// for (currItem = Ap->FromMaster.first(); currItem; currItem = Ap->FromMaster.next()) -// { -// if (currItem->ChangedMasterItem) -// { -// Ap->FromMaster.remove(currItem); -// delete currItem; -// } -// } - Ap->FromMaster.clear(); for (int itn = 0; itn < MasterItems.count(); ++itn) { @@ -5246,14 +5120,8 @@ } } -//#ifndef QT_NO_CONCURRENT -// QtConcurrent::blockingMap(DocItems, &ScribusDoc::recalculateColorItem); -// QtConcurrent::blockingMap(MasterItems, &ScribusDoc::recalculateColorItem); -//#else - recalculateColorsList(&DocItems); recalculateColorsList(&MasterItems); -//#endif QList<PageItem*> itemList = FrameItems.values(); recalculateColorsList(&itemList); QList<PageItem*> allItems; @@ -5367,14 +5235,6 @@ } } - -//void ScribusDoc::setScTextDefaultsFromDoc(ScText *sctextdata) -//{ -// if (sctextdata==NULL) -// return; -// reinterpret_cast<CharStyle&>(*sctextdata) = currentStyle.charStyle(); -//} - bool ScribusDoc::copyPageToMasterPage(const int pageNumber, const int leftPage, const int maxLeftPage, const QString& masterPageName, bool copyFromAppliedMaster) { assert(!masterPageMode()); @@ -5499,11 +5359,9 @@ //for items that do not have/need a frameType for creation. case PageItem::ImageFrame: newItem = new PageItem_ImageFrame(this, x, y, b, h, w, docPrefsData.itemToolPrefs.imageFillColor, docPrefsData.itemToolPrefs.imageStrokeColor); -// Q_ASSERT(frameType==PageItem::Rectangle || frameType==PageItem::Unspecified); break; case PageItem::TextFrame: newItem = new PageItem_TextFrame(this, x, y, b, h, w, CommonStrings::None, outline); -// Q_ASSERT(frameType==PageItem::Rectangle || frameType==PageItem::Unspecified); break; case PageItem::Line: { @@ -5510,7 +5368,6 @@ //CB 5521 Remove false minimum line width double lineWidth = w; // == 0.0 ? 1.0 : w; newItem = new PageItem_Line(this, x, y, b, h, lineWidth, CommonStrings::None, outline); -// Q_ASSERT(frameType==PageItem::Unspecified); } break; case PageItem::Table: @@ -5790,8 +5647,6 @@ break; case PageItem::NoteFrame: case PageItem::TextFrame: -// newItem->setFontFillShade(itemToolPrefs.textShade); -// newItem->setFontStrokeShade(itemToolPrefs.textStrokeShade); newItem->setFillColor(docPrefsData.itemToolPrefs.textFillColor); newItem->setFillShade(docPrefsData.itemToolPrefs.textFillColorShade); newItem->setLineColor(docPrefsData.itemToolPrefs.textLineColor); @@ -5831,7 +5686,6 @@ newItem->SetRectFrame(); //TODO one day hopefully, if (ScCore->usingGUI()) newItem->setRedrawBounding(); - //m_View->setRedrawBounding(newItem); newItem->ContourLine = newItem->PoLine.copy(); } @@ -5840,7 +5694,6 @@ newItem->SetOvalFrame(); //TODO one day hopefully, if (ScCore->usingGUI()) newItem->setRedrawBounding(); - //m_View->setRedrawBounding(newItem); newItem->ContourLine = newItem->PoLine.copy(); } @@ -6275,7 +6128,6 @@ int rowcounter = 0; double maxYPos=0.0, maxXPos=0.0; double currentXPos=docPrefsData.displayPrefs.scratch.left(), currentYPos=docPrefsData.displayPrefs.scratch.top(), lastYPos=Pages->at(0)->initialHeight(); -// currentXPos += (pageWidth+pageSets[currentPageLayout].GapHorizontal) * counter; currentXPos += (docPrefsData.docSetupPrefs.pageWidth+docPrefsData.displayPrefs.pageGapHorizontal) * counter; lastYPos = Pages->at(0)->initialHeight(); @@ -6317,7 +6169,6 @@ page->setYOffset(currentYPos); if (counter < pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Columns-1) { -// currentXPos += Seite->width() + pageSets[currentPageLayout].GapHorizontal; currentXPos += page->width() + docPrefsData.displayPrefs.pageGapHorizontal; lastYPos = qMax(lastYPos, page->height()); if (counter == 0) @@ -6336,11 +6187,8 @@ currentXPos = docPrefsData.displayPrefs.scratch.left(); if (pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Columns > 1) currentYPos += qMax(lastYPos, page->height())+docPrefsData.displayPrefs.pageGapVertical; -// currentYPos += qMax(lastYPos, Seite->height())+pageSets[currentPageLayout].GapVertical; else currentYPos += page->height()+docPrefsData.displayPrefs.pageGapVertical; -// currentYPos += Seite->height()+pageSets[currentPageLayout].GapVertical; -// lastYPos = qMax(lastYPos, Seite->height()); lastYPos = 0; page->Margins.setRight(page->initialMargins.right()); page->Margins.setLeft(page->initialMargins.left()); @@ -6352,8 +6200,6 @@ rowcounter++; if (rowcounter > pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Rows-1) { -// currentYPos += GapVertical; -// currentYPos += pageSets[currentPageLayout].GapBelow; rowcounter = 0; } } @@ -6542,10 +6388,6 @@ if (UndoManager::undoEnabled() && oldItem->itemType()==PageItem::PathText) transactionConversion = undoManager->beginTransaction(currentPage()->getUName(), 0, Um::TextFrame, "", Um::ITextFrame); break; - //We dont allow this -/* case PageItem::Line: - newItem = new PageItem_PolyLine(*oldItem); - break; */ case PageItem::Polygon: newItem = new PageItem_Polygon(*oldItem); break; @@ -6592,7 +6434,6 @@ polyLineItem->ClipEdited = true; polyLineItem->FrameType = 3; polyLineItem->setRotation(currItem->rotation()); -// polyLineItem->setPolyClip(qRound(qMax(polyLineItem->lineWidth() / 2, 1))); AdjustItemSize(polyLineItem); newItem->setLineColor(CommonStrings::None); @@ -6600,9 +6441,6 @@ newItem->setRedrawBounding(); } break; - //We dont allow this right now - /* case PageItem::Line: - break; */ case PageItem::Polygon: newItem->convertTo(PageItem::Polygon); newItem->ClipEdited = true; @@ -6646,11 +6484,8 @@ newItem->PLineArt = secondaryItem->PLineArt; newItem->PLineEnd = secondaryItem->PLineEnd; newItem->PLineJoin = secondaryItem->PLineJoin; - /* if (!Doc->loading) - emit UpdtObj(Doc->currentPage->pageNr(), b->ItemNr); */ //FIXME: Stop using the view here AdjustItemSize(newItem); -// newItem->updatePolyClip(); double dx = secondaryItem->xPos() - newItem->xPos(); double dy = secondaryItem->yPos() - newItem->yPos(); MoveItem(dx, dy, newItem); @@ -6662,12 +6497,6 @@ newItem=NULL; break; } - //Append the new item to the docs items list - //Items->append(newItem); - //We could append and renumber the list, or, we can insert at the same position.. - //for (uint a = 0; a < Items->count(); ++a) - // Items->at(a)->ItemNr = a; -// Items->insert(oldItem->ItemNr, newItem); newItem->uniqueNr = oldItem->uniqueNr; if (oldItem->isGroupChild()) { @@ -7445,62 +7274,6 @@ pageToAdjust->Margins.setLeft(pageToAdjust->initialMargins.left()); pageToAdjust->Margins.setRight(pageToAdjust->initialMargins.left()); } - /* Can also calc the X pos of the frame too, and Y pos, but thats not done yet - int myRow=(pageIndex+pageSets[currentPageLayout].FirstPage)/setcol; - double xOffset=ScratchLeft; - double yOffset=ScratchTop; - if (myRow==0) - { - if (pageIndex==0) - { - for (int i=0; i<myCol; ++i) - xOffset+=pageWidth+pageSets[currentPageLayout].GapHorizontal; - } - else - { - xOffset=DocPages.at(0)->xOffset(); - for (int i=0; i<pageIndex; ++i) - xOffset+=DocPages.at(i)->width()+pageSets[currentPageLayout].GapHorizontal; - } - } - if (myRow>0) - { - int firstPageOnRow=pageIndex-myCol; - for (int i=firstPageOnRow; i<pageIndex; ++i) - xOffset+=DocPages.at(i)->width()+pageSets[currentPageLayout].GapHorizontal; - } - pageToAdjust->setXOffset(xOffset); - - - if (myRow!=0) - { - for (int i=0;i<myRow;++i) - { - double maxHeightOfRow=0.0; - yOffset+=DocPages.at(i)->width()+pageSets[currentPageLayout].GapHorizontal; - } - - if (pageIndex==0) - { - for (int i=0; i<myCol; ++i) - xOffset+=pageWidth+pageSets[currentPageLayout].GapHorizontal; - } - else - { - xOffset=DocPages.at(0)->xOffset(); - for (int i=0; i<pageIndex; ++i) - xOffset+=DocPages.at(i)->width()+pageSets[currentPageLayout].GapHorizontal; - } - } - if (myRow>0) - { - int firstPageOnRow=pageIndex-myCol; - int setcol=pageSets[currentPageLayout].Columns; - for (int i=firstPageOnRow; i<pageIndex; ++i) - xOffset+=DocPages.at(i)->width()+pageSets[currentPageLayout].GapHorizontal; - } - pageToAdjust->setXOffset(xOffset); - */ } @@ -7976,7 +7749,6 @@ PageItem *currItem = m_Selection->itemAt(a); QRectF oldRect = currItem->getVisualBoundingRect(); //cb moved to setlinewidth - //currItem->Oldm_lineWidth = currItem->lineWidth(); currItem->setLineWidth(w); if (currItem->asPolyLine() || currItem->asSpiral()) currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2, 1.0))); @@ -7988,7 +7760,6 @@ -ph,static_cast<int>(currItem->height()+ph)); } QRectF newRect = currItem->getVisualBoundingRect(); - //currItem->update(); currItem->invalidateLayout(); regionsChanged()->update(newRect.united(oldRect)); } @@ -9034,52 +8805,6 @@ newStyle.setFeatures(static_cast<StyleFlag>(s).featureList()); itemSelection_ApplyCharStyle(newStyle, customSelection, "EFFECTS"); return; - - /*uint selectedItemCount=m_Selection->count(); - if (selectedItemCount != 0 && s != ScStyle_None) - { - UndoTransaction activeTransaction; - m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) - activeTransaction = undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetFontEffect, "", Um::IFont); - for (uint aa = 0; aa < selectedItemCount; ++aa) - { - PageItem *currItem = m_Selection->itemAt(aa); -// if (appMode != modeEdit) -// currItem->setFontEffects(s); - if (currItem->itemText.length() != 0) - { - if ((appMode == modeEdit) || (appMode == modeEditTable)) - { - for (int a = 0; a < currItem->itemText.length(); ++a) - { - if (currItem->itemText.selected(a)) - { - StyleFlag fl = currItem->itemText.item(a)->effects(); - fl &= static_cast<StyleFlag>(~1919); // 0x11101111111 - fl |= static_cast<StyleFlag>(s & 1919); - currItem->itemText.item(a)->setFeatures(fl.featureList()); - } - } - } - else - { - for (int a = 0; a < currItem->itemText.length(); ++a) - { - StyleFlag fl = currItem->itemText.item(a)->effects(); - fl &= static_cast<StyleFlag>(~1919); // 1024+512+256+64+32+16+8+4+2+1 - fl |= static_cast<StyleFlag>(s & 1919); - currItem->itemText.item(a)->setFeatures(fl.featureList()); - } - } - currItem->update(); - } - } - if (activeTransaction) - activeTransaction.commit(); - m_updateManager.setUpdatesEnabled(); - changed(); - }*/ } void ScribusDoc::itemSelection_SetOpticalMargins(int i, Selection* customSelection) @@ -9093,9 +8818,6 @@ void ScribusDoc::itemSelection_resetOpticalMargins(Selection* customSelection) { //TODO -// ParagraphStyle newStyle; -// newStyle.setOpticalMargins(i); -// itemSelection_ApplyParagraphStyle(newStyle, customSelection); } void ScribusDoc::itemSelection_SetTracking(int kern, Selection* customSelection) @@ -9140,30 +8862,9 @@ void ScribusDoc::itemSelection_SetFontSize(int size, Selection* customSelection) { - //if (true || ((appMode == modeEdit) || (appMode == modeEditTable))) - //{ CharStyle newStyle; newStyle.setFontSize(size); itemSelection_ApplyCharStyle(newStyle, customSelection, "FONT_SIZE"); - /*} - else - { - ParagraphStyle storyStyle; - storyStyle.charStyle().setFontSize(size); - if (storyStyle.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing) - { - storyStyle.setLineSpacing((size / 10.0) * (static_cast<double>(docPrefsData.typoPrefs.autoLineSpacing) / 100)); - } - else if (storyStyle.lineSpacingMode() == ParagraphStyle::FixedLineSpacing) - { - storyStyle.setLineSpacing(storyStyle.charStyle().font().height(size)); - } - else - { - storyStyle.setLineSpacing(docPrefsData.guidesPrefs.valueBaselineGrid-1); - } - itemSelection_ApplyParagraphStyle(storyStyle, customSelection); - }*/ } void ScribusDoc::itemSelection_ToggleBookMark(Selection *customSelection) @@ -9267,8 +8968,6 @@ for (uint aa = 0; aa < selectedItemCount; ++aa) { PageItem *currItem = itemSelection->itemAt(aa); -// int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame(); -// if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE)) int currItemTextCount = currItem->itemText.length(); if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable))) { @@ -9322,8 +9021,6 @@ for (uint aa = 0; aa < selectedItemCount; ++aa) { PageItem *currItem = itemSelection->itemAt(aa); -// int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame(); -// if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE)) int currItemTextCount = currItem->itemText.length(); if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable))) { @@ -9582,8 +9279,6 @@ PageItem *currItem = itemSelection->itemAt(aa); if (currItem->isTable() && appMode == modeEditTable) currItem = currItem->asTable()->activeCell().textFrame(); -// int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame(); -// if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE)) int currItemTextCount = currItem->itemText.length(); if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable))) { @@ -9677,7 +9372,6 @@ } } currItem->itemText.setDefaultStyle(dstyle); -// if (currItem->asPathText()) currItem->itemText.applyCharStyle(0, currItem->itemText.length(), newStyle); currItem->invalid = true; if (currItem->isNoteFrame()) @@ -9710,8 +9404,6 @@ for (uint aa = 0; aa < selectedItemCount; ++aa) { PageItem *currItem = itemSelection->itemAt(aa); - // int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame(); - // if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE)) int currItemTextCount = currItem->itemText.length(); if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable))) { @@ -9762,7 +9454,6 @@ undoManager->action(currItem, ist); } currItem->itemText.setDefaultStyle(dstyle); -// if (currItem->asPathText()) currItem->itemText.setCharStyle(0, currItem->itemText.length(), newStyle); if (currItem->isNoteFrame()) setNotesChanged(true); @@ -9794,8 +9485,6 @@ for (uint aa = 0; aa < selectedItemCount; ++aa) { PageItem *currItem = itemSelection->itemAt(aa); -// int currItemTextCount = currItem->lastInFrame() + 1 - currItem->firstInFrame(); -// if (currItemTextCount > 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE)) int currItemTextCount = currItem->itemText.length(); if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable))) { @@ -9891,31 +9580,7 @@ -/* -template<typename Arg, void (PageItem::*Fun)(Arg)> -void ScribusDoc::itemSelection_forall(Arg newVal) -{ - uint docSelectionCount=m_Selection->count(); - if (docSelectionCount != 0) - { - if (docSelectionCount > 1) - undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle, - newStyle.asString(), Um::IFont); - for (uint aa = 0; aa < docSelectionCount; ++aa) - { - PageItem *currItem = m_Selection->itemAt(aa); - currItem->Fun(newVal); - } - } - if (docSelectionCount > 1) - undoManager->commit(); - emit updateContents(); -} -*/ - - - /* CB Dont delete, backups void ScribusDoc::FlipImageH() { @@ -10123,34 +9788,17 @@ newMinX = qMin(minCanvasCoordinate.x(), minPos.x()); newMinY = qMin(minCanvasCoordinate.y(), minPos.y()); } - /*<< CB: comment out as avox is falling asleep and this is b0rken - // try to limit expansion of canvas to reasonable area: - - int columns = pageSets[currentPageLayout].Columns; - int rows = 1 + DocPages.count() / columns; - newMinX = qMax(newMinX, -pageWidth); - newMinY = qMax(newMinY, -pageHeight); - newMaxX = qMin(newMaxX, (bleeds.Left + pageWidth + bleeds.Right) * columns + pageWidth + scratch.Left + scratch.Right + GapHorizontal*(columns-1) ); - newMaxY = qMin(newMaxY, (bleeds.Top + pageHeight + bleeds.Bottom) * columns + pageHeight + scratch.Top + scratch.Bottom + GapVertical*(rows-1)); - >>*/ if ((newMaxX != maxCanvasCoordinate.x()) || (newMaxY != maxCanvasCoordinate.y()) || (newMinX != minCanvasCoordinate.x()) || (newMinY != minCanvasCoordinate.y())) { // //Save the old values for the emit, but update now to ensure we are all ready -// double oldMinX=minCanvasCoordinate.x(); -// double oldMinY=minCanvasCoordinate.y(); maxCanvasCoordinate = FPoint(newMaxX, newMaxY); minCanvasCoordinate = FPoint(newMinX, newMinY); regionsChanged()->update(QRectF()); //CB TODO Make a list of views we belong to and make this the doc's active view via an internal* -// if (ScCore->usingGUI()) -// { // // Why using a signal here ? much slower than a direct call -// emit canvasAdjusted(newMaxX - newMinX, newMaxY - newMinY, oldMinX - newMinX, oldMinY - newMinY); //FIXME: stop using m_View -// m_View->adjustCanvas(newMaxX - newMinX, newMaxY - newMinY, oldMinX - newMinX, oldMinY - newMinY); -// } } } @@ -10470,14 +10118,6 @@ m_ScMW->mainWindowProgressBar->reset(); QList<PageItem*> allItems; QStringList patterns = docPatterns.keys(); - -//#ifndef QT_NO_CONCURRENT -// int lowRes = 0; -// if (applyNewRes) -// lowRes = docPrefsData.itemToolPrefs.imageLowResType; -// QtConcurrent::blockingMap(DocItems, PicResMapped(applyNewRes, lowRes)); -// QtConcurrent::blockingMap(MasterItems, PicResMapped(applyNewRes, lowRes)); -//#else int cc = 0; for (int a = 0; a < DocItems.count(); ++a) { @@ -10612,7 +10252,6 @@ } allItems.clear(); } -//#endif for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it) { PageItem *currItem = it.value(); @@ -11116,9 +10755,7 @@ currItem->ContourLine.map(matrix); currItem->ContourLine.map(matrixAft); currItem->ContourLine.translate(-deltaX, -deltaY); -// currItem->Frame = false; currItem->ClipEdited = true; -// currItem->FrameType = 3; undoManager->setUndoEnabled(false); AdjustItemSize(currItem); undoManager->setUndoEnabled(true); @@ -11216,9 +10853,7 @@ currItem->ContourLine.map(comulatedMatrix); currItem->ContourLine.map(matrixAft); currItem->ContourLine.translate(-deltaX, -deltaY); -// currItem->Frame = false; currItem->ClipEdited = true; -// currItem->FrameType = 3; undoManager->setUndoEnabled(false); AdjustItemSize(currItem); undoManager->setUndoEnabled(true); @@ -11242,7 +10877,6 @@ m_Selection->connectItemToGUI(); } m_updateManager.setUpdatesEnabled(); - //view()->DrawNew(); regionsChanged()->update(QRectF()); changed(); } @@ -11860,7 +11494,6 @@ undoManager->action(Pages->at(0), is, currItem->getUPixmap()); } itemList->removeAll(currItem); -// undoManager->action(Pages->at(0), is, currItem->getUPixmap()); if (forceDeletion) delete currItem; } @@ -12028,8 +11661,6 @@ currItem->setStrokeGradient(newGradient); currItem->update(); } - /*if (selectedItemCount>1) - regionsChanged()->update(QRectF());*/ m_updateManager.setUpdatesEnabled(); changed(); //Teaser for jghali @@ -13450,7 +13081,6 @@ uint alignObjectsCount = AObjects.count(); QList<int> circleList; int circleListCounter=0; - //X QMap<double,uint> Xsorted; for (uint a = 0; a < alignObjectsCount; ++a) { @@ -13469,7 +13099,6 @@ maxX=itX.key(); ++itX; } - //Y QMap<double,uint> Ysorted; for (uint a = 0; a < alignObjectsCount; ++a) { @@ -13491,8 +13120,6 @@ itX = Xsorted.begin(); //first item is left most int itemIndex=itX.value(); //get our first item's index in the AObjects array -// bool found=false; -// double itXX=itX.key(); minY = std::numeric_limits<double>::max(); maxY = -std::numeric_limits<double>::max(); int nextItemIndex=itemIndex; @@ -13562,7 +13189,6 @@ uint alignObjectsCount = AObjects.count(); QList<int> circleList; int circleListCounter=0; - //X QMap<double,uint> Xsorted; for (uint a = 0; a < alignObjectsCount; ++a) { @@ -13581,7 +13207,6 @@ maxX=itX.key(); ++itX; } - //Y QMap<double,uint> Ysorted; for (uint a = 0; a < alignObjectsCount; ++a) { @@ -13603,8 +13228,6 @@ itX = Xsorted.begin(); //first item is left most int itemIndex=itX.value(); //get our first item's index in the AObjects array -// bool found=false; -// double itXX=itX.key(); minY = std::numeric_limits<double>::max(); maxY = -std::numeric_limits<double>::max(); int nextItemIndex=itemIndex; @@ -14299,7 +13922,6 @@ QTransform ma; ma.translate(currItem->xPos(), currItem->yPos()); ma.rotate(currItem->rotation()); -// double my = ma.m22() * currItem->height() + ma.m12() * currItem->width() + ma.dy(); double my = ma.m12() * currItem->width() + ma.dy(); getClosestGuides(0, my, &xout, &yout, &GxM, &GyM); if (GyM != -1) @@ -14320,7 +13942,6 @@ ma.translate(currItem->xPos(), currItem->yPos()); ma.rotate(currItem->rotation()); double mx = ma.m11() * currItem->width() + ma.dx(); -// double mx = ma.m11() * currItem->width() + ma.m21() * currItem->height() + ma.dx(); getClosestGuides(mx, 0, &xout, &yout, &GxM, &GyM); if (GxM != -1) currItem->moveBy(xout - mx + page->xOffset(), 0.0); @@ -14336,7 +13957,6 @@ bool ScribusDoc::ApplyGuides(double *x, double *y, bool elementSnap) { -// m_SnapCounter++; bool ret = false; double xout, yout; int pg = OnPage(*x, *y); @@ -14344,11 +13964,8 @@ return ret; ScPage* page = Pages->at(pg); int GxM, GyM; - - // if ((SnapGuides) && (m_SnapCounter > 1)) if ((SnapGuides && !elementSnap) || (SnapElement && elementSnap)) { -// m_SnapCounter = 0; if (!elementSnap) getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM, page); else @@ -14405,8 +14022,6 @@ ret = true; } } -// if (m_SnapCounter > 10) -// m_SnapCounter = 0; return ret; } @@ -14441,7 +14056,6 @@ if (currItem->locked()) return; QRectF oldR = currItem->getBoundingRect(); -// if ((Doc->RotMode != 0) && (m_MouseButtonPressed)) if (rotMode != 0) { QTransform ma; @@ -14491,7 +14105,6 @@ QRectF newR(currItem->getBoundingRect()); regionsChanged()->update(newR.united(oldR)); } - //emit SetAngle(currItem->rotation()); } @@ -14514,13 +14127,6 @@ QRectF oldR(currItem->getBoundingRect()); //Uncomment for stopping resize in any direction //and remove the height/width <0 tests in item sizing switch - /* - if (!currItem->asLine()) - { - newX = qMax(newX, 1); - newY = qMax(newY, 1); - } - */ UndoTransaction activeTransaction; if (UndoManager::undoEnabled()) { @@ -14539,7 +14145,6 @@ double dX = ma.m11() * (currItem->width() - newX) + ma.m21() * (currItem->height() - newY) + ma.dx(); double dY = ma.m22() * (currItem->height() - newY) + ma.m12() * (currItem->width() - newX) + ma.dy(); // #8541, #8761: "when resizing with ALT-arrow, the size values in the PP aren't updated" -// currItem->setWidthHeight(newX, newY, true); currItem->setWidthHeight(newX, newY); if ((rotMode != 0) && (fromMP) && (!isLoading()) && (appMode == modeNormal)) { @@ -14568,7 +14173,6 @@ t -= g; currItem->setRotation( atan2(t.y(), t.x()) * (180.0/M_PI)); currItem->setWidthHeight( sqrt(pow(t.x(), 2) + pow(t.y(), 2)), 1.0); - //currItem->setXYPos(currItem->xPos(), currItem->yPos()); } currItem->Clip.setPoints(4, -ph,-ph, static_cast<int>(currItem->width()+ph),-ph, static_cast<int>(currItem->width()+ph),static_cast<int>(currItem->height()+ph), @@ -14583,7 +14187,6 @@ if (currItem->FrameType != 0 && !currItem->asLine()) { currItem->updateClip(); -// currItem->updateGradientVectors(); } if (activeTransaction) @@ -14596,26 +14199,8 @@ if (DoUpdateClip) { // (JG) #5988 : break image position when resizing frame especially on undo - /*double nX=0.0, nY=0.0; - if (fromMP) - { - if (currItem->imageFlippedH()) - nX=-(currItem->width() - currItem->OldB2)/currItem->imageXScale(); - if (currItem->imageFlippedV()) - nY=-(currItem->height() - currItem->OldH2)/currItem->imageYScale(); - } - else - { - if (!currItem->imageFlippedH()) - nX=(currItem->width() - currItem->OldB2)/currItem->imageXScale(); - if (!currItem->imageFlippedV()) - nY=(currItem->height() - currItem->OldH2)/currItem->imageYScale(); - } - if (nX!=0.0 || nY!=0.0) - currItem->moveImageInFrame(dX,dY);*/ currItem->updateClip(); } -// currItem->updateGradientVectors(); if (!loading) { QRectF newR(currItem->getBoundingRect()); @@ -14671,7 +14256,6 @@ regionsChanged()->update(oldR); regionsChanged()->update(newR); } -// updateContents(newR.unite(oldR)); } else { @@ -14793,10 +14377,7 @@ double gx, gy, gw, gh; itemSelection->setGroupRect(); itemSelection->getGroupRect(&gx, &gy, &gw, &gh); - //QPoint in(qRound(gx*Scale), qRound(gy*Scale)); - //in -= QPoint(qRound(Doc->minCanvasCoordinate.x() * Scale), qRound(Doc->minCanvasCoordinate.y() * Scale)); - //QPoint out = in;//contentsToViewport(in); - QRectF OldRect = QRectF(gx, gy, gw, gh); //out.x(), out.y(), qRound(gw*Scale), qRound(gh*Scale)); + QRectF OldRect = QRectF(gx, gy, gw, gh); QList<PageItem*> weldL; for (uint a = 0; a < selectedItemCount; ++a) { @@ -14817,7 +14398,6 @@ GroupOnPage(currItem); } QPoint in2(qRound(gx*Scale), qRound(gy*Scale)); - //in2 -= QPoint(qRound(Doc->minCanvasCoordinate.x() * Scale), qRound(Doc->minCanvasCoordinate.y() * Scale)); OldRect = OldRect.united(QRectF(in2.x()/*+contentsX()*/, in2.y()/*+contentsY()*/, qRound(gw*Scale), qRound(gh*Scale))); //FIXME:av regionsChanged()->update(OldRect.adjusted(-10, -10, 20, 20)); } @@ -14856,8 +14436,6 @@ ma.translate(RCenter.x(), RCenter.y()); ma.scale(1, 1); ma.rotate(angle); -// gxS -= minCanvasCoordinate.x(); -// gyS -= minCanvasCoordinate.y(); QRect oldR = QRect(static_cast<int>(gxS*sc-5), static_cast<int>(gyS*sc-5), static_cast<int>(gwS*sc+10), static_cast<int>(ghS*sc+10)); FPoint n; for (int a = 0; a < itemSelection->count(); ++a) @@ -14872,8 +14450,6 @@ GroupOnPage(currItem); itemSelection->setGroupRect(); itemSelection->getGroupRect(&gxS, &gyS, &gwS, &ghS); -// gxS -= minCanvasCoordinate.x(); -// gyS -= minCanvasCoordinate.y(); regionsChanged()->update(QRectF(gxS-5, gyS-5, gwS+10, ghS+10).united(oldR)); } @@ -14886,14 +14462,12 @@ return; PageItem *bb; - double gx, gy, gh, gw; //, x, y; + double gx, gy, gh, gw; int aa; double sc = 1; //FIXME:av Scale; int drm = rotMode; rotMode = 0; itemSelection->getGroupRect(&gx, &gy, &gw, &gh); -// gx -= minCanvasCoordinate.x(); -// gy -= minCanvasCoordinate.y(); QRect oldR = QRect(static_cast<int>(gx*sc-5), static_cast<int>(gy*sc-5), static_cast<int>(gw*sc+10), static_cast<int>(gh*sc+10)); itemSelection->getGroupRect(&gx, &gy, &gw, &gh); double origGW = gw; @@ -15000,9 +14574,6 @@ ma3.translate(gx, gy); ma3.scale(scx, scy); FPoint n(gx-oldPos.x(), gy-oldPos.y()); - // x = ma3.m11() * n.x() + ma3.m21() * n.y() + ma3.dx(); - // y = ma3.m22() * n.y() + ma3.m12() * n.x() + ma3.dy(); - // MoveItem(gx-x, gy-y, bb); bb->setXYPos(b1.x()+gx, b1.y()+gy); if (oldRot != 0) { @@ -15024,10 +14595,8 @@ } if (scaleText) { -// bb->setFontSize(qMax(qRound(bb->fontSize()*((scx+scy)/2)), 1)); if (bb->itemText.length() != 0) { -// bb->setLineSpacing(((bb->fontSize() / 10.0) * static_cast<double>(Doc->typographicSettings.autoLineSpacing) / 100)); for (aa = 0; aa < bb->itemText.length(); ++aa) { CharStyle fsStyle; @@ -15089,8 +14658,6 @@ break; } } -// gx -= minCanvasCoordinate.x(); -// gy -= minCanvasCoordinate.y(); updateManager()->setUpdatesEnabled(); regionsChanged()->update(QRectF(gx-5, gy-5, gw+10, gh+10).united(oldR)); itemSelection->setGroupRect(); @@ -15300,8 +14867,6 @@ { currItem = selectedItems.at(c); currItem->setLocked(lock); - //if (m_ScMW && ScCore->usingGUI()) - // m_ScMW->scrActions["itemLock"]->setChecked(lock); if (selectedItemCount <= Um::ItemsInvolvedLimit) tooltip += "\t" + currItem->getUName() + "\n"; } @@ -15333,8 +14898,10 @@ } double gx = minx; double gy = miny; - double gw = maxx - minx; - double gh = maxy - miny; + double gw = ceil((maxx - minx)+0.01); + double gh = ceil((maxy - miny)+0.01); + qDebug()<<gw<<" c"<<gh; + qDebug()<<maxx - minx<< " no"<<maxy - miny; undoManager->setUndoEnabled(false); int z = itemAdd(PageItem::Group, PageItem::Rectangle, gx, gy, gw, gh, 0, CommonStrings::None, CommonStrings::None, true); PageItem *groupItem = Items->takeAt(z); @@ -15453,17 +15020,6 @@ if (activeTransaction) activeTransaction.commit(); - -/* QMap<int, QList<PageItem*> >::iterator groupIt; - for (it = toDelete.begin(); it != toDelete.end(); ++it) - { -// PageItem* groupItem = it.key(); - int groupId = it.value(); - groupIt = groupObjects.find(groupId); - if (groupIt == groupObjects.end()) - continue; - QList<PageItem*> groupItems = groupIt.value(); - }*/ double x, y, w, h; itemSelection->connectItemToGUI(); itemSelection->getGroupRect(&x, &y, &w, &h); @@ -15773,7 +15329,6 @@ currItem->PoLine.setMarker(); currItem->PoLine.putPoints(currItem->PoLine.size(), bb->PoLine.size(), bb->PoLine); } -// currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments); AdjustItemSize(currItem); currItem->ContourLine = currItem->PoLine.copy(); undoManager->setUndoEnabled(true); @@ -15911,11 +15466,8 @@ void ScribusDoc::itemSelection_convertItemsToSymbol(QString& patternName) { uint docSelectionCount = m_Selection->count(); - /* #11365 will be fixed once undo here is fixed - UndoTransaction activeTransaction; - if (UndoManager::undoEnabled()) // && !m_itemCreationTransaction) - activeTransaction = undoManager->beginTransaction(); - */ + /* #11365 will be fixed once undo here is fixed*/ + PageItem* currItem; Selection itemSelection(this, false); itemSelection.copy(*m_Selection, false); @@ -16019,22 +15571,8 @@ currItem->parentGroup()->groupItemList.replace(d, groupItem); else Items->replace(d, groupItem); - /* #11365 will be fixed once undo here is fixed - if (UndoManager::undoEnabled()) - { - ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >("Convert Item"); - is->set("CONVERT_ITEM_TO_SYMBOL", "convert_item_to_symbol"); - is->setItem(qMakePair(currItem, groupItem)); - is->setDescription(patternName); - //Undo target rests with the Page for object specific undo - UndoObject *target = Pages->at(0); - if (groupItem->OwnPage > -1) - target = Pages->at(groupItem->OwnPage); - undoManager->action(target, is); - }*/ + /* #11365 will be fixed once undo here is fixed*/ m_Selection->delaySignalsOff(); - /*if (activeTransaction) - activeTransaction.commit();*/ } //CB-->Doc @@ -16347,7 +15885,6 @@ item->setRedrawBounding(); } -// bool viewToRecalcPictureRes = (docPrefsData.itemToolPrefs.imageLowResType==oldPrefsData.itemToolPrefs.imageLowResType); autoSaveTimer->stop(); if (docPrefsData.docSetupPrefs.AutoSave) @@ -16433,7 +15970,6 @@ m_ScMW->mainWindowProgressBar->reset(); } } -// PrefsManager* prefsManager=PrefsManager::instance(); QStringList uf(UsedFonts.keys()); QMap<QString,int>::Iterator it3; @@ -16443,9 +15979,6 @@ for (it3a = uf.begin(); it3a != it3aend; ++it3a) AddFont(*it3a); -// currDoc->documentInfo = docInfos->getDocInfo(); -// currDoc->sections = tabDocSections->getNewSections(); - uint itemCount=Items->count(); for (uint b=0; b<itemCount; ++b) { @@ -16952,7 +16485,6 @@ else count++; m_counters.replace(level, count); - //m_nums.insert(level, num); QString result; for (int i=0; i <= level; ++i) { @@ -17059,11 +16591,6 @@ { BulNumMark* bnMark = new BulNumMark; item->itemText.insertMark(bnMark,pos); -// hl = item->itemText.item(pos); -// hl->applyCharStyle(item->itemText.paragraphStyle(pos).charStyle()); -// hl->setEffects(ScStyle_Default); -// const StyleContext* cStyleContext = item->itemText.paragraphStyle(pos).charStyleContext(); -// hl->setContext(cStyleContext); CharStyle emptyCS; item->itemText.setCharStyle(pos, 1, emptyCS); } @@ -17143,7 +16670,6 @@ TextNote *ScribusDoc::newNote(NotesStyle* NS) { -// if (newNote == NULL) TextNote* newNote = new TextNote(NS); m_docNotesList.append(newNote); setNotesChanged(true); @@ -17360,7 +16886,6 @@ while (MPos > -1) { ims->insertItemPos.append(QPair<void*, int>((void*) item, MPos - num)); //-num as while undo text will be shorter (without marks) - //++num; MPos = findMarkCPos(mrk, item, MPos+1); } item = findMarkItem(mrk, itemIndex); Index: scribus/scribusdoc.h =================================================================== --- scribus/scribusdoc.h (revision 20560) +++ scribus/scribusdoc.h (working copy) @@ -754,7 +754,7 @@ /** * @brief Sets up the ScText defaults from the document */ - //void setScTextDefaultsFromDoc(ScText *); + /** * @brief Copies a normal page to be a master pages */ @@ -832,7 +832,6 @@ * @brief Load images into an image frame, moved from the view * @retval Return false on failure */ -// bool LoadPict(QString fn, int ItNr, bool reload = false, bool showMsg = false); /** * * @param fn |
|
IMO out commented code that does not carry an explanation on why it has been left there (with name of the author and date) should be removed when it's older than a few weeks. for the archeologists, we have a revision system in place... even if IDE allow to hide it, often those snippets of code make life harder for new contributor to grasp what's going on. and, on the psychological side, it does not enforce an image of good quality... i can imagine that a few potential contributors have been scared away by them (it's not the only factor of course: KLOC methods are probably the biggest offender, there!) |
|
Thank you very much as.bahanta for the patch! Committed in r20692 by Craig Closing! |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-11-19 06:40 | as.bahanta | New Issue | |
2015-11-19 06:40 | as.bahanta | File Added: CleanUp_Scribusdoc_Scribus.diff | |
2015-11-19 07:07 | as.bahanta | Tag Attached: HOST-Oman | |
2015-11-19 23:27 | Kunda | Sticky Issue | No => Yes |
2015-11-20 08:36 | ale | Note Added: 0037555 | |
2016-01-17 15:31 | cbradney | Status | new => resolved |
2016-01-17 15:31 | cbradney | Fixed in Version | => 1.5.1svn |
2016-01-17 15:31 | cbradney | Resolution | open => fixed |
2016-01-17 15:31 | cbradney | Assigned To | => cbradney |
2016-01-17 15:56 | jghali | Sticky Issue | Yes => No |
2016-01-18 13:36 | Kunda | Note Added: 0038238 | |
2016-01-18 13:36 | Kunda | Status | resolved => closed |