From scribus-commit at lists.scribus.net Sun Dec 5 12:02:02 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Sun, 05 Dec 2021 12:02:02 -0000 Subject: r24775 by craig - Update build files for Apple Silicon Message-ID: Author: craig Date: Sun Dec 5 12:02:01 2021 New Revision: 24775 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24775 Log: Update build files for Apple Silicon Modified: trunk/Scribus/CMakeLists.txt trunk/Scribus/CMakeLists_Apple.cmake Modified: trunk/Scribus/CMakeLists.txt URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24775&path=/trunk/Scribus/CMakeLists.txt ============================================================================== --- trunk/Scribus/CMakeLists.txt (original) +++ trunk/Scribus/CMakeLists.txt Sun Dec 5 12:02:01 2021 @@ -188,6 +188,12 @@ set(ARCH_ARM ON) endif() +string(REGEX MATCH "(arm64+)" _machine_arm "${MACHINE}") +if (_machine_arm) + message(STATUS "Found target arm64") + set(ARCH_ARM_64 ON) +endif() + # We need to pass -fPIC to lib2geom on amd64, mips, mipsel, and hppa. See: # http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3 and # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559133 @@ -198,6 +204,10 @@ if (APPLE) if ((CMAKE_SIZEOF_VOID_P EQUAL 8) AND (ARCH_ARM)) string(REGEX REPLACE ".*-darwin([0-9]+).*" "\\1" _apple_ver "${MACHINE}") + if (_apple_ver EQUAL "21") + message(STATUS "Found macOS Monterey Target: Apple, 64 bit, ARM") + set(APPLE_12_00_X ON CACHE BOOL "Found macOS Monterey Target: Apple, 64 bit, ARM") + endif() if (_apple_ver EQUAL "20") message(STATUS "Found macOS Big Sur Target: Apple, 64 bit, ARM") set(APPLE_11_00_X ON CACHE BOOL "Found macOS Big Sur Target: Apple, 64 bit, ARM") @@ -205,6 +215,10 @@ endif() if ((CMAKE_SIZEOF_VOID_P EQUAL 8) AND (ARCH_X86 OR ARCH_X86_64)) string(REGEX REPLACE ".*-darwin([0-9]+).*" "\\1" _apple_ver "${MACHINE}") + if (_apple_ver EQUAL "21") + message(STATUS "Found macOS Monterey Target: Apple, 64 bit, X86") + set(APPLE_12_00_X ON CACHE BOOL "Found macOS Monterey Target: Apple, 64 bit, X86") + endif() if (_apple_ver EQUAL "20") message(STATUS "Found macOS Big Sur Target: Apple, 64 bit, X86") set(APPLE_11_00_X ON CACHE BOOL "Found macOS Big Sur Target: Apple, 64 bit, X86") @@ -259,7 +273,7 @@ #convert any 64 bit build into generic 64 tag for below -if (ARCH_X86_64 OR ARCH_SPARC_64 OR ARCH_MIPS_64 OR ARCH_PPC_64) +if (ARCH_X86_64 OR ARCH_SPARC_64 OR ARCH_MIPS_64 OR ARCH_PPC_64 OR ARCH_ARM_64) set(ARCH64BIT ON) endif() Modified: trunk/Scribus/CMakeLists_Apple.cmake URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24775&path=/trunk/Scribus/CMakeLists_Apple.cmake ============================================================================== --- trunk/Scribus/CMakeLists_Apple.cmake (original) +++ trunk/Scribus/CMakeLists_Apple.cmake Sun Dec 5 12:02:01 2021 @@ -134,6 +134,13 @@ message(STATUS "Setting PPC Architecture for OSX Build/Bundle") set(CMAKE_OSX_ARCHITECTURES "ppc" ) set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc" ) + elseif(ARCH_ARM_64) + message(STATUS "Setting ARM64 Architecture for OSX Build/Bundle") + set(CMAKE_OSX_ARCHITECTURES "arm64" ) + set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "arm64" ) + if (WANT_OSX_SDK) + set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSXMINVER}") + endif() else() if (WANT_OSX_SDK) set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSXMINVER}") From scribus-commit at lists.scribus.net Sun Dec 5 12:03:28 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Sun, 05 Dec 2021 12:03:28 -0000 Subject: r24776 by craig - Update Apple bundle file setup Message-ID: Author: craig Date: Sun Dec 5 12:03:28 2021 New Revision: 24776 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24776 Log: Update Apple bundle file setup Bump about date Modified: trunk/Scribus/CMakeLists_Apple.cmake trunk/Scribus/scribus/ui/about.cpp Modified: trunk/Scribus/CMakeLists_Apple.cmake URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24776&path=/trunk/Scribus/CMakeLists_Apple.cmake ============================================================================== --- trunk/Scribus/CMakeLists_Apple.cmake (original) +++ trunk/Scribus/CMakeLists_Apple.cmake Sun Dec 5 12:03:28 2021 @@ -123,11 +123,20 @@ endif() # gcc/mac if(WANT_UNIVERSAL_BUNDLE) - message(STATUS "Setting Universal (PPC/i386) Architecture for OSX Build/Bundle") - set(CMAKE_OSX_ARCHITECTURES "ppc;i386" ) - set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc;i386" ) - if (WANT_OSX_SDK) - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.4") + if (WANT_PPC_I386_BUNDLE) + message(STATUS "Setting Universal (PPC/i386) Architecture for OSX Build/Bundle") + set(CMAKE_OSX_ARCHITECTURES "ppc;i386" ) + set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc;i386" ) + if (WANT_OSX_SDK) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.4") + endif() + else() + message(STATUS "Setting Universal (ARM/x64_64) Architecture for OSX Build/Bundle") + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" ) + set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "arm64;x86_64" ) + if (WANT_OSX_SDK) + set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") + endif() endif() else() if(ARCH_PPC OR ARCH_PPC_64) Modified: trunk/Scribus/scribus/ui/about.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24776&path=/trunk/Scribus/scribus/ui/about.cpp ============================================================================== --- trunk/Scribus/scribus/ui/about.cpp (original) +++ trunk/Scribus/scribus/ui/about.cpp Sun Dec 5 12:03:28 2021 @@ -99,7 +99,6 @@ aboutLayout->setSpacing(6); aboutLayout->setContentsMargins(9, 9, 9, 9); tabWidget2 = new QTabWidget( this ); -// tabWidget2->setMinimumSize( QSize( 438, 258 ) ); tab = new QWidget( tabWidget2 ); tabLayout1 = new QVBoxLayout( tab ); tabLayout1->setSpacing(6); @@ -127,8 +126,8 @@ buildID = new QLabel( tab ); buildID->setAlignment(Qt::AlignCenter); buildID->setTextInteractionFlags(Qt::TextSelectableByMouse); - QString BUILD_DAY = "24"; - QString BUILD_MONTH = CommonStrings::august; + QString BUILD_DAY = "5"; + QString BUILD_MONTH = CommonStrings::december; QString BUILD_YEAR = "2021"; QString BUILD_TIME = ""; QString BUILD_TZ = ""; From scribus-commit at lists.scribus.net Tue Dec 7 22:40:23 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Tue, 07 Dec 2021 22:40:23 -0000 Subject: r24777 by jghali - #16697: Avoid modifying container while iterating it Message-ID: Author: jghali Date: Tue Dec 7 22:40:23 2021 New Revision: 24777 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24777 Log: #16697: Avoid modifying container while iterating it Modified: trunk/Scribus/scribus/langmgr.cpp Modified: trunk/Scribus/scribus/langmgr.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24777&path=/trunk/Scribus/scribus/langmgr.cpp ============================================================================== --- trunk/Scribus/scribus/langmgr.cpp (original) +++ trunk/Scribus/scribus/langmgr.cpp Tue Dec 7 22:40:23 2021 @@ -20,6 +20,7 @@ ***************************************************************************/ #include + #include #include #include @@ -1030,16 +1031,14 @@ QDir dictLocation(dictionaryPaths.at(i)); QStringList dictFilters("*.dic"); QStringList dictList(dictLocation.entryList(dictFilters, QDir::Files, QDir::Name)); - dictList.replaceInStrings(".dic",""); + dictList.replaceInStrings(".dic", ""); + dictList.removeDuplicates(); //Ensure we have aff+dic file pairs, remove any hyphenation dictionaries from the list for (const QString& dictName : qAsConst(dictList)) { if (!QFile::exists(dictionaryPaths.at(i) + dictName + ".aff")) - { - dictList.removeAll(dictName); continue; - } if (dictionaryMap.contains(dictName)) continue; From scribus-commit at lists.scribus.net Tue Dec 7 22:41:36 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Tue, 07 Dec 2021 22:41:36 -0000 Subject: r24778 by jghali - Code style fixes Message-ID: Author: jghali Date: Tue Dec 7 22:41:36 2021 New Revision: 24778 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24778 Log: Code style fixes Modified: trunk/Scribus/scribus/langmgr.cpp trunk/Scribus/scribus/pdflib_core.cpp Modified: trunk/Scribus/scribus/langmgr.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24778&path=/trunk/Scribus/scribus/langmgr.cpp ============================================================================== --- trunk/Scribus/scribus/langmgr.cpp (original) +++ trunk/Scribus/scribus/langmgr.cpp Tue Dec 7 22:41:36 2021 @@ -706,7 +706,7 @@ void LanguageManager::generateInstalledSpellLangList() { QStringList dictionaryPaths; - bool dictPathFound=findSpellingDictionaries(dictionaryPaths); + bool dictPathFound = findSpellingDictionaries(dictionaryPaths); if (!dictPathFound) { qDebug()<<"No preinstalled spelling dictionaries or paths found"; @@ -753,7 +753,7 @@ // qDebug()<<"Trying to find:"< 5) { @@ -938,7 +938,7 @@ i = langTableIndex(langAbbrev); } } - if (i !=-1) + if (i != -1) return m_langTable[i].m_transAvailable; return false; } @@ -949,9 +949,9 @@ for (int i = 0; i < m_langTable.size(); ++i) { if (getTranslated) - sl< &dictionaryMap) { - for (int i = 0; i::iterator it = dictionaryMap.begin(); while (it != dictionaryMap.end()) @@ -1093,40 +1094,40 @@ bool LanguageManager::findHyphDictionaries(QStringList& sl) { - sl=ScPaths::instance().hyphDirs(); + sl = ScPaths::instance().hyphDirs(); return sl.count() != 0; } void LanguageManager::findHyphDictionarySets(QStringList& dictionaryPaths, QMap& dictionaryMap) { - for (int i = 0; i 2) { QString shortAbbrev(LanguageManager::getShortAbbrevFromAbbrev(dictName)); - dictionaryMap.insert(shortAbbrev, dictionaryPaths.at(i)+dn+".dic"); + dictionaryMap.insert(shortAbbrev, dictionaryPaths.at(i) + dn + ".dic"); } } } @@ -1147,4 +1148,3 @@ } return QString(); } - Modified: trunk/Scribus/scribus/pdflib_core.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24778&path=/trunk/Scribus/scribus/pdflib_core.cpp ============================================================================== --- trunk/Scribus/scribus/pdflib_core.cpp (original) +++ trunk/Scribus/scribus/pdflib_core.cpp Tue Dec 7 22:41:36 2021 @@ -3523,7 +3523,7 @@ QString docDate = tr("Date:") + " " + d.toString(Qt::TextDate); PutPage("q\n"); PutPage("1 0 0 1 " + FToStr(maxBoxX / 2.0 + 20.0) + " " + FToStr(startY) + " cm\n"); - painter2.addText( QPointF(0.0,0.0), infoFont, docDate ); + painter2.addText( QPointF(0.0, 0.0), infoFont, docDate ); textPath.fromQPainterPath(painter2); PutPage(SetClipPathArray(&textPath, true)); PutPage("h\nf*\n"); From scribus-commit at lists.scribus.net Wed Dec 15 23:22:23 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Wed, 15 Dec 2021 23:22:23 -0000 Subject: r24779 by jghali - Fix table cell style not being applied to all selected cells in table edit mode Message-ID: Author: jghali Date: Wed Dec 15 23:22:23 2021 New Revision: 24779 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24779 Log: Fix table cell style not being applied to all selected cells in table edit mode Modified: trunk/Scribus/scribus/ui/propertiespalette_table.cpp Modified: trunk/Scribus/scribus/ui/propertiespalette_table.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24779&path=/trunk/Scribus/scribus/ui/propertiespalette_table.cpp ============================================================================== --- trunk/Scribus/scribus/ui/propertiespalette_table.cpp (original) +++ trunk/Scribus/scribus/ui/propertiespalette_table.cpp Wed Dec 15 23:22:23 2021 @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "appmodehelper.h" @@ -218,9 +219,35 @@ { if (!m_item || !m_item->isTable()) return; - m_doc->dontResize = true; - m_item->asTable()->activeCell().setStyle(name); - m_doc->dontResize = true; + QScopedValueRollback dontResizeRb(m_doc->dontResize, true); + + PageItem_Table* table = m_item->asTable(); + if (m_doc->appMode != modeEditTable) + { + for (int row = 0; row < table->rows(); ++row) + { + int colSpan = 0; + for (int col = 0; col < table->columns(); col += colSpan) + { + TableCell currentCell = table->cellAt(row, col); + if (row == currentCell.row()) + currentCell.setStyle(name); + colSpan = currentCell.columnSpan(); + } + } + } + else + { + QSet cells = table->selectedCells(); + if (cells.isEmpty()) + cells.insert(table->activeCell()); + for (auto cellIter = cells.begin(); cellIter != cells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + currentCell.setStyle(name); + } + } + m_item->asTable()->update(); showCellStyle(name); } @@ -593,9 +620,35 @@ { if (!m_item || !m_item->isTable()) return; - m_doc->dontResize = true; + QScopedValueRollback dontResizeRb(m_doc->dontResize, true); + PageItem_Table* table = m_item->asTable(); - table->activeCell().unsetDirectFormatting(); + if (m_doc->appMode != modeEditTable) + { + for (int row = 0; row < table->rows(); ++row) + { + int colSpan = 0; + for (int col = 0; col < table->columns(); col += colSpan) + { + TableCell currentCell = table->cellAt(row, col); + if (row == currentCell.row()) + currentCell.unsetDirectFormatting(); + colSpan = currentCell.columnSpan(); + } + } + } + else + { + QSet cells = table->selectedCells(); + if (cells.isEmpty()) + cells.insert(table->activeCell()); + for (auto cellIter = cells.begin(); cellIter != cells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + currentCell.unsetDirectFormatting(); + } + } + table->adjustTable(); table->update(); } @@ -604,11 +657,10 @@ { if (!m_doc || !m_item || !m_item->isTable()) return; + QScopedValueRollback dontResizeRb(m_doc->dontResize, true); PageItem_Table* table = m_item->asTable(); TableSideSelector::Sides selectedSides = sideSelector->selection(); - - m_doc->dontResize = true; if (m_doc->appMode != modeEditTable) { if (selectedSides & TableSideSelector::Left) From scribus-commit at lists.scribus.net Wed Dec 15 23:23:56 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Wed, 15 Dec 2021 23:23:56 -0000 Subject: r24780 by jghali - Small performance optimization Message-ID: Author: jghali Date: Wed Dec 15 23:23:55 2021 New Revision: 24780 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24780 Log: Small performance optimization Modified: trunk/Scribus/scribus/util_text.cpp Modified: trunk/Scribus/scribus/util_text.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24780&path=/trunk/Scribus/scribus/util_text.cpp ============================================================================== --- trunk/Scribus/scribus/util_text.cpp (original) +++ trunk/Scribus/scribus/util_text.cpp Wed Dec 15 23:23:55 2021 @@ -28,10 +28,11 @@ //qDebug() << QString("looking up %1/ %2").arg(parStyle.name()).arg(parStyle.alignment()); if (named) { - for (int i=0; i < doc->paragraphStyles().count(); ++i) + const auto& paragraphStyles = doc->paragraphStyles(); + for (int i=0; i < paragraphStyles.count(); ++i) { //qDebug() << QString("%1 %2").arg(i).arg(doc->paragraphStyles()[i].name()); - if (parStyle.name() == doc->paragraphStyles()[i].name()) { + if (parStyle.name() == paragraphStyles[i].name()) { return i; } } From scribus-commit at lists.scribus.net Sun Dec 26 00:16:23 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Sun, 26 Dec 2021 00:16:23 -0000 Subject: r24781 by jghali - Code cleanup Message-ID: Author: jghali Date: Sun Dec 26 00:16:22 2021 New Revision: 24781 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24781 Log: Code cleanup Modified: trunk/Scribus/scribus/ui/pdfversionmodel.cpp trunk/Scribus/scribus/ui/pdfversionmodel.h Modified: trunk/Scribus/scribus/ui/pdfversionmodel.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24781&path=/trunk/Scribus/scribus/ui/pdfversionmodel.cpp ============================================================================== --- trunk/Scribus/scribus/ui/pdfversionmodel.cpp (original) +++ trunk/Scribus/scribus/ui/pdfversionmodel.cpp Sun Dec 26 00:16:22 2021 @@ -17,11 +17,6 @@ m_enabledVec << true << true << true << true << false << false << false; } -void PdfVersionModel::clear() -{ - qDebug() << "PdfVersionModel: this model cannot be cleared"; -} - int PdfVersionModel::columnCount(const QModelIndex &/*parent*/) const { return 1; @@ -32,7 +27,7 @@ if (!index.isValid()) return QVariant(); - bool* pEnabled = static_cast(index.internalPointer()); + const bool* pEnabled = static_cast(index.internalPointer()); if (!pEnabled) return QVariant(); @@ -75,7 +70,7 @@ if (!hasIndex(row, column, parent)) return QModelIndex(); - bool* pEnabled = static_cast(parent.internalPointer()); + const bool* pEnabled = static_cast(parent.internalPointer()); if (pEnabled) return QModelIndex(); @@ -91,7 +86,7 @@ return QModelIndex(); } -bool PdfVersionModel::removeRow(int row, const QModelIndex& parent) +bool PdfVersionModel::removeRow(int /*row*/, const QModelIndex& /*parent*/) { qDebug() << "PdfVersionModel: this model cannot have rows removed"; return false; @@ -108,7 +103,7 @@ if (m_enabledVec.count() == 0) return 0; - bool* pEnabled = static_cast(parent.internalPointer()); + const bool* pEnabled = static_cast(parent.internalPointer()); if (pEnabled) return 0; Modified: trunk/Scribus/scribus/ui/pdfversionmodel.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24781&path=/trunk/Scribus/scribus/ui/pdfversionmodel.h ============================================================================== --- trunk/Scribus/scribus/ui/pdfversionmodel.h (original) +++ trunk/Scribus/scribus/ui/pdfversionmodel.h Sun Dec 26 00:16:22 2021 @@ -33,38 +33,35 @@ ItemPDFX_4 = 6 }; - //! Remove all colors from list; - void clear(); - //! Reimplement QAbstractItemModel columnCount() - int columnCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; //! Reimplement QAbstractItemModel data() - QVariant data(const QModelIndex &index, int role) const; + QVariant data(const QModelIndex &index, int role) const override; //! Reimplement QAbstractItemModel flags() - Qt::ItemFlags flags(const QModelIndex &index) const; + Qt::ItemFlags flags(const QModelIndex &index) const override; //! Reimplement QAbstractItemModel index() - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; //! Reimplement QAbstractItemModel parent() - QModelIndex parent(const QModelIndex &child) const; + QModelIndex parent(const QModelIndex &child) const override; //! Reimplement QAbstractItemModel removeRow() bool removeRow(int row, const QModelIndex& parent = QModelIndex()); //! Reimplement QAbstractItemModel removeRowz() - bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()); + bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; //! Reimplement QAbstractItemModel rowCount() - int rowCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; //! Allow or disallow no font embedding mode void setPdfXEnabled(bool enabled); protected: - //! The color list + //! The enabled/disabled flags QVector m_enabledVec; }; From scribus-commit at lists.scribus.net Sun Dec 26 17:34:08 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Sun, 26 Dec 2021 17:34:08 -0000 Subject: r24782 by jghali - Allow table and cell styles to be applied from style manager Message-ID: Author: jghali Date: Sun Dec 26 17:34:08 2021 New Revision: 24782 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24782 Log: Allow table and cell styles to be applied from style manager Implement undo/redo for a few table/cell actions Modified: trunk/Scribus/scribus/pageitem_table.cpp trunk/Scribus/scribus/pageitem_table.h trunk/Scribus/scribus/scribusdoc.cpp trunk/Scribus/scribus/scribusdoc.h trunk/Scribus/scribus/scribusstructs.h trunk/Scribus/scribus/tablecell.h trunk/Scribus/scribus/ui/propertiespalette_table.cpp trunk/Scribus/scribus/ui/propertiespalette_table.h trunk/Scribus/scribus/ui/smcellstyle.cpp trunk/Scribus/scribus/ui/smtablestyle.cpp trunk/Scribus/scribus/ui/tablesideselector.cpp trunk/Scribus/scribus/ui/tablesideselector.h trunk/Scribus/scribus/undomanager.cpp trunk/Scribus/scribus/undomanager.h Modified: trunk/Scribus/scribus/pageitem_table.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/pageitem_table.cpp ============================================================================== --- trunk/Scribus/scribus/pageitem_table.cpp (original) +++ trunk/Scribus/scribus/pageitem_table.cpp Sun Dec 26 17:34:08 2021 @@ -29,6 +29,8 @@ #include "styles/tablestyle.h" #include "tablehandle.h" #include "tableutils.h" +#include "undomanager.h" +#include "undostate.h" #include "pageitem_table.h" @@ -1014,6 +1016,25 @@ std::upper_bound(m_columnPositions.begin(), m_columnPositions.end(), gridPoint.x()) - m_columnPositions.begin() - 1); } +QSet PageItem_Table::cells() const +{ + QSet tableCells; + + for (int row = 0; row < m_rows; ++row) + { + int colSpan = 0; + for (int col = 0; col < m_columns; col += colSpan) + { + TableCell currentCell = cellAt(row, col); + if (row == currentCell.row()) + tableCells.insert(currentCell); + colSpan = currentCell.columnSpan(); + } + } + + return tableCells; +} + void PageItem_Table::moveLeft() { if (m_activeCell.column() < 1) @@ -1151,12 +1172,29 @@ void PageItem_Table::setFillColor(const QString& color) { + if (UndoManager::undoEnabled()) + { + auto *ss = new SimpleState(Um::TableFillColor, QString(), Um::ITable); + ss->set("SET_TABLE_FILLCOLOR"); + ss->set("OLD_COLOR", m_style.fillColor()); + ss->set("NEW_COLOR", color); + undoManager->action(this, ss); + } + m_style.setFillColor(color); emit changed(); } void PageItem_Table::unsetFillColor() { + if (UndoManager::undoEnabled()) + { + auto *ss = new SimpleState(Um::TableFillColorRst, QString(), Um::ITable); + ss->set("UNSET_TABLE_FILLCOLOR"); + ss->set("OLD_COLOR", m_style.fillColor()); + undoManager->action(this, ss); + } + m_style.resetFillColor(); emit changed(); } @@ -1168,12 +1206,29 @@ void PageItem_Table::setFillShade(const double& shade) { + if (UndoManager::undoEnabled()) + { + auto *ss = new SimpleState(Um::TableFillShade, QString(), Um::ITable); + ss->set("SET_TABLE_FILLSHADE"); + ss->set("OLD_SHADE", m_style.fillShade()); + ss->set("NEW_SHADE", shade); + undoManager->action(this, ss); + } + m_style.setFillShade(shade); emit changed(); } void PageItem_Table::unsetFillShade() { + if (UndoManager::undoEnabled()) + { + auto *ss = new SimpleState(Um::TableFillShadeRst, QString(), Um::ITable); + ss->set("UNSET_TABLE_FILLSHADE"); + ss->set("OLD_SHADE", m_style.fillShade()); + undoManager->action(this, ss); + } + m_style.resetFillShade(); emit changed(); } @@ -1185,6 +1240,17 @@ void PageItem_Table::setLeftBorder(const TableBorder& border) { + if (UndoManager::undoEnabled()) + { + QPair oldNewBorders; + oldNewBorders.first = m_style.leftBorder(); + oldNewBorders.second = border; + auto *ss = new ScItemState< QPair >(Um::TableLeftBorder, QString(), Um::ITable); + ss->set("SET_TABLE_LEFTBORDER"); + ss->setItem(oldNewBorders); + undoManager->action(this, ss); + } + m_style.setLeftBorder(border); updateCells(0, 0, rows() - 1, 0); emit changed(); @@ -1192,6 +1258,14 @@ void PageItem_Table::unsetLeftBorder() { + if (UndoManager::undoEnabled()) + { + auto *ss = new ScItemState(Um::TableLeftBorderRst, QString(), Um::ITable); + ss->set("UNSET_TABLE_LEFTBORDER"); + ss->setItem(m_style.leftBorder()); + undoManager->action(this, ss); + } + m_style.resetLeftBorder(); updateCells(0, 0, rows() - 1, 0); emit changed(); @@ -1204,6 +1278,17 @@ void PageItem_Table::setRightBorder(const TableBorder& border) { + if (UndoManager::undoEnabled()) + { + QPair oldNewBorders; + oldNewBorders.first = m_style.rightBorder(); + oldNewBorders.second = border; + auto *ss = new ScItemState< QPair >(Um::TableRightBorder, QString(), Um::ITable); + ss->set("SET_TABLE_RIGHTBORDER"); + ss->setItem(oldNewBorders); + undoManager->action(this, ss); + } + m_style.setRightBorder(border); updateCells(0, columns() - 1, rows() - 1, columns() - 1); emit changed(); @@ -1211,6 +1296,14 @@ void PageItem_Table::unsetRightBorder() { + if (UndoManager::undoEnabled()) + { + auto *ss = new ScItemState(Um::TableLeftBorderRst, QString(), Um::ITable); + ss->set("UNSET_TABLE_RIGHTBORDER"); + ss->setItem(m_style.rightBorder()); + undoManager->action(this, ss); + } + m_style.resetRightBorder(); updateCells(0, columns() - 1, rows() - 1, columns() - 1); emit changed(); @@ -1223,6 +1316,17 @@ void PageItem_Table::setTopBorder(const TableBorder& border) { + if (UndoManager::undoEnabled()) + { + QPair oldNewBorders; + oldNewBorders.first = m_style.topBorder(); + oldNewBorders.second = border; + auto *ss = new ScItemState< QPair >(Um::TableTopBorder, QString(), Um::ITable); + ss->set("SET_TABLE_TOPBORDER"); + ss->setItem(oldNewBorders); + undoManager->action(this, ss); + } + m_style.setTopBorder(border); updateCells(0, 0, 0, columns() - 1); emit changed(); @@ -1230,6 +1334,14 @@ void PageItem_Table::unsetTopBorder() { + if (UndoManager::undoEnabled()) + { + auto *ss = new ScItemState(Um::TableTopBorderRst, QString(), Um::ITable); + ss->set("UNSET_TABLE_TOPBORDER"); + ss->setItem(m_style.topBorder()); + undoManager->action(this, ss); + } + m_style.resetTopBorder(); updateCells(0, 0, 0, columns() - 1); emit changed(); @@ -1242,6 +1354,17 @@ void PageItem_Table::setBottomBorder(const TableBorder& border) { + if (UndoManager::undoEnabled()) + { + QPair oldNewBorders; + oldNewBorders.first = m_style.bottomBorder(); + oldNewBorders.second = border; + auto *ss = new ScItemState< QPair >(Um::TableBottomBorder, QString(), Um::ITable); + ss->set("SET_TABLE_BOTTOMBORDER"); + ss->setItem(oldNewBorders); + undoManager->action(this, ss); + } + m_style.setBottomBorder(border); updateCells(rows() - 1, 0, rows() - 1, columns() - 1); emit changed(); @@ -1249,6 +1372,14 @@ void PageItem_Table::unsetBottomBorder() { + if (UndoManager::undoEnabled()) + { + auto *ss = new ScItemState(Um::TableBottomBorderRst, QString(), Um::ITable); + ss->set("UNSET_TABLE_BOTTOMBORDER"); + ss->setItem(m_style.bottomBorder()); + undoManager->action(this, ss); + } + m_style.resetBottomBorder(); updateCells(rows() - 1, 0, rows() - 1, columns() - 1); emit changed(); @@ -1259,8 +1390,228 @@ return m_style.bottomBorder(); } +void PageItem_Table::setBorders(const TableBorder& border, TableSides selectedSides) +{ + if (selectedSides == (int) TableSide::None) + return; + + UndoTransaction activeTransaction; + if (UndoManager::undoEnabled()) + { + activeTransaction = UndoManager::instance()->beginTransaction(getUName(), getUPixmap(), Um::TableBorders, QString(), Um::ITable); + auto borderTuple = std::make_tuple(m_style.leftBorder(), m_style.rightBorder(), m_style.bottomBorder(), m_style.topBorder(), border); + auto *ss = new ScItemState(Um::TableBorders, QString(), Um::ITable); + ss->set("SET_TABLE_BORDERS"); + ss->set("SIDES", (int) selectedSides); + ss->setItem(borderTuple); + undoManager->action(this, ss); + } + + if (selectedSides & TableSide::Left) + m_style.setLeftBorder(border); + if (selectedSides & TableSide::Right) + m_style.setRightBorder(border); + if (selectedSides & TableSide::Top) + m_style.setTopBorder(border); + if (selectedSides & TableSide::Bottom) + m_style.setBottomBorder(border); + + updateCells(); + adjustTable(); + + if (activeTransaction) + activeTransaction.commit(); + + emit changed(); +} + +void PageItem_Table::setCellBorders(const TableBorder& border, TableSides selectedSides) +{ + QSet tableCells; + + if (m_Doc->appMode != modeEditTable) + tableCells = this->cells(); + else + { + tableCells = this->selectedCells(); + if (tableCells.isEmpty()) + tableCells.insert(activeCell()); + } + + setCellBorders(tableCells, border, selectedSides); +} + +void PageItem_Table::setCellBorders(const QSet& cells, const TableBorder& border, TableSides selectedSides) +{ + if (selectedSides == (int) TableSide::None) + return; + + UndoTransaction activeTransaction; + if (UndoManager::undoEnabled()) + { + activeTransaction = UndoManager::instance()->beginTransaction(getUName(), getUPixmap(), Um::CellBorders, QString(), Um::ITable); + + QMap cellBorderMap; + for (auto cellIter = cells.begin(); cellIter != cells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + auto borderTuple = std::make_tuple(currentCell.leftBorder(), currentCell.rightBorder(), currentCell.bottomBorder(), currentCell.topBorder(), border); + cellBorderMap.insert(currentCell, borderTuple); + } + auto *ss = new ScItemState< QMap >(Um::CellBorders, QString(), Um::ITable); + ss->set("SET_CELL_BORDERS"); + ss->set("SIDES", (int) selectedSides); + ss->setItem(cellBorderMap); + undoManager->action(this, ss); + } + + for (auto cellIter = cells.begin(); cellIter != cells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + if (selectedSides & TableSide::Left) + currentCell.setLeftBorder(border); + if (selectedSides & TableSide::Right) + currentCell.setRightBorder(border); + if (selectedSides & TableSide::Top) + currentCell.setTopBorder(border); + if (selectedSides & TableSide::Bottom) + currentCell.setBottomBorder(border); + } + + adjustTable(); + + if (activeTransaction) + activeTransaction.commit(); +} + +void PageItem_Table::setCellFillColor(const QString& fillColor) +{ + QSet tableCells; + + if (m_Doc->appMode != modeEditTable) + tableCells = this->cells(); + else + { + tableCells = this->selectedCells(); + if (tableCells.isEmpty()) + tableCells.insert(activeCell()); + } + + if (UndoManager::undoEnabled()) + { + QMap > cellColorMap; + for (auto cellIter = tableCells.begin(); cellIter != tableCells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + QString oldColor = currentCell.fillColor(); + cellColorMap.insert(currentCell, qMakePair(oldColor, fillColor)); + } + auto *ss = new ScItemState< QMap > >(Um::CellFillColor, "", Um::ITable); + ss->set("SET_CELL_FILLCOLOR"); + ss->setItem(cellColorMap); + undoManager->action(this, ss); + } + + m_Doc->dontResize = true; + for (auto cellIter = tableCells.begin(); cellIter != tableCells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + currentCell.setFillColor(fillColor); + } + m_Doc->dontResize = false; + + emit changed(); +} + +void PageItem_Table::setCellFillShade(double fillShade) +{ + QSet tableCells; + + if (m_Doc->appMode != modeEditTable) + tableCells = this->cells(); + else + { + tableCells = this->selectedCells(); + if (tableCells.isEmpty()) + tableCells.insert(activeCell()); + } + + if (UndoManager::undoEnabled()) + { + QMap > cellShadeMap; + for (auto cellIter = tableCells.begin(); cellIter != tableCells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + double oldShade = currentCell.fillShade(); + cellShadeMap.insert(currentCell, qMakePair(oldShade, fillShade)); + } + auto *ss = new ScItemState< QMap > >(Um::CellFillShade, "", Um::ITable); + ss->set("SET_CELL_FILLSHADE"); + ss->setItem(cellShadeMap); + undoManager->action(this, ss); + } + + m_Doc->dontResize = true; + for (auto cellIter = tableCells.begin(); cellIter != tableCells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + currentCell.setFillShade(fillShade); + } + m_Doc->dontResize = false; + + emit changed(); +} + +void PageItem_Table::setCellStyle(const QString& cellStyle) +{ + QSet tableCells; + + if (m_Doc->appMode != modeEditTable) + tableCells = this->cells(); + else + { + tableCells = this->selectedCells(); + if (tableCells.isEmpty()) + tableCells.insert(activeCell()); + } + + if (UndoManager::undoEnabled()) + { + QMap > cellStyleMap; + for (auto cellIter = tableCells.begin(); cellIter != tableCells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + QString oldStyle = currentCell.styleName(); + cellStyleMap.insert(currentCell, qMakePair(oldStyle, cellStyle)); + } + auto *ss = new ScItemState< QMap > >(Um::CellStyle, "", Um::ITable); + ss->set("SET_CELL_STYLE"); + ss->setItem(cellStyleMap); + undoManager->action(this, ss); + } + + m_Doc->dontResize = true; + for (auto cellIter = tableCells.begin(); cellIter != tableCells.end(); cellIter++) + { + TableCell currentCell(*cellIter); + currentCell.setStyle(cellStyle); + } + m_Doc->dontResize = false; + + emit changed(); +} + void PageItem_Table::setStyle(const QString& style) { + if (UndoManager::undoEnabled()) + { + auto *ss = new SimpleState(Um::TableStyle, "", Um::ITable); + ss->set("SET_TABLE_STYLE"); + ss->set("OLD_STYLE", m_style.parent()); + ss->set("NEW_STYLE", style); + undoManager->action(this, ss); + } + doc()->dontResize = true; m_style.setParent(style); updateCells(); @@ -1270,6 +1621,15 @@ void PageItem_Table::unsetStyle() { + if (UndoManager::undoEnabled()) + { + auto *ss = new SimpleState(Um::ChangeFormula, "", Um::IChangeFormula); + ss->set("UNSET_TABLE_STYLE"); + ss->set("OLD_STYLE", m_style.parent()); + ss->set("NEW_STYLE", QString()); + undoManager->action(this, ss); + } + doc()->dontResize = true; m_style.setParent(""); updateCells(); @@ -1715,3 +2075,419 @@ Q_ASSERT(cell.row() == cellArea.row() && cell.column() == cellArea.column()); } } + +void PageItem_Table::restore(UndoState *state, bool isUndo) +{ + auto *simpleState = dynamic_cast(state); + if (!simpleState) + { + PageItem::restore(state, isUndo); + return; + } + + bool doUpdate = false; + if (simpleState->contains("SET_CELL_BORDERS")) + { + restoreCellBorders(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_CELL_FILLCOLOR")) + { + restoreCellFillColor(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_CELL_FILLSHADE")) + { + restoreCellFillShade(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_CELL_STYLE")) + { + restoreCellStyle(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_TABLE_FILLCOLOR")) + { + restoreTableFillColor(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_TABLE_FILLSHADE")) + { + restoreTableFillShade(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_TABLE_BORDERS")) + { + restoreTableBorders(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_TABLE_LEFTBORDER")) + { + restoreTableLeftBorder(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_TABLE_RIGHTBORDER")) + { + restoreTableRightBorder(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_TABLE_BOTTOMBORDER")) + { + restoreTableBottomBorder(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_TABLE_TOPBORDER")) + { + restoreTableTopBorder(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("SET_TABLE_STYLE")) + { + restoreTableStyle(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("UNSET_TABLE_FILLCOLOR")) + { + restoreTableFillColorReset(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("UNSET_TABLE_FILLSHADE")) + { + restoreTableFillShadeReset(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("UNSET_TABLE_LEFTBORDER")) + { + restoreTableLeftBorderReset(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("UNSET_TABLE_RIGHTBORDER")) + { + restoreTableRightBorderReset(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("UNSET_TABLE_BOTTOMBORDER")) + { + restoreTableBottomBorderReset(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("UNSET_TABLE_TOPBORDER")) + { + restoreTableTopBorderReset(simpleState, isUndo); + doUpdate = true; + } + else if (simpleState->contains("UNSET_TABLE_STYLE")) + { + restoreTableStyleReset(simpleState, isUndo); + doUpdate = true; + } + else + { + PageItem::restore(state, isUndo); + } + + if (doUpdate) + { + if (state->transactionCode == 0 || state->transactionCode == 2) + this->update(); + } +} + +void PageItem_Table::restoreCellBorders(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState > *>(state); + if (!itemState) + return; + + TableSides selectedSides; + selectedSides |= (TableSide) itemState->getInt("SIDES"); + + QMap cellBorderMap = itemState->getItem(); + if (isUndo) + { + for (auto iter = cellBorderMap.begin(); iter != cellBorderMap.end(); ++iter) + { + TableCell currentCell = iter.key(); + TableBorderTuple currentBorders = iter.value(); + currentCell.setLeftBorder( std::get<0>(currentBorders) ); + currentCell.setRightBorder( std::get<1>(currentBorders) ); + currentCell.setBottomBorder( std::get<2>(currentBorders) ); + currentCell.setTopBorder( std::get<3>(currentBorders) ); + } + } + else + { + for (auto iter = cellBorderMap.begin(); iter != cellBorderMap.end(); ++iter) + { + TableCell currentCell = iter.key(); + TableBorder newBorder = std::get<4>(iter.value()); + if (selectedSides & TableSide::Left) + currentCell.setLeftBorder(newBorder); + if (selectedSides & TableSide::Right) + currentCell.setRightBorder(newBorder); + if (selectedSides & TableSide::Bottom) + currentCell.setBottomBorder(newBorder); + if (selectedSides & TableSide::Top) + currentCell.setTopBorder(newBorder); + } + } + + adjustTable(); +} + +void PageItem_Table::restoreCellFillColor(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState > > *>(state); + if (!itemState) + return; + + QMap > cellColorMap = itemState->getItem(); + for (auto iter = cellColorMap.begin(); iter != cellColorMap.end(); ++iter) + { + TableCell currentCell = iter.key(); + QString restoredColor = isUndo ? iter.value().first : iter.value().second; + currentCell.setFillColor(restoredColor); + } +} + +void PageItem_Table::restoreCellFillShade(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState > > *>(state); + if (!itemState) + return; + + QMap > cellColorMap = itemState->getItem(); + for (auto iter = cellColorMap.begin(); iter != cellColorMap.end(); ++iter) + { + TableCell currentCell = iter.key(); + double restoredShade = isUndo ? iter.value().first : iter.value().second; + currentCell.setFillShade(restoredShade); + } +} + +void PageItem_Table::restoreCellStyle(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState > > *>(state); + if (!itemState) + return; + + QMap > cellStyleMap = itemState->getItem(); + for (auto iter = cellStyleMap.begin(); iter != cellStyleMap.end(); ++iter) + { + TableCell currentCell = iter.key(); + QString restoredStyle = isUndo ? iter.value().first : iter.value().second; + currentCell.setStyle(restoredStyle); + } +} + +void PageItem_Table::restoreTableFillColor(SimpleState *state, bool isUndo) +{ + QString restoredFillColor = state->get(isUndo ? "OLD_COLOR" : "NEW_COLOR"); + setFillColor(restoredFillColor); +} + +void PageItem_Table::restoreTableFillColorReset(SimpleState *state, bool isUndo) +{ + if (isUndo) + { + QString restoredFillColor = state->get("OLD_COLOR"); + setFillColor(restoredFillColor); + } + else + { + unsetFillColor(); + } +} + +void PageItem_Table::restoreTableFillShade(SimpleState *state, bool isUndo) +{ + double restoredFillShade = state->getDouble(isUndo ? "OLD_SHADE" : "NEW_SHADE"); + setFillShade(restoredFillShade); +} + +void PageItem_Table::restoreTableFillShadeReset(SimpleState *state, bool isUndo) +{ + if (isUndo) + { + double restoredFillShade = state->getDouble("OLD_SHADE"); + setFillShade(restoredFillShade); + } + else + { + unsetFillShade(); + } +} + +void PageItem_Table::restoreTableBorders(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState *>(state); + if (!itemState) + return; + + TableSides selectedSides; + selectedSides |= (TableSide) itemState->getInt("SIDES"); + + TableBorderTuple borderTuple = itemState->getItem(); + if (isUndo) + { + m_style.setLeftBorder( std::get<0>(borderTuple) ); + m_style.setRightBorder( std::get<1>(borderTuple) ); + m_style.setBottomBorder( std::get<2>(borderTuple) ); + m_style.setTopBorder( std::get<3>(borderTuple) ); + } + else + { + TableBorder newBorder = std::get<4>(borderTuple); + if (selectedSides & TableSide::Left) + m_style.setLeftBorder(newBorder); + if (selectedSides & TableSide::Right) + m_style.setRightBorder(newBorder); + if (selectedSides & TableSide::Bottom) + m_style.setBottomBorder(newBorder); + if (selectedSides & TableSide::Top) + m_style.setTopBorder(newBorder); + } + + updateCells(); + adjustTable(); +} + +void PageItem_Table::restoreTableLeftBorder(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState< QPair > *>(state); + if (!itemState) + return; + + QPair oldNewBorders = itemState->getItem(); + TableBorder restoredBorder = isUndo ? oldNewBorders.first : oldNewBorders.second; + setLeftBorder(restoredBorder); + + adjustTable(); +} + +void PageItem_Table::restoreTableLeftBorderReset(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState *>(state); + if (!itemState) + return; + + if (isUndo) + { + TableBorder oldBorder = itemState->getItem(); + setLeftBorder(oldBorder); + } + else + { + unsetLeftBorder(); + } + + adjustTable(); +} + +void PageItem_Table::restoreTableRightBorder(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState< QPair > *>(state); + if (!itemState) + return; + + QPair oldNewBorders = itemState->getItem(); + TableBorder restoredBorder = isUndo ? oldNewBorders.first : oldNewBorders.second; + setRightBorder(restoredBorder); + + adjustTable(); +} + +void PageItem_Table::restoreTableRightBorderReset(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState *>(state); + if (!itemState) + return; + + if (isUndo) + { + TableBorder oldBorder = itemState->getItem(); + setRightBorder(oldBorder); + } + else + { + unsetRightBorder(); + } + + adjustTable(); +} + +void PageItem_Table::restoreTableBottomBorder(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState< QPair > *>(state); + if (!itemState) + return; + + QPair oldNewBorders = itemState->getItem(); + TableBorder restoredBorder = isUndo ? oldNewBorders.first : oldNewBorders.second; + setBottomBorder(restoredBorder); + + adjustTable(); +} + +void PageItem_Table::restoreTableBottomBorderReset(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState *>(state); + if (!itemState) + return; + + if (isUndo) + { + TableBorder oldBorder = itemState->getItem(); + setBottomBorder(oldBorder); + } + else + { + unsetBottomBorder(); + } + + adjustTable(); +} + +void PageItem_Table::restoreTableTopBorder(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState< QPair > *>(state); + if (!itemState) + return; + + QPair oldNewBorders = itemState->getItem(); + TableBorder restoredBorder = isUndo ? oldNewBorders.first : oldNewBorders.second; + setTopBorder(restoredBorder); + + adjustTable(); +} + +void PageItem_Table::restoreTableTopBorderReset(SimpleState *state, bool isUndo) +{ + auto* itemState = dynamic_cast< ScItemState *>(state); + if (!itemState) + return; + + if (isUndo) + { + TableBorder oldBorder = itemState->getItem(); + setTopBorder(oldBorder); + } + else + { + unsetTopBorder(); + } + + adjustTable(); +} + +void PageItem_Table::restoreTableStyle(SimpleState *state, bool isUndo) +{ + QString restoredStyle = state->get(isUndo ? "OLD_STYLE" : "NEW_STYLE"); + setStyle(restoredStyle); +} + +void PageItem_Table::restoreTableStyleReset(SimpleState *state, bool isUndo) +{ + QString restoredStyle = state->get(isUndo ? "OLD_STYLE" : "NEW_STYLE"); + setStyle(restoredStyle); +} Modified: trunk/Scribus/scribus/pageitem_table.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/pageitem_table.h ============================================================================== --- trunk/Scribus/scribus/pageitem_table.h (original) +++ trunk/Scribus/scribus/pageitem_table.h Sun Dec 26 17:34:08 2021 @@ -9,6 +9,9 @@ #ifndef PAGEITEM_TABLE_H #define PAGEITEM_TABLE_H +#include + +#include #include #include #include @@ -18,6 +21,7 @@ #include "cellarea.h" #include "pageitem.h" #include "scribusapi.h" +#include "scribusstructs.h" #include "styles/tablestyle.h" #include "tablecell.h" #include "tablehandle.h" @@ -281,6 +285,11 @@ void splitCell(int row, int column, int numRows, int numCols); /** + * Returns the set of table cells. + */ + QSet cells() const; + + /** * Returns the set of selected cells. */ const QSet& selectedCells() const { return m_selection; } @@ -461,6 +470,24 @@ /// Returns the bottom border of this table. TableBorder bottomBorder() const; + /// Set tabme borders + void setBorders(const TableBorder& border, TableSides selectedSides); + + /// Set cell borders + void setCellBorders(const TableBorder& border, TableSides selectedSides); + + /// Set cell borders + void setCellBorders(const QSet& cells, const TableBorder& border, TableSides selectedSides); + + /// Sets the cell fill color of this table to @a fillColor. + void setCellFillColor(const QString& fillColor); + + /// Sets the cell fill color of this table to @a fillShade. + void setCellFillShade(double fillShade); + + /// Sets the cell style of this table to @a cellStyle. + void setCellStyle(const QString& cellStyle); + /// Sets the table style of this table to @a style. void setStyle(const QString& style); @@ -529,6 +556,9 @@ /// creates valid layout information void layout() override; + + /** @brief Perform undo/redo action */ + void restore(UndoState *state, bool isUndo) override; signals: /// This signal is emitted whenever the table changes. @@ -554,6 +584,8 @@ ColumnsRemoved /**< Columns were removed. */ }; + using TableBorderTuple = std::tuple; + /** * Initializes the table with @a numRows rows and @a numColumns columns. * @@ -610,6 +642,63 @@ /// Table sanity check. Very slow. For internal use. void assertValid() const; + // Undo/redo setCellFillColor action + void restoreCellBorders(SimpleState *state, bool isUndo); + + // Undo/redo setCellFillColor action + void restoreCellFillColor(SimpleState *state, bool isUndo); + + // Undo/redo setCellFillColor action + void restoreCellFillShade(SimpleState *state, bool isUndo); + + // Undo/redo setCellStyle action + void restoreCellStyle(SimpleState *state, bool isUndo); + + // Undo/redo setFillColor action + void restoreTableFillColor(SimpleState *state, bool isUndo); + + // Undo/redo unsetFillColor action + void restoreTableFillColorReset(SimpleState *state, bool isUndo); + + // Undo/redo setFillShade action + void restoreTableFillShade(SimpleState *state, bool isUndo); + + // Undo/redo unsetFillShade action + void restoreTableFillShadeReset(SimpleState *state, bool isUndo); + + // Undo/redo setBorders action + void restoreTableBorders(SimpleState *state, bool isUndo); + + // Undo/redo setLeftBorder action + void restoreTableLeftBorder(SimpleState *state, bool isUndo); + + // Undo/redo unsetLeftBorder action + void restoreTableLeftBorderReset(SimpleState *state, bool isUndo); + + // Undo/redo setRightBorder action + void restoreTableRightBorder(SimpleState *state, bool isUndo); + + // Undo/redo unsetRightBorder action + void restoreTableRightBorderReset(SimpleState *state, bool isUndo); + + // Undo/redo setBottomBorder action + void restoreTableBottomBorder(SimpleState *state, bool isUndo); + + // Undo/redo unsetBottomBorder action + void restoreTableBottomBorderReset(SimpleState *state, bool isUndo); + + // Undo/redo setTopBorder action + void restoreTableTopBorder(SimpleState *state, bool isUndo); + + // Undo/redo unsetTopBorder action + void restoreTableTopBorderReset(SimpleState *state, bool isUndo); + + // Undo/redo setStyle action + void restoreTableStyle(SimpleState *state, bool isUndo); + + // Undo/redo unsetStyle action + void restoreTableStyleReset(SimpleState *state, bool isUndo); + private: //< #include #include +#include #include #include #include @@ -7840,8 +7841,6 @@ itemSelection_ApplyCharStyle(newStyle, customSelection, "NAMED_STYLE"); } - - void ScribusDoc::itemSelection_SetNamedParagraphStyle(const QString& name, Selection* customSelection) { ParagraphStyle newStyle; @@ -7849,11 +7848,10 @@ itemSelection_ApplyParagraphStyle(newStyle, customSelection, false); } - void ScribusDoc::itemSelection_SetNamedLineStyle(const QString &name, Selection* customSelection) { Selection* itemSelection = (customSelection != nullptr) ? customSelection : m_Selection; - uint docSelectionCount = itemSelection->count(); + int docSelectionCount = itemSelection->count(); if (docSelectionCount <= 0) return; @@ -7861,9 +7859,9 @@ m_updateManager.setUpdatesDisabled(); if (UndoManager::undoEnabled() && docSelectionCount > 1) activeTransaction = m_undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::LineStyle, name, Um::ILineStyle); - for (uint aa = 0; aa < docSelectionCount; ++aa) - { - PageItem *currItem = itemSelection->itemAt(aa); + for (int i = 0; i < docSelectionCount; ++i) + { + PageItem *currItem = itemSelection->itemAt(i); currItem->setCustomLineStyle(name); currItem->update(); } @@ -7873,6 +7871,57 @@ changed(); } +void ScribusDoc::itemSelection_SetNamedCellStyle(const QString & name, Selection* customSelection) +{ + Selection* itemSelection = (customSelection != nullptr) ? customSelection : m_Selection; + int docSelectionCount = itemSelection->count(); + if (docSelectionCount <= 0) + return; + + UndoTransaction activeTransaction; + m_updateManager.setUpdatesDisabled(); + if (UndoManager::undoEnabled() && docSelectionCount > 1) + activeTransaction = m_undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::CellStyle, name, Um::ITable); + for (int i = 0; i < docSelectionCount; ++i) + { + PageItem *currItem = itemSelection->itemAt(i); + PageItem_Table* tableItem = currItem->asTable(); + if (!tableItem) + continue; + tableItem->setCellStyle(name); + tableItem->update(); + } + if (activeTransaction) + activeTransaction.commit(); + m_updateManager.setUpdatesEnabled(); + changed(); +} + +void ScribusDoc::itemSelection_SetNamedTableStyle(const QString & name, Selection* customSelection) +{ + Selection* itemSelection = (customSelection != nullptr) ? customSelection : m_Selection; + int docSelectionCount = itemSelection->count(); + if (docSelectionCount <= 0) + return; + + UndoTransaction activeTransaction; + m_updateManager.setUpdatesDisabled(); + if (UndoManager::undoEnabled() && docSelectionCount > 1) + activeTransaction = m_undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::TableStyle, name, Um::ITable); + for (int i = 0; i < docSelectionCount; ++i) + { + PageItem *currItem = itemSelection->itemAt(i); + PageItem_Table* tableItem = currItem->asTable(); + if (!tableItem) + continue; + tableItem->setStyle(name); + tableItem->update(); + } + if (activeTransaction) + activeTransaction.commit(); + m_updateManager.setUpdatesEnabled(); + changed(); +} void ScribusDoc::itemSelection_SetItemPen(QString color, Selection* customSelection) { @@ -8409,7 +8458,7 @@ QScopedPointer dialog(new InsertTableRowsDialog(appMode, m_ScMW)); if (dialog->exec() == QDialog::Accepted) { - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); /* * In table edit mode we insert either before or after the active * cell, otherwise we insert at beginning or end of table. @@ -8445,7 +8494,7 @@ QPointer dialog = new InsertTableColumnsDialog(appMode, m_ScMW); if (dialog->exec() == QDialog::Accepted) { - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); /* * In table edit mode we insert either before or after the active * cell, otherwise we insert at beginning or end of table. @@ -8486,7 +8535,8 @@ if (table->selectedRows().size() >= table->rows()) return; - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); + if (table->selectedRows().isEmpty()) { // Remove rows spanned by active cell. @@ -8542,7 +8592,8 @@ if (table->selectedColumns().size() >= table->columns()) return; - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); + if (table->selectedColumns().isEmpty()) { // Remove columns spanned by active cell. @@ -8608,7 +8659,7 @@ const int numRows = selectedRows.last() - row + 1; const int numColumns = selectedColumns.last() - column + 1; - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); table->mergeCells(row, column, numRows, numColumns); m_View->stopGesture(); // FIXME: Don't use m_View. @@ -8634,7 +8685,8 @@ return; const qreal rowHeight = dialog->rowHeight(); - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); + if (appMode == modeEditTable) { if (table->selectedCells().isEmpty()) @@ -8664,6 +8716,7 @@ table->adjustTable(); table->update(); + changed(); } @@ -8682,7 +8735,8 @@ return; const qreal columnWidth = dialog->columnWidth(); - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); + if (appMode == modeEditTable) { if (table->selectedCells().isEmpty()) @@ -8724,8 +8778,8 @@ PageItem_Table* table = item->asTable(); if (!table) return; - - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); + if (appMode == modeEditTable && !table->selectedRows().isEmpty()) { // Distribute each contiguous range of selected rows. @@ -8767,8 +8821,8 @@ PageItem_Table* table = item->asTable(); if (!table) return; - - dontResize = true; + QScopedValueRollback dontResizeRb(dontResize, true); + if (appMode == modeEditTable && !table->selectedColumns().isEmpty()) { // Distribute each contiguous range of selected columns. Modified: trunk/Scribus/scribus/scribusdoc.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/scribusdoc.h ============================================================================== --- trunk/Scribus/scribus/scribusdoc.h (original) +++ trunk/Scribus/scribus/scribusdoc.h Sun Dec 26 17:34:08 2021 @@ -1114,6 +1114,8 @@ void itemSelection_SetNamedParagraphStyle(const QString & name, Selection* customSelection = nullptr); void itemSelection_SetNamedCharStyle(const QString & name, Selection* customSelection = nullptr); void itemSelection_SetNamedLineStyle(const QString & name, Selection* customSelection = nullptr); + void itemSelection_SetNamedCellStyle(const QString & name, Selection* customSelection = nullptr); + void itemSelection_SetNamedTableStyle(const QString & name, Selection* customSelection = nullptr); void itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend, bool erase, bool objopa); void itemSelection_SetLineWidth(double w, Selection* customSelection = nullptr); void itemSelection_SetLineArt(Qt::PenStyle w, Selection* customSelection = nullptr); Modified: trunk/Scribus/scribus/scribusstructs.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/scribusstructs.h ============================================================================== --- trunk/Scribus/scribus/scribusstructs.h (original) +++ trunk/Scribus/scribus/scribusstructs.h Sun Dec 26 17:34:08 2021 @@ -77,9 +77,6 @@ int FirstPage; int Rows; int Columns; -// double GapHorizontal; -// double GapVertical; -// double GapBelow; QStringList pageNames; }; @@ -132,6 +129,22 @@ GradMask_PatternLumAlphaInverted = 7, GradMask_PatternInverted = 8 }; + +/** + * This enum describes the sides that can be selected. A selection can be + * expressed as an ORed combination of Left, Right, Top and Bottom. + */ +enum class TableSide +{ + None = 0, /**< None of the sides are selected. */ + Left = 1, /**< The left side is selected. */ + Right = 2, /**< The right side is selected. */ + Top = 4, /**< The top side is selected. */ + Bottom = 8, /**< The bottom side is selected. */ + All = Left | Right | Top | Bottom +}; +Q_DECLARE_FLAGS(TableSides, TableSide) +Q_DECLARE_OPERATORS_FOR_FLAGS(TableSides) struct SingleLine { @@ -163,6 +176,15 @@ } }; +class multiLine : public QList { +public: + QString shortcut; + bool operator!=(const multiLine& other) const + { + return !(this->operator ==(other)); + } +}; + struct Bullet //used by style reader while importing ODT files { QString name; @@ -186,7 +208,7 @@ struct ArrowDesc { QString name; - bool userArrow; + bool userArrow { false }; FPointArray points; }; @@ -263,16 +285,6 @@ }; typedef QMap ProfilesL; -// typedef QValueVector multiLine; - -class multiLine : public QList { -public: - QString shortcut; - bool operator!=(const multiLine& other) const - { - return !(this->operator ==(other)); - } -}; enum PreflightError { @@ -361,13 +373,6 @@ //! \brief Common type for guides list typedef QList Guides; -//! \brief from ols scribusXml -struct Linked -{ - int Start; - int StPag; -}; - // this is a quick hack to combine runs until I've thought of something better -- AV class LastStyles { Modified: trunk/Scribus/scribus/tablecell.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/tablecell.h ============================================================================== --- trunk/Scribus/scribus/tablecell.h (original) +++ trunk/Scribus/scribus/tablecell.h Sun Dec 26 17:34:08 2021 @@ -248,6 +248,8 @@ private: friend class PageItem_Table; + friend bool operator<(const TableCell& cell1, const TableCell& cell2); + QExplicitlySharedDataPointer d; }; Q_DECLARE_TYPEINFO(TableCell, Q_MOVABLE_TYPE); @@ -257,6 +259,15 @@ return (cell.row() << 16) ^ cell.column(); } +inline bool operator<(const TableCell& cell1, const TableCell& cell2) +{ + if (cell1.row() < cell2.row()) + return true; + if (cell1.row() > cell2.row()) + return false; + return (cell1.column() < cell2.column()); +} + QDebug operator<<(QDebug debug, const TableCell& cell); #endif // TABLECELL_H Modified: trunk/Scribus/scribus/ui/propertiespalette_table.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/ui/propertiespalette_table.cpp ============================================================================== --- trunk/Scribus/scribus/ui/propertiespalette_table.cpp (original) +++ trunk/Scribus/scribus/ui/propertiespalette_table.cpp Sun Dec 26 17:34:08 2021 @@ -25,6 +25,8 @@ #include "selection.h" #include "tableborder.h" #include "tablesideselector.h" +#include "undomanager.h" +#include "undotransaction.h" #include "util.h" #include "util_color.h" @@ -139,12 +141,7 @@ else m_item = nullptr; - // HACK: Guard against "false" re-selections resulting from m_item->update(). - if (m_item == m_previousItem) - return; - m_previousItem = m_item; - - sideSelector->setSelection(TableSideSelector::All); + sideSelector->setSelection(TableSide::All); updateFillControls(); updateStyleControls(); @@ -221,32 +218,7 @@ return; QScopedValueRollback dontResizeRb(m_doc->dontResize, true); - PageItem_Table* table = m_item->asTable(); - if (m_doc->appMode != modeEditTable) - { - for (int row = 0; row < table->rows(); ++row) - { - int colSpan = 0; - for (int col = 0; col < table->columns(); col += colSpan) - { - TableCell currentCell = table->cellAt(row, col); - if (row == currentCell.row()) - currentCell.setStyle(name); - colSpan = currentCell.columnSpan(); - } - } - } - else - { - QSet cells = table->selectedCells(); - if (cells.isEmpty()) - cells.insert(table->activeCell()); - for (auto cellIter = cells.begin(); cellIter != cells.end(); cellIter++) - { - TableCell currentCell(*cellIter); - currentCell.setStyle(name); - } - } + m_doc->itemSelection_SetNamedCellStyle(name); m_item->asTable()->update(); showCellStyle(name); @@ -266,11 +238,11 @@ */ State borderState = Unset; m_currentBorder = TableBorder(); - TableSideSelector::Sides selectedSides = sideSelector->selection(); + TableSides selectedSides = sideSelector->selection(); PageItem_Table* table = m_item->asTable(); bool tableEditMode = (m_doc->appMode == modeEditTable); - if (selectedSides & TableSideSelector::Left) + if (selectedSides & TableSide::Left) { TableBorder leftBorder = tableEditMode ? table->activeCell().leftBorder() : table->leftBorder(); if (borderState == Unset && !leftBorder.isNull()) @@ -282,7 +254,7 @@ borderState = TriState; } - if (selectedSides & TableSideSelector::Right) + if (selectedSides & TableSide::Right) { TableBorder rightBorder = tableEditMode ? table->activeCell().rightBorder() : table->rightBorder(); if (borderState == Unset && !rightBorder.isNull()) @@ -294,7 +266,7 @@ borderState = TriState; } - if (selectedSides & TableSideSelector::Top) + if (selectedSides & TableSide::Top) { TableBorder topBorder = tableEditMode ? table->activeCell().topBorder() : table->topBorder(); if (borderState == Unset && !table->topBorder().isNull()) @@ -306,7 +278,7 @@ borderState = TriState; } - if (selectedSides & TableSideSelector::Bottom) + if (selectedSides & TableSide::Bottom) { TableBorder bottomBorder = tableEditMode ? table->activeCell().bottomBorder() : table->bottomBorder(); if (borderState == Unset && !bottomBorder.isNull()) @@ -381,6 +353,9 @@ void PropertiesPalette_Table::updateBorderLineListItem() { QListWidgetItem* item = borderLineList->currentItem(); + if (!item) + return; + QString text = QString(" %1%2 %3").arg(borderLineWidth->getValue()).arg(borderLineWidth->suffix(), CommonStrings::translatePenStyleName(static_cast(borderLineStyle->currentIndex() + 1))); if (borderLineColor->currentColor() != CommonStrings::None) { @@ -551,28 +526,23 @@ { if (!m_item || !m_item->isTable()) return; + + UndoTransaction activeTransaction; + if (UndoManager::undoEnabled()) + activeTransaction = UndoManager::instance()->beginTransaction(m_item->getUName(), m_item->getUPixmap(), Um::CellFillColor, QString(), Um::ITable); + QString color = colorName; if (colorName == CommonStrings::tr_NoneColor) color = CommonStrings::None; + PageItem_Table* table = m_item->asTable(); if (m_doc->appMode != modeEditTable) - { table->setFillColor(color); - table->setFillShade(fillShade->value()); - } - else - { - QSet cells = table->selectedCells(); - if (cells.isEmpty()) - cells.insert(table->activeCell()); - QSet::Iterator cellIter; - for (cellIter = cells.begin(); cellIter != cells.end(); cellIter++) - { - TableCell currentCell(*cellIter); - currentCell.setFillColor(color); - currentCell.setFillShade(fillShade->value()); - } - } + else + table->setCellFillColor(color); + + if (activeTransaction) + activeTransaction.commit(); table->update(); } @@ -581,29 +551,24 @@ { if (!m_item || !m_item->isTable()) return; + + UndoTransaction activeTransaction; + if (UndoManager::undoEnabled()) + activeTransaction = UndoManager::instance()->beginTransaction(m_item->getUName(), m_item->getUPixmap(), Um::CellFillShade, QString(), Um::ITable); QString color = fillColor->currentColor(); if (color == CommonStrings::tr_NoneColor) color = CommonStrings::None; + PageItem_Table* table = m_item->asTable(); if (m_doc->appMode != modeEditTable) - { - table->setFillColor(color); table->setFillShade(shade); - } - else - { - QSet cells = table->selectedCells(); - if (cells.isEmpty()) - cells.insert(table->activeCell()); - QSet::Iterator cellIter; - for (cellIter = cells.begin(); cellIter != cells.end(); cellIter++) - { - TableCell currentCell(*cellIter); - currentCell.setFillColor(color); - currentCell.setFillShade(shade); - } - } + else + table->setCellFillShade(fillShade->value()); + + if (activeTransaction) + activeTransaction.commit(); + table->update(); } @@ -660,39 +625,18 @@ QScopedValueRollback dontResizeRb(m_doc->dontResize, true); PageItem_Table* table = m_item->asTable(); - TableSideSelector::Sides selectedSides = sideSelector->selection(); + TableSides selectedSides = sideSelector->selection(); if (m_doc->appMode != modeEditTable) { - if (selectedSides & TableSideSelector::Left) - table->setLeftBorder(m_currentBorder); - if (selectedSides & TableSideSelector::Right) - table->setRightBorder(m_currentBorder); - if (selectedSides & TableSideSelector::Top) - table->setTopBorder(m_currentBorder); - if (selectedSides & TableSideSelector::Bottom) - table->setBottomBorder(m_currentBorder); + table->setBorders(m_currentBorder, selectedSides); } else { QSet cells = table->selectedCells(); if (cells.isEmpty()) cells.insert(table->activeCell()); - QSet::Iterator cellIter; - for (cellIter = cells.begin(); cellIter != cells.end(); cellIter++) - { - TableCell currentCell(*cellIter); - if (selectedSides & TableSideSelector::Left) - currentCell.setLeftBorder(m_currentBorder); - if (selectedSides & TableSideSelector::Right) - currentCell.setRightBorder(m_currentBorder); - if (selectedSides & TableSideSelector::Top) - currentCell.setTopBorder(m_currentBorder); - if (selectedSides & TableSideSelector::Bottom) - currentCell.setBottomBorder(m_currentBorder); - } - } - - table->adjustTable(); + table->setCellBorders(cells, m_currentBorder, selectedSides); + } table->update(); } Modified: trunk/Scribus/scribus/ui/propertiespalette_table.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/ui/propertiespalette_table.h ============================================================================== --- trunk/Scribus/scribus/ui/propertiespalette_table.h (original) +++ trunk/Scribus/scribus/ui/propertiespalette_table.h Sun Dec 26 17:34:08 2021 @@ -123,8 +123,6 @@ ScGuardedPtr m_doc; /// The currently edited item. PageItem* m_item {nullptr}; - /// The previous edited selected items. - PageItem* m_previousItem {nullptr}; /// The currently edited border. TableBorder m_currentBorder; Modified: trunk/Scribus/scribus/ui/smcellstyle.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/ui/smcellstyle.cpp ============================================================================== --- trunk/Scribus/scribus/ui/smcellstyle.cpp (original) +++ trunk/Scribus/scribus/ui/smcellstyle.cpp Sun Dec 26 17:34:08 2021 @@ -135,7 +135,21 @@ void SMCellStyle::toSelection(const QString &styleName) const { - // TODO: Implement this once we have cell items. + if (!m_doc) + return; // nowhere to apply or no doc + + QString realName = styleName; + int styleIndex = m_cachedStyles.find(styleName); + if (styleIndex < 0 && (styleName == CommonStrings::trDefaultCellStyle)) + { + styleIndex = m_cachedStyles.find(CommonStrings::DefaultCellStyle); + if (styleIndex >= 0) + realName = CommonStrings::DefaultCellStyle; + } + if (styleIndex >= 0) + { + m_doc->itemSelection_SetNamedCellStyle(realName); + } } QString SMCellStyle::newStyle() Modified: trunk/Scribus/scribus/ui/smtablestyle.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/ui/smtablestyle.cpp ============================================================================== --- trunk/Scribus/scribus/ui/smtablestyle.cpp (original) +++ trunk/Scribus/scribus/ui/smtablestyle.cpp Sun Dec 26 17:34:08 2021 @@ -135,7 +135,21 @@ void SMTableStyle::toSelection(const QString &styleName) const { - // TODO: Implement this once we have table items. + if (!m_doc) + return; // nowhere to apply or no doc + + QString realName = styleName; + int styleIndex = m_cachedStyles.find(styleName); + if (styleIndex < 0 && (styleName == CommonStrings::trDefaultTableStyle)) + { + styleIndex = m_cachedStyles.find(CommonStrings::DefaultTableStyle); + if (styleIndex >= 0) + realName = CommonStrings::DefaultTableStyle; + } + if (styleIndex >= 0) + { + m_doc->itemSelection_SetNamedTableStyle(realName); + } } QString SMTableStyle::newStyle() Modified: trunk/Scribus/scribus/ui/tablesideselector.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/ui/tablesideselector.cpp ============================================================================== --- trunk/Scribus/scribus/ui/tablesideselector.cpp (original) +++ trunk/Scribus/scribus/ui/tablesideselector.cpp Sun Dec 26 17:34:08 2021 @@ -26,7 +26,7 @@ TableSideSelector::TableSideSelector(QWidget* parent) : QFrame(parent) { - setSelection(All); + setSelection(TableSide::All); setStyle(TableStyle); setFrameShape(QFrame::StyledPanel); setFrameShadow(QFrame::Sunken); @@ -34,17 +34,17 @@ setMouseTracking(true); } -QList TableSideSelector::selectionList() const +QList TableSideSelector::selectionList() const { - QList sides; - if (m_selection & Left) - sides.append(Left); - if (m_selection & Right) - sides.append(Right); - if (m_selection & Top) - sides.append(Top); - if (m_selection & Bottom) - sides.append(Bottom); + QList sides; + if (m_selection & TableSide::Left) + sides.append(TableSide::Left); + if (m_selection & TableSide::Right) + sides.append(TableSide::Right); + if (m_selection & TableSide::Top) + sides.append(TableSide::Top); + if (m_selection & TableSide::Bottom) + sides.append(TableSide::Bottom); return sides; } @@ -67,10 +67,10 @@ // Paint selection. painter.setPen(QPen(Qt::black, edgeWidth, Qt::SolidLine, Qt::RoundCap)); - if (m_selection & Left) painter.drawLine(m_left); - if (m_selection & Right) painter.drawLine(m_right); - if (m_selection & Top) painter.drawLine(m_top); - if (m_selection & Bottom) painter.drawLine(m_bottom); + if (m_selection & TableSide::Left) painter.drawLine(m_left); + if (m_selection & TableSide::Right) painter.drawLine(m_right); + if (m_selection & TableSide::Top) painter.drawLine(m_top); + if (m_selection & TableSide::Bottom) painter.drawLine(m_bottom); // Paint the dotted grid. painter.setPen(QPen(Qt::gray, edgeWidth/4, Qt::DotLine)); @@ -82,16 +82,16 @@ painter.setPen(QPen(QColor(255, 255, 255, 60), edgeWidth, Qt::SolidLine, Qt::RoundCap)); switch (m_highlighted) { - case Left: + case TableSide::Left: painter.drawLine(m_left); break; - case Right: + case TableSide::Right: painter.drawLine(m_right); break; - case Top: + case TableSide::Top: painter.drawLine(m_top); break; - case Bottom: + case TableSide::Bottom: painter.drawLine(m_bottom); break; default: @@ -115,17 +115,17 @@ void TableSideSelector::leaveEvent(QEvent* event) { Q_UNUSED(event); - m_highlighted = None; + m_highlighted = TableSide::None; update(); } -TableSideSelector::Side TableSideSelector::closestSide(const QPointF& point) const +TableSide TableSideSelector::closestSide(const QPointF& point) const { - QList > distances; - distances.append(QPair(QLineF(point, m_left.pointAt(0.5)).length(), Left)); - distances.append(QPair(QLineF(point, m_right.pointAt(0.5)).length(), Right)); - distances.append(QPair(QLineF(point, m_top.pointAt(0.5)).length(), Top)); - distances.append(QPair(QLineF(point, m_bottom.pointAt(0.5)).length(), Bottom)); + QList > distances; + distances.append(QPair(QLineF(point, m_left.pointAt(0.5)).length(), TableSide::Left)); + distances.append(QPair(QLineF(point, m_right.pointAt(0.5)).length(), TableSide::Right)); + distances.append(QPair(QLineF(point, m_top.pointAt(0.5)).length(), TableSide::Top)); + distances.append(QPair(QLineF(point, m_bottom.pointAt(0.5)).length(), TableSide::Bottom)); std::sort(distances.begin(), distances.end()); return distances.first().second; Modified: trunk/Scribus/scribus/ui/tablesideselector.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/ui/tablesideselector.h ============================================================================== --- trunk/Scribus/scribus/ui/tablesideselector.h (original) +++ trunk/Scribus/scribus/ui/tablesideselector.h Sun Dec 26 17:34:08 2021 @@ -14,6 +14,8 @@ #include #include +#include "scribusstructs.h" + class QPaintEvent; class QMouseEvent; class QEvent; @@ -27,25 +29,10 @@ { Q_OBJECT - Q_PROPERTY(Sides selection READ selection WRITE setSelection RESET clearSelection NOTIFY selectionChanged) + Q_PROPERTY(TableSides selection READ selection WRITE setSelection RESET clearSelection NOTIFY selectionChanged) Q_PROPERTY(Style style READ style WRITE setStyle) public: - /** - * This enum describes the sides that can be selected. A selection can be - * expressed as an ORed combination of Left, Right, Top and Bottom. - */ - enum Side - { - None = 0, /**< None of the sides are selected. */ - Left = 1, /**< The left side is selected. */ - Right = 2, /**< The right side is selected. */ - Top = 4, /**< The top side is selected. */ - Bottom = 8, /**< The bottom side is selected. */ - All = Left | Right | Top | Bottom - }; - Q_DECLARE_FLAGS(Sides, Side) - /** * This enum describes two possible styles for the selector. If the cell style is used, * the selector will resemble a cell. In the table style, a table. @@ -60,16 +47,16 @@ TableSideSelector(QWidget* parent); /// Returns the current selection as an ORed combination of enum flags. - Sides selection() const { return m_selection; } + TableSides selection() const { return m_selection; } /// Returns the current selection as a list of enum values. - QList selectionList() const; + QList selectionList() const; /// Sets the current selection to @a selection. - void setSelection(Sides selection) { m_selection = selection; emit selectionChanged(); } + void setSelection(TableSides selection) { m_selection = selection; emit selectionChanged(); } /// Clears the current selection. - void clearSelection() { m_selection = None; emit selectionChanged(); } + void clearSelection() { m_selection = TableSide::None; emit selectionChanged(); } /// Returns the current style of the selector. Style style() const { return m_style; } @@ -99,17 +86,17 @@ private: /// Utility function to return the side closest to @a point. - Side closestSide(const QPointF& point) const; + TableSide closestSide(const QPointF& point) const; private: /// The current selection. - Sides m_selection; + TableSides m_selection; /// The current style of the selector. Style m_style; /// The side currently closest to the mouse pointer. - Side m_highlighted; + TableSide m_highlighted; /// The left side line. QLineF m_left; @@ -124,6 +111,4 @@ QLineF m_bottom; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(TableSideSelector::Sides) - #endif // TABLESIDESELECTOR_H Modified: trunk/Scribus/scribus/undomanager.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/undomanager.cpp ============================================================================== --- trunk/Scribus/scribus/undomanager.cpp (original) +++ trunk/Scribus/scribus/undomanager.cpp Sun Dec 26 17:34:08 2021 @@ -648,6 +648,24 @@ UndoManager::StartAndEndArrow = tr("Set start and end arrows"); UndoManager::CreateTable = tr("Create table"); UndoManager::RowsCols = tr("Rows: %1, Cols: %2"); + UndoManager::CellBorders = tr("Set cell borders"); + UndoManager::CellFillColor = tr("Set cell fill color"); + UndoManager::CellFillShade = tr("Set cell fill shade"); + UndoManager::CellStyle = tr("Set cell style"); + UndoManager::TableFillColor = tr("Set table fill color"); + UndoManager::TableFillColorRst = tr("Reset table fill color"); + UndoManager::TableFillShade = tr("Set table fill shade"); + UndoManager::TableFillShadeRst = tr("Reset table fill shade"); + UndoManager::TableBorders = tr("Set table borders"); + UndoManager::TableLeftBorder = tr("Set table left border"); + UndoManager::TableLeftBorderRst = tr("Reset table left border"); + UndoManager::TableRightBorder = tr("Set table right border"); + UndoManager::TableRightBorderRst = tr("Reset table right border"); + UndoManager::TableBottomBorder = tr("Set table bottom border"); + UndoManager::TableBottomBorderRst = tr("Reset table bottom border"); + UndoManager::TableTopBorder = tr("Set table top border"); + UndoManager::TableTopBorderRst = tr("Reset table top border"); + UndoManager::TableStyle = tr("Set table style"); UndoManager::SetFont = tr("Set font"); UndoManager::SetFontSize = tr("Set font size"); UndoManager::StartArrowScale = tr("Set start arrow scale"); @@ -968,6 +986,24 @@ QString UndoManager::StartAndEndArrow = ""; QString UndoManager::CreateTable = ""; QString UndoManager::RowsCols = ""; +QString UndoManager::CellBorders = ""; +QString UndoManager::CellFillColor = ""; +QString UndoManager::CellFillShade = ""; +QString UndoManager::CellStyle = ""; +QString UndoManager::TableFillColor = ""; +QString UndoManager::TableFillColorRst = ""; +QString UndoManager::TableFillShade = ""; +QString UndoManager::TableFillShadeRst = ""; +QString UndoManager::TableBorders = ""; +QString UndoManager::TableLeftBorder = ""; +QString UndoManager::TableLeftBorderRst = ""; +QString UndoManager::TableRightBorder = ""; +QString UndoManager::TableRightBorderRst = ""; +QString UndoManager::TableBottomBorder = ""; +QString UndoManager::TableBottomBorderRst = ""; +QString UndoManager::TableTopBorder = ""; +QString UndoManager::TableTopBorderRst = ""; +QString UndoManager::TableStyle = ""; QString UndoManager::SetFont = ""; QString UndoManager::SetFontSize = ""; QString UndoManager::SetFontWidth = ""; Modified: trunk/Scribus/scribus/undomanager.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24782&path=/trunk/Scribus/scribus/undomanager.h ============================================================================== --- trunk/Scribus/scribus/undomanager.h (original) +++ trunk/Scribus/scribus/undomanager.h Sun Dec 26 17:34:08 2021 @@ -429,6 +429,24 @@ static QString StartAndEndArrow; static QString CreateTable; static QString RowsCols; + static QString CellBorders; + static QString CellFillColor; + static QString CellFillShade; + static QString CellStyle; + static QString TableFillColor; + static QString TableFillColorRst; + static QString TableFillShade; + static QString TableFillShadeRst; + static QString TableBorders; + static QString TableLeftBorder; + static QString TableLeftBorderRst; + static QString TableRightBorder; + static QString TableRightBorderRst; + static QString TableBottomBorder; + static QString TableBottomBorderRst; + static QString TableTopBorder; + static QString TableTopBorderRst; + static QString TableStyle; static QString SetFont; static QString SetFontSize; static QString SetFontWidth; From scribus-commit at lists.scribus.net Mon Dec 27 12:20:43 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Mon, 27 Dec 2021 12:20:43 -0000 Subject: r24783 by craig - #16692: Add A3/5/6 to default active page sizes Message-ID: Author: craig Date: Mon Dec 27 12:20:43 2021 New Revision: 24783 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24783 Log: #16692: Add A3/5/6 to default active page sizes Modified: trunk/Scribus/scribus/prefsmanager.cpp Modified: trunk/Scribus/scribus/prefsmanager.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24783&path=/trunk/Scribus/scribus/prefsmanager.cpp ============================================================================== --- trunk/Scribus/scribus/prefsmanager.cpp (original) +++ trunk/Scribus/scribus/prefsmanager.cpp Mon Dec 27 12:20:43 2021 @@ -527,7 +527,7 @@ appPrefs.imageCachePrefs.maxCacheEntries = 1000; appPrefs.imageCachePrefs.compressionLevel = 1; appPrefs.activePageSizes.clear(); - appPrefs.activePageSizes << "A4" << "Letter"; + appPrefs.activePageSizes << "A3" << "A4" << "A5" << "A6" << "Letter"; //Attribute setup appPrefs.itemAttrPrefs.defaultItemAttributes.clear(); From scribus-commit at lists.scribus.net Mon Dec 27 12:21:25 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Mon, 27 Dec 2021 12:21:25 -0000 Subject: r24784 by craig - Add more Apple SDKs to CMake setup Message-ID: Author: craig Date: Mon Dec 27 12:21:24 2021 New Revision: 24784 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24784 Log: Add more Apple SDKs to CMake setup Modified: trunk/Scribus/CMakeLists_Apple.cmake Modified: trunk/Scribus/CMakeLists_Apple.cmake URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24784&path=/trunk/Scribus/CMakeLists_Apple.cmake ============================================================================== --- trunk/Scribus/CMakeLists_Apple.cmake (original) +++ trunk/Scribus/CMakeLists_Apple.cmake Mon Dec 27 12:21:24 2021 @@ -1,7 +1,9 @@ if(APPLE_12_00_X) set(OSXMINVER "12.00" CACHE STRING "OSX 12.00") if (WANT_OSX_SDK) - if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk")) + if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk")) + set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk") + elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk")) set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk") elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk")) set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk") @@ -13,7 +15,9 @@ if(APPLE_11_00_X) set(OSXMINVER "11.00" CACHE STRING "OSX 11.00") if (WANT_OSX_SDK) - if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk")) + if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk")) + set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk") + elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk")) set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk") elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk")) set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk") From scribus-commit at lists.scribus.net Tue Dec 28 15:39:55 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Tue, 28 Dec 2021 15:39:55 -0000 Subject: r24785 by craig - Code cleanup Message-ID: Author: craig Date: Tue Dec 28 15:39:55 2021 New Revision: 24785 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24785 Log: Code cleanup Modified: trunk/Scribus/scribus/canvasmode_drawbezier.cpp trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp trunk/Scribus/scribus/canvasmode_drawfreehand.cpp trunk/Scribus/scribus/canvasmode_edit.cpp trunk/Scribus/scribus/ui/annot.cpp trunk/Scribus/scribus/ui/gtfiledialog.h Modified: trunk/Scribus/scribus/canvasmode_drawbezier.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24785&path=/trunk/Scribus/scribus/canvasmode_drawbezier.cpp ============================================================================== --- trunk/Scribus/scribus/canvasmode_drawbezier.cpp (original) +++ trunk/Scribus/scribus/canvasmode_drawbezier.cpp Tue Dec 28 15:39:55 2021 @@ -238,8 +238,6 @@ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); PageItem *currItem; - FPoint npf, npf2; -// QRect tx; m->accept(); m_canvas->displayCorrectedXYHUD(m->globalPos(), mousePointDoc.x(), mousePointDoc.y()); // qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPos()).x() << m_canvas->globalToCanvas(m->globalPos()).y(); Modified: trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24785&path=/trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp ============================================================================== --- trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp (original) +++ trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp Tue Dec 28 15:39:55 2021 @@ -109,8 +109,6 @@ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); PageItem *currItem; - FPoint npf, npf2; -// QRect tx; m->accept(); m_canvas->displayCorrectedXYHUD(m->globalPos(), mousePointDoc.x(), mousePointDoc.y()); @@ -184,7 +182,6 @@ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); double Rxp = 0; double Ryp = 0; - FPoint npf, npf2; QTransform pm; m_mouseButtonPressed = true; Modified: trunk/Scribus/scribus/canvasmode_drawfreehand.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24785&path=/trunk/Scribus/scribus/canvasmode_drawfreehand.cpp ============================================================================== --- trunk/Scribus/scribus/canvasmode_drawfreehand.cpp (original) +++ trunk/Scribus/scribus/canvasmode_drawfreehand.cpp Tue Dec 28 15:39:55 2021 @@ -104,8 +104,6 @@ { const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); PageItem *currItem; - FPoint npf, npf2; -// QRect tx; m->accept(); m_canvas->displayCorrectedXYHUD(m->globalPos(), mousePointDoc.x(), mousePointDoc.y()); if (commonMouseMove(m)) @@ -170,8 +168,6 @@ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); double Rxp = 0; double Ryp = 0; - FPoint npf, npf2; -// QRect tx; QTransform pm; m_mouseButtonPressed = true; m_view->HaveSelRect = false; Modified: trunk/Scribus/scribus/canvasmode_edit.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24785&path=/trunk/Scribus/scribus/canvasmode_edit.cpp ============================================================================== --- trunk/Scribus/scribus/canvasmode_edit.cpp (original) +++ trunk/Scribus/scribus/canvasmode_edit.cpp Tue Dec 28 15:39:55 2021 @@ -392,20 +392,17 @@ void CanvasMode_Edit::mouseMoveEvent(QMouseEvent *m) { -// const double mouseX = m->globalX(); -// const double mouseY = m->globalY(); const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); double newX, newY; PageItem *currItem; - //bool erf = false; m->accept(); if (commonMouseMove(m)) return; if (GetItem(&currItem)) { - newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x()); - newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y()); + newX = qRound(mousePointDoc.x()); + newY = qRound(mousePointDoc.y()); if (m_doc->DragP) return; if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeEdit)) @@ -502,7 +499,6 @@ } else { -// setModeCursor(); m_view->setCursor(QCursor(Qt::ArrowCursor)); } } @@ -512,8 +508,8 @@ { if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton)) { - newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x()); - newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y()); + newX = qRound(mousePointDoc.x()); + newY = qRound(mousePointDoc.y()); SeRx = newX; SeRy = newY; QPoint startP = m_canvas->canvasToGlobal(QPointF(Mxp, Myp)); @@ -541,27 +537,21 @@ ss->set("ETEA", QString("")); } } -// const double mouseX = m->globalX(); -// const double mouseY = m->globalY(); const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); bool inText; PageItem *currItem; m_canvas->PaintSizeRect(QRect()); - FPoint npf, npf2; QTransform pm; m_canvas->m_viewMode.m_MouseButtonPressed = true; m_canvas->m_viewMode.operItemMoving = false; m_view->HaveSelRect = false; m_doc->DragP = false; m_doc->leaveDrag = false; -// oldClip = 0; m->accept(); m_view->registerMousePress(m->globalPos()); - Mxp = mousePointDoc.x(); //qRound(m->x()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.x()); - Myp = mousePointDoc.y(); //qRound(m->y()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.y()); -// QRect mpo(m->x()-m_doc->guidesPrefs().grabRad, m->y()-m_doc->guidesPrefs().grabRad, m_doc->guidesPrefs().grabRad*2, m_doc->guidesPrefs().grabRad*2); -// mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(m_doc->minCanvasCoordinate.y() * m_canvas->scale())); + Mxp = mousePointDoc.x(); + Myp = mousePointDoc.y(); SeRx = Mxp; SeRy = Myp; if (m->button() == Qt::MiddleButton) Modified: trunk/Scribus/scribus/ui/annot.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24785&path=/trunk/Scribus/scribus/ui/annot.cpp ============================================================================== --- trunk/Scribus/scribus/ui/annot.cpp (original) +++ trunk/Scribus/scribus/ui/annot.cpp Tue Dec 28 15:39:55 2021 @@ -763,7 +763,7 @@ void ScAnnot::DecodeCalc() { - QString tm = ""; + QString tm; QString tm2; QString pfor = m_annotation.C_act(); int ss = pfor.lastIndexOf("("); Modified: trunk/Scribus/scribus/ui/gtfiledialog.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24785&path=/trunk/Scribus/scribus/ui/gtfiledialog.h ============================================================================== --- trunk/Scribus/scribus/ui/gtfiledialog.h (original) +++ trunk/Scribus/scribus/ui/gtfiledialog.h Tue Dec 28 15:39:55 2021 @@ -29,20 +29,20 @@ QString selectedFile(); public slots: - virtual void accept(); + void accept() override; void fileClicked(const QString &path); void okClicked(); protected: PrefsContext* m_fileDialogPrefs { nullptr }; - /** @brief Restore the geometry of the window when showing it. */ - void showEvent(QShowEvent *showEvent) override; - /** @brief Captures the close event and changes it to hide */ - void closeEvent(QCloseEvent *closeEvent) override; - /** @brief Stores the geometry of the window when hiding. */ - void hideEvent(QHideEvent* hideEvent) override; - + /** @brief Restore the geometry of the window when showing it. */ + void showEvent(QShowEvent *showEvent) override; + /** @brief Captures the close event and changes it to hide */ + void closeEvent(QCloseEvent *closeEvent) override; + /** @brief Stores the geometry of the window when hiding. */ + void hideEvent(QHideEvent* hideEvent) override; + void storeSize(); void loadSettings(); From scribus-commit at lists.scribus.net Tue Dec 28 15:43:03 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Tue, 28 Dec 2021 15:43:03 -0000 Subject: r24786 by craig - FIx some character comparisons for Qt6 compatibility Message-ID: Author: craig Date: Tue Dec 28 15:43:02 2021 New Revision: 24786 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24786 Log: FIx some character comparisons for Qt6 compatibility Modified: trunk/Scribus/scribus/fonts/scface.cpp trunk/Scribus/scribus/scpainter.h trunk/Scribus/scribus/scpainterex_ps2.h trunk/Scribus/scribus/text/screenpainter.cpp trunk/Scribus/scribus/text/storytext.cpp Modified: trunk/Scribus/scribus/fonts/scface.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24786&path=/trunk/Scribus/scribus/fonts/scface.cpp ============================================================================== --- trunk/Scribus/scribus/fonts/scface.cpp (original) +++ trunk/Scribus/scribus/fonts/scface.cpp Tue Dec 28 15:43:02 2021 @@ -391,16 +391,17 @@ ScFace::gid_type ScFace::emulateGlyph(uint ch) const { - if (ch == SpecialChars::LINEBREAK || ch == SpecialChars::PARSEP - || ch == SpecialChars::FRAMEBREAK || ch == SpecialChars::COLBREAK - || ch == SpecialChars::TAB || ch == SpecialChars::SHYPHEN - || ch == SpecialChars::ZWSPACE || ch == SpecialChars::ZWNBSPACE || ch==SpecialChars::OBJECT) + QChar chr(ch); + if (chr == SpecialChars::LINEBREAK || chr == SpecialChars::PARSEP + || chr == SpecialChars::FRAMEBREAK || chr == SpecialChars::COLBREAK + || chr == SpecialChars::TAB || chr == SpecialChars::SHYPHEN + || chr == SpecialChars::ZWSPACE || chr == SpecialChars::ZWNBSPACE || chr == SpecialChars::OBJECT) return CONTROL_GLYPHS + ch; - if (ch == SpecialChars::NBSPACE) + if (chr == SpecialChars::NBSPACE) return m_m->char2CMap(' '); - if (ch == SpecialChars::NNBSPACE) + if (chr == SpecialChars::NNBSPACE) return m_m->char2CMap(0x2009); // Use thin space - if (ch == SpecialChars::NBHYPHEN) + if (chr == SpecialChars::NBHYPHEN) return hyphenGlyph(); return 0; } @@ -440,7 +441,7 @@ if (m_m->status == ScFace::UNKNOWN) m_m->load(); - if (ch == SpecialChars::SHYPHEN) + if (QChar(ch) == SpecialChars::SHYPHEN) return emulateGlyph(ch); gid_type gl = m_m->char2CMap(ch); Modified: trunk/Scribus/scribus/scpainter.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24786&path=/trunk/Scribus/scribus/scpainter.h ============================================================================== --- trunk/Scribus/scribus/scpainter.h (original) +++ trunk/Scribus/scribus/scpainter.h Tue Dec 28 15:43:02 2021 @@ -185,10 +185,10 @@ QTransform m_matrix; ScFace m_font; double m_fontSize { 0.0 }; - bool mf_underline { false }; - bool mf_strikeout { false }; - bool mf_shadow { false }; - bool mf_outlined { false }; +// bool mf_underline { false }; +// bool mf_strikeout { false }; +// bool mf_shadow { false }; +// bool mf_outlined { false }; /*! \brief Filling */ QColor m_fill { 0, 0, 0 }; double m_fill_trans { 1.0 }; Modified: trunk/Scribus/scribus/scpainterex_ps2.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24786&path=/trunk/Scribus/scribus/scpainterex_ps2.h ============================================================================== --- trunk/Scribus/scribus/scpainterex_ps2.h (original) +++ trunk/Scribus/scribus/scpainterex_ps2.h Tue Dec 28 15:43:02 2021 @@ -244,11 +244,11 @@ bool m_pathIsClosed { false }; bool m_drawingClosedPath { false }; /* Drawing surface dimensions */ - double m_deviceDimX { 0.0 }; - double m_deviceDimY { 0.0 }; +// double m_deviceDimX { 0.0 }; +// double m_deviceDimY { 0.0 }; /* Device resolutions */ - double m_deviceResX { 0.0 }; - double m_deviceResY { 0.0 }; +// double m_deviceResX { 0.0 }; +// double m_deviceResY { 0.0 }; /* Color conversion function */ void transformImage(QImage* image, uchar* data, int scan) const; Modified: trunk/Scribus/scribus/text/screenpainter.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24786&path=/trunk/Scribus/scribus/text/screenpainter.cpp ============================================================================== --- trunk/Scribus/scribus/text/screenpainter.cpp (original) +++ trunk/Scribus/scribus/text/screenpainter.cpp Tue Dec 28 15:43:02 2021 @@ -109,7 +109,8 @@ else if (gid != 0) { gid = gc.getText().at(0).unicode(); - if (gid != SpecialChars::NBSPACE && gid != SpecialChars::NNBSPACE) + QChar chr(gid); + if (chr != SpecialChars::NBSPACE && chr != SpecialChars::NNBSPACE) gid = 32; } QTransform chma, chma4; Modified: trunk/Scribus/scribus/text/storytext.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24786&path=/trunk/Scribus/scribus/text/storytext.cpp ============================================================================== --- trunk/Scribus/scribus/text/storytext.cpp (original) +++ trunk/Scribus/scribus/text/storytext.cpp Tue Dec 28 15:43:02 2021 @@ -581,7 +581,8 @@ void StoryText::removeParSep(int pos) { ScText* it = item(pos); - if (it->parstyle) { + if (it->parstyle) + { // const CharStyle* oldP = & it->parstyle->charStyle(); // const CharStyle* newP = & that->paragraphStyle(pos+1).charStyle(); // d->replaceParentStyle(pos, oldP, newP); @@ -590,7 +591,7 @@ } // demote this parsep so the assert code in replaceCharStyleContextInParagraph() // doesn't choke: - it->ch = 0; + it->ch = QChar(); d->replaceCharStyleContextInParagraph(pos, paragraphStyle(pos+1).charStyleContext()); } From scribus-commit at lists.scribus.net Tue Dec 28 16:25:32 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Tue, 28 Dec 2021 16:25:32 -0000 Subject: r24787 by craig - #16705: Related.. select the top leve item to enable buttons. Rename Message-ID: Author: craig Date: Tue Dec 28 16:25:31 2021 New Revision: 24787 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24787 Log: #16705: Related.. select the top leve item to enable buttons. Rename some variables to more generic names Modified: trunk/Scribus/scribus/scribus.cpp trunk/Scribus/scribus/ui/colorsandfills.cpp trunk/Scribus/scribus/ui/colorsandfills.h Modified: trunk/Scribus/scribus/scribus.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24787&path=/trunk/Scribus/scribus/scribus.cpp ============================================================================== --- trunk/Scribus/scribus/scribus.cpp (original) +++ trunk/Scribus/scribus/scribus.cpp Tue Dec 28 16:25:31 2021 @@ -9160,27 +9160,27 @@ void ScribusMainWindow::manageColorsAndFills() { - ColorList edc; - QHash *Gradients; - QHash *docPatterns; + ColorList colorlist; + QHash *gradients; + QHash *patterns; ScribusDoc* tmpDoc; if (HaveDoc) { - Gradients = &doc->docGradients; - edc = doc->PageColors; - docPatterns = &doc->docPatterns; + gradients = &doc->docGradients; + colorlist = doc->PageColors; + patterns = &doc->docPatterns; tmpDoc = doc; } else { - Gradients = &m_prefsManager.appPrefs.defaultGradients; - edc = m_prefsManager.colorSet(); - docPatterns = &m_prefsManager.appPrefs.defaultPatterns; + gradients = &m_prefsManager.appPrefs.defaultGradients; + colorlist = m_prefsManager.colorSet(); + patterns = &m_prefsManager.appPrefs.defaultPatterns; tmpDoc = m_doc; doc = m_doc; } m_undoManager->setUndoEnabled(false); - ColorsAndFillsDialog *dia = new ColorsAndFillsDialog(this, Gradients, edc, m_prefsManager.colorSetName(), docPatterns, tmpDoc, this); + ColorsAndFillsDialog *dia = new ColorsAndFillsDialog(this, gradients, colorlist, m_prefsManager.colorSetName(), patterns, tmpDoc, this); if (dia->exec()) { if (HaveDoc) Modified: trunk/Scribus/scribus/ui/colorsandfills.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24787&path=/trunk/Scribus/scribus/ui/colorsandfills.cpp ============================================================================== --- trunk/Scribus/scribus/ui/colorsandfills.cpp (original) +++ trunk/Scribus/scribus/ui/colorsandfills.cpp Tue Dec 28 16:25:31 2021 @@ -68,15 +68,15 @@ #include "util_color.h" #include "util_formats.h" -ColorsAndFillsDialog::ColorsAndFillsDialog(QWidget* parent, QHash *docGradients, const ColorList& doco, const QString& docColSet, QHash *docPatterns, ScribusDoc *doc, ScribusMainWindow *scMW) - : QDialog(parent), - m_doc(doc), - mainWin(scMW) +ColorsAndFillsDialog::ColorsAndFillsDialog(QWidget* parent, QHash *gradients, const ColorList& colorlist, const QString& docColSet, QHash *patterns, ScribusDoc *doc, ScribusMainWindow *scMW) + : QDialog(parent), + m_doc(doc), + mainWin(scMW) { setupUi(this); setModal(true); - m_colorList = doco; + m_colorList = colorlist; setWindowIcon(IconManager::instance().loadIcon("AppIcon.png")); dataTree->setContextMenuPolicy(Qt::CustomContextMenu); @@ -85,21 +85,21 @@ colorItems->setText(0, tr("Solid Colors")); gradientItems = new QTreeWidgetItem(dataTree); gradientItems->setText(0, tr("Gradients")); - for (QHash::Iterator it = docGradients->begin(); it != docGradients->end(); ++it) + for (QHash::Iterator it = gradients->begin(); it != gradients->end(); ++it) { dialogGradients.insert(it.key(), it.value()); origNames.insert(it.key(), it.key()); } - origGradients = docGradients->keys(); + origGradients = gradients->keys(); patternItems = new QTreeWidgetItem(dataTree); patternItems->setText(0, tr("Patterns")); - for (QHash::Iterator it = docPatterns->begin(); it != docPatterns->end(); ++it) + for (QHash::Iterator it = patterns->begin(); it != patterns->end(); ++it) { dialogPatterns.insert(it.key(), it.value()); origNamesPatterns.insert(it.key(), it.key()); } - origPatterns = docPatterns->keys(); + origPatterns = patterns->keys(); csm.findPaletteLocations(); systemSwatches = LoadColSet->addTopLevelItem( tr("Scribus Swatches")); @@ -147,6 +147,8 @@ dataTree->expandItem(gradientItems); dataTree->expandItem(patternItems); dataTree->setSelectionMode(QAbstractItemView::ExtendedSelection); + dataTree->setCurrentItem(dataTree->topLevelItem(0)); + itemSelected(dataTree->currentItem()); connect(dataTree, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(itemSelected(QTreeWidgetItem*))); connect(dataTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(selEditColor(QTreeWidgetItem*))); connect(dataTree, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged())); Modified: trunk/Scribus/scribus/ui/colorsandfills.h URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24787&path=/trunk/Scribus/scribus/ui/colorsandfills.h ============================================================================== --- trunk/Scribus/scribus/ui/colorsandfills.h (original) +++ trunk/Scribus/scribus/ui/colorsandfills.h Tue Dec 28 16:25:31 2021 @@ -40,7 +40,7 @@ Q_OBJECT public: - ColorsAndFillsDialog(QWidget* parent, QHash *docGradients, const ColorList& doco, const QString& docColSet, QHash *docPatterns, ScribusDoc *doc, ScribusMainWindow* scMW); + ColorsAndFillsDialog(QWidget* parent, QHash *docGradients, const ColorList& colorlist, const QString& docColSet, QHash *docPatterns, ScribusDoc *doc, ScribusMainWindow* scMW); ~ColorsAndFillsDialog() {} /*! \brief Returns the name of the current/selected color set. From scribus-commit at lists.scribus.net Wed Dec 29 10:14:36 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Wed, 29 Dec 2021 10:14:36 -0000 Subject: r24788 by craig - #16705: Fix colours and fills menu not opening properly due to menu Message-ID: Author: craig Date: Wed Dec 29 10:14:35 2021 New Revision: 24788 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24788 Log: #16705: Fix colours and fills menu not opening properly due to menu ownership Modified: trunk/Scribus/scribus/ui/swatchcombo.cpp Modified: trunk/Scribus/scribus/ui/swatchcombo.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24788&path=/trunk/Scribus/scribus/ui/swatchcombo.cpp ============================================================================== --- trunk/Scribus/scribus/ui/swatchcombo.cpp (original) +++ trunk/Scribus/scribus/ui/swatchcombo.cpp Wed Dec 29 10:14:35 2021 @@ -32,7 +32,7 @@ dataTree = new QTreeWidget(nullptr); dataTree->setHeaderHidden(true); dataTree->setMinimumSize(QSize(140, 200)); - popUp = new QMenu(); + popUp = new QMenu(this); popUpAct = new QWidgetAction(this); popUpAct->setDefaultWidget(dataTree); popUp->addAction(popUpAct); From scribus-commit at lists.scribus.net Thu Dec 30 17:03:38 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Thu, 30 Dec 2021 17:03:38 -0000 Subject: r24789 by craig - Bump TS files from Transifex Message-ID: Author: craig Date: Thu Dec 30 17:03:38 2021 New Revision: 24789 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24789 Log: Bump TS files from Transifex Modified: trunk/Scribus/resources/translations/scribus.af.ts trunk/Scribus/resources/translations/scribus.ar.ts trunk/Scribus/resources/translations/scribus.az.ts trunk/Scribus/resources/translations/scribus.be.ts trunk/Scribus/resources/translations/scribus.bg.ts trunk/Scribus/resources/translations/scribus.bn_IN.ts trunk/Scribus/resources/translations/scribus.br.ts trunk/Scribus/resources/translations/scribus.ca.ts trunk/Scribus/resources/translations/scribus.cs_CZ.ts trunk/Scribus/resources/translations/scribus.cy.ts trunk/Scribus/resources/translations/scribus.da_DK.ts trunk/Scribus/resources/translations/scribus.de.ts trunk/Scribus/resources/translations/scribus.de_1901.ts trunk/Scribus/resources/translations/scribus.de_CH.ts trunk/Scribus/resources/translations/scribus.el.ts trunk/Scribus/resources/translations/scribus.en_AU.ts trunk/Scribus/resources/translations/scribus.en_GB.ts trunk/Scribus/resources/translations/scribus.en_US.ts trunk/Scribus/resources/translations/scribus.eo.ts trunk/Scribus/resources/translations/scribus.es_AR.ts trunk/Scribus/resources/translations/scribus.es_ES.ts trunk/Scribus/resources/translations/scribus.et.ts trunk/Scribus/resources/translations/scribus.eu.ts trunk/Scribus/resources/translations/scribus.fa_IR.ts trunk/Scribus/resources/translations/scribus.fi.ts trunk/Scribus/resources/translations/scribus.fr.ts trunk/Scribus/resources/translations/scribus.gl.ts trunk/Scribus/resources/translations/scribus.he_IL.ts trunk/Scribus/resources/translations/scribus.hi_IN.ts trunk/Scribus/resources/translations/scribus.hr_HR.ts trunk/Scribus/resources/translations/scribus.hu.ts trunk/Scribus/resources/translations/scribus.id.ts trunk/Scribus/resources/translations/scribus.it.ts trunk/Scribus/resources/translations/scribus.ja.ts trunk/Scribus/resources/translations/scribus.kab.ts trunk/Scribus/resources/translations/scribus.kn_IN.ts trunk/Scribus/resources/translations/scribus.ko.ts trunk/Scribus/resources/translations/scribus.lt_LT.ts trunk/Scribus/resources/translations/scribus.ml.ts trunk/Scribus/resources/translations/scribus.mn_MN.ts trunk/Scribus/resources/translations/scribus.ms_MY.ts trunk/Scribus/resources/translations/scribus.nb_NO.ts trunk/Scribus/resources/translations/scribus.nl.ts trunk/Scribus/resources/translations/scribus.nn_NO.ts trunk/Scribus/resources/translations/scribus.oc.ts trunk/Scribus/resources/translations/scribus.pl_PL.ts trunk/Scribus/resources/translations/scribus.pms.ts trunk/Scribus/resources/translations/scribus.pt.ts trunk/Scribus/resources/translations/scribus.pt_BR.ts trunk/Scribus/resources/translations/scribus.pt_PT.ts trunk/Scribus/resources/translations/scribus.ru.ts trunk/Scribus/resources/translations/scribus.sa.ts trunk/Scribus/resources/translations/scribus.si.ts trunk/Scribus/resources/translations/scribus.sk_SK.ts trunk/Scribus/resources/translations/scribus.sl.ts trunk/Scribus/resources/translations/scribus.so.ts trunk/Scribus/resources/translations/scribus.sq.ts trunk/Scribus/resources/translations/scribus.sr.ts trunk/Scribus/resources/translations/scribus.sv.ts trunk/Scribus/resources/translations/scribus.ta.ts trunk/Scribus/resources/translations/scribus.te.ts trunk/Scribus/resources/translations/scribus.th_TH.ts trunk/Scribus/resources/translations/scribus.tr.ts trunk/Scribus/resources/translations/scribus.uk.ts trunk/Scribus/resources/translations/scribus.zh_CN.ts trunk/Scribus/resources/translations/scribus.zh_TW.ts [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/Scribus/resources/translations/scribus.af.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.af.ts Modified: trunk/Scribus/resources/translations/scribus.ar.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.ar.ts Modified: trunk/Scribus/resources/translations/scribus.az.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.az.ts Modified: trunk/Scribus/resources/translations/scribus.be.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.be.ts Modified: trunk/Scribus/resources/translations/scribus.bg.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.bg.ts Modified: trunk/Scribus/resources/translations/scribus.bn_IN.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.bn_IN.ts Modified: trunk/Scribus/resources/translations/scribus.br.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.br.ts Modified: trunk/Scribus/resources/translations/scribus.ca.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.ca.ts Modified: trunk/Scribus/resources/translations/scribus.cs_CZ.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.cs_CZ.ts Modified: trunk/Scribus/resources/translations/scribus.cy.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.cy.ts Modified: trunk/Scribus/resources/translations/scribus.da_DK.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.da_DK.ts Modified: trunk/Scribus/resources/translations/scribus.de.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.de.ts Modified: trunk/Scribus/resources/translations/scribus.de_1901.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.de_1901.ts Modified: trunk/Scribus/resources/translations/scribus.de_CH.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.de_CH.ts Modified: trunk/Scribus/resources/translations/scribus.el.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.el.ts Modified: trunk/Scribus/resources/translations/scribus.en_AU.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.en_AU.ts Modified: trunk/Scribus/resources/translations/scribus.en_GB.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.en_GB.ts Modified: trunk/Scribus/resources/translations/scribus.en_US.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.en_US.ts Modified: trunk/Scribus/resources/translations/scribus.eo.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.eo.ts Modified: trunk/Scribus/resources/translations/scribus.es_AR.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.es_AR.ts Modified: trunk/Scribus/resources/translations/scribus.es_ES.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.es_ES.ts Modified: trunk/Scribus/resources/translations/scribus.et.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.et.ts Modified: trunk/Scribus/resources/translations/scribus.eu.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.eu.ts Modified: trunk/Scribus/resources/translations/scribus.fa_IR.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.fa_IR.ts Modified: trunk/Scribus/resources/translations/scribus.fi.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.fi.ts Modified: trunk/Scribus/resources/translations/scribus.fr.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.fr.ts Modified: trunk/Scribus/resources/translations/scribus.gl.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.gl.ts Modified: trunk/Scribus/resources/translations/scribus.he_IL.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.he_IL.ts Modified: trunk/Scribus/resources/translations/scribus.hi_IN.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.hi_IN.ts Modified: trunk/Scribus/resources/translations/scribus.hr_HR.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.hr_HR.ts Modified: trunk/Scribus/resources/translations/scribus.hu.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.hu.ts Modified: trunk/Scribus/resources/translations/scribus.id.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.id.ts Modified: trunk/Scribus/resources/translations/scribus.it.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.it.ts Modified: trunk/Scribus/resources/translations/scribus.ja.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.ja.ts Modified: trunk/Scribus/resources/translations/scribus.kab.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.kab.ts Modified: trunk/Scribus/resources/translations/scribus.kn_IN.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.kn_IN.ts Modified: trunk/Scribus/resources/translations/scribus.ko.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.ko.ts Modified: trunk/Scribus/resources/translations/scribus.lt_LT.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.lt_LT.ts Modified: trunk/Scribus/resources/translations/scribus.ml.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.ml.ts Modified: trunk/Scribus/resources/translations/scribus.mn_MN.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.mn_MN.ts Modified: trunk/Scribus/resources/translations/scribus.ms_MY.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.ms_MY.ts Modified: trunk/Scribus/resources/translations/scribus.nb_NO.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.nb_NO.ts Modified: trunk/Scribus/resources/translations/scribus.nl.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.nl.ts Modified: trunk/Scribus/resources/translations/scribus.nn_NO.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.nn_NO.ts Modified: trunk/Scribus/resources/translations/scribus.oc.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.oc.ts Modified: trunk/Scribus/resources/translations/scribus.pl_PL.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.pl_PL.ts Modified: trunk/Scribus/resources/translations/scribus.pms.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.pms.ts Modified: trunk/Scribus/resources/translations/scribus.pt.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.pt.ts Modified: trunk/Scribus/resources/translations/scribus.pt_BR.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.pt_BR.ts Modified: trunk/Scribus/resources/translations/scribus.pt_PT.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.pt_PT.ts Modified: trunk/Scribus/resources/translations/scribus.ru.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.ru.ts Modified: trunk/Scribus/resources/translations/scribus.sa.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.sa.ts Modified: trunk/Scribus/resources/translations/scribus.si.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.si.ts Modified: trunk/Scribus/resources/translations/scribus.sk_SK.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.sk_SK.ts Modified: trunk/Scribus/resources/translations/scribus.sl.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.sl.ts Modified: trunk/Scribus/resources/translations/scribus.so.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.so.ts Modified: trunk/Scribus/resources/translations/scribus.sq.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.sq.ts Modified: trunk/Scribus/resources/translations/scribus.sr.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.sr.ts Modified: trunk/Scribus/resources/translations/scribus.sv.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.sv.ts Modified: trunk/Scribus/resources/translations/scribus.ta.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.ta.ts Modified: trunk/Scribus/resources/translations/scribus.te.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.te.ts Modified: trunk/Scribus/resources/translations/scribus.th_TH.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.th_TH.ts Modified: trunk/Scribus/resources/translations/scribus.tr.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.tr.ts Modified: trunk/Scribus/resources/translations/scribus.uk.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.uk.ts Modified: trunk/Scribus/resources/translations/scribus.zh_CN.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.zh_CN.ts Modified: trunk/Scribus/resources/translations/scribus.zh_TW.ts URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24789&path=/trunk/Scribus/resources/translations/scribus.zh_TW.ts From scribus-commit at lists.scribus.net Fri Dec 31 16:54:07 2021 From: scribus-commit at lists.scribus.net (scribus-commit) Date: Fri, 31 Dec 2021 16:54:07 -0000 Subject: r24790 by jghali - Fix fallback style values in search and replace dialog Message-ID: Author: jghali Date: Fri Dec 31 16:54:07 2021 New Revision: 24790 URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24790 Log: Fix fallback style values in search and replace dialog Modified: trunk/Scribus/scribus/ui/search.cpp Modified: trunk/Scribus/scribus/ui/search.cpp URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24790&path=/trunk/Scribus/scribus/ui/search.cpp ============================================================================== --- trunk/Scribus/scribus/ui/search.cpp (original) +++ trunk/Scribus/scribus/ui/search.cpp Fri Dec 31 16:54:07 2021 @@ -1160,7 +1160,7 @@ searchTextCheckBox->setChecked(m_prefs->getBool("SText", true)); replaceEffectCheckBox->setChecked(m_prefs->getBool("REffect", false)); searchTextLineEdit->setText(m_prefs->get("STextVal", "")); - int tmp = m_prefs->getInt("SStyleVal", findParagraphStyle(m_doc, m_doc->currentStyle)); + int tmp = m_prefs->getInt("SStyleVal", findParagraphStyle(m_doc, m_doc->currentStyle.parent())); if (tmp < 0 || tmp >= searchStyleValue->count()) tmp = 0; searchStyleValue->setCurrentIndex(tmp); @@ -1182,7 +1182,7 @@ replaceStyleCheckBox->setChecked(m_prefs->getBool("RStyle", false)); replaceTextCheckBox->setChecked(m_prefs->getBool("RText", true)); replaceTextLineEdit->setText(m_prefs->get("RTextVal", "")); - tmp = m_prefs->getInt("RStyleVal", findParagraphStyle(m_doc, m_doc->currentStyle)); + tmp = m_prefs->getInt("RStyleVal", findParagraphStyle(m_doc, m_doc->currentStyle.parent())); if (tmp < 0 || tmp >= replaceStyleValue->count()) tmp = 0; replaceStyleValue->setCurrentIndex(tmp);