Author: avox
Date: Fri May 31 13:17:00 2019
New Revision: 22992

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22992
Log:
LOD patch #123: unify 'No Style' with default style / keep direct formatting 
when applying parstyle / make charstyle sticky when deleting all text from 
textframe. No fileformat changes

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/text/storytext.cpp
    trunk/Scribus/scribus/text/storytext.h
    trunk/Scribus/scribus/ui/spalette.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22992&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp        (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp        Fri May 31 13:17:00 2019
@@ -7883,7 +7883,7 @@
 {
        ParagraphStyle newStyle;
        newStyle.setParent(name.isEmpty()? BaseStyle::INHERIT_PARENT : name);
-       itemSelection_ApplyParagraphStyle(newStyle, customSelection, true);
+       itemSelection_ApplyParagraphStyle(newStyle, customSelection, false);
 }
 
 

Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22992&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp    (original)
+++ trunk/Scribus/scribus/text/storytext.cpp    Fri May 31 13:17:00 2019
@@ -58,6 +58,7 @@
        m_shapedTextCache = new ShapedTextCache();
        
        d->len = 0;
+    orphanedCharStyle = defaultStyle().charStyle();
        invalidateAll();
 }
 
@@ -555,6 +556,13 @@
        if (pos + static_cast<int>(len) > length())
                len = length() - pos;
 
+    if (pos == 0 && len > 0 && len == length())
+    {
+        int lastChar = length() - 1;
+        while (lastChar > 0 && text(lastChar) == SpecialChars::PARSEP)
+            --lastChar;
+        orphanedCharStyle = charStyle(lastChar);
+    }
        for (int i = pos + static_cast<int>(len) - 1; i >= pos; --i)
        {
                ScText *it = d->at(i);
@@ -1152,7 +1160,7 @@
        if (length() == 0)
        {
 //             qDebug() << "storytext::charstyle: default";
-               return defaultStyle().charStyle();
+               return orphanedCharStyle;
        }
        if (pos == length())
        {

Modified: trunk/Scribus/scribus/text/storytext.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22992&path=/trunk/Scribus/scribus/text/storytext.h
==============================================================================
--- trunk/Scribus/scribus/text/storytext.h      (original)
+++ trunk/Scribus/scribus/text/storytext.h      Fri May 31 13:17:00 2019
@@ -283,6 +283,7 @@
 private:
        ScribusDoc * m_doc; 
        int m_selFirst, m_selLast;
+    CharStyle orphanedCharStyle;
        ShapedTextCache* m_shapedTextCache;
        static BreakIterator* m_graphemeIterator;
        static BreakIterator* m_wordIterator;

Modified: trunk/Scribus/scribus/ui/spalette.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22992&path=/trunk/Scribus/scribus/ui/spalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/spalette.cpp       (original)
+++ trunk/Scribus/scribus/ui/spalette.cpp       Fri May 31 13:17:00 2019
@@ -32,7 +32,7 @@
 ParaStyleComboBox::ParaStyleComboBox(QWidget* parent) : QComboBox(parent)
 {
        setEditable(false);
-       addItem( tr("No Style"));
+    addItem( CommonStrings::trDefaultParagraphStyle );
        currentDoc = nullptr;
        connect(this, SIGNAL(activated(int)), this, SLOT(selFormat(int)));
 }
@@ -45,7 +45,7 @@
 
 void ParaStyleComboBox::setFormat(const QString& name)
 {
-       setCurrentComboItem(this, name.isEmpty() ? tr("No Style") : name);
+       setCurrentComboItem(this, name.isEmpty() ? 
CommonStrings::trDefaultParagraphStyle : name);
 }
 
 void ParaStyleComboBox::updateFormatList()
@@ -59,10 +59,10 @@
        if (currentDoc != nullptr)
        {
                QStringList st;
-               addItem( tr("No Style"));
+               addItem( CommonStrings::trDefaultParagraphStyle );
                for (int x = 0; x < currentDoc->paragraphStyles().count(); ++x)
                {
-                       if ( !currentDoc->paragraphStyles()[x].name().isEmpty() 
)
+                       if ( !currentDoc->paragraphStyles()[x].name().isEmpty() 
&& !currentDoc->paragraphStyles()[x].isDefaultStyle())
                                
st.append(currentDoc->paragraphStyles()[x].name());
                }
                st.sort();
@@ -96,7 +96,7 @@
 CharStyleComboBox::CharStyleComboBox(QWidget* parent) : QComboBox(parent)
 {
        setEditable(false);
-       addItem( tr("No Style"));
+    addItem( CommonStrings::trDefaultCharacterStyle );
        currentDoc = nullptr;
        connect(this, SIGNAL(activated(int)), this, SLOT(selFormat(int)));
 }
@@ -109,7 +109,7 @@
 
 void CharStyleComboBox::setFormat(const QString& name)
 {
-       setCurrentComboItem(this, name.isEmpty() ? tr("No Style") : name);
+       setCurrentComboItem(this, name.isEmpty() ? 
CommonStrings::trDefaultCharacterStyle : name);
 }
 
 void CharStyleComboBox::updateFormatList()
@@ -123,10 +123,11 @@
        if (currentDoc != nullptr)
        {
                QStringList st;
-               addItem( tr("No Style"));
+               addItem( CommonStrings::trDefaultCharacterStyle );
                for (int x = 0; x < currentDoc->charStyles().count(); ++x)
                {
-                       if ( !currentDoc->charStyles()[x].name().isEmpty() )
+                       if ( !currentDoc->charStyles()[x].name().isEmpty() &&
+                !currentDoc->charStyles()[x].isDefaultStyle())
                                st.append(currentDoc->charStyles()[x].name());
                }
                st.sort();
@@ -160,7 +161,7 @@
 CellStyleComboBox::CellStyleComboBox(QWidget* parent) : QComboBox(parent)
 {
        setEditable(false);
-       addItem( tr("No Style"));
+    addItem( CommonStrings::trDefaultCellStyle );
        currentDoc = nullptr;
        connect(this, SIGNAL(activated(int)), this, SLOT(selFormat(int)));
 }
@@ -173,7 +174,7 @@
 
 void CellStyleComboBox::setFormat(const QString& name)
 {
-       setCurrentComboItem(this, name.isEmpty() ? tr("No Style") : name);
+       setCurrentComboItem(this, name.isEmpty() ? 
CommonStrings::trDefaultCellStyle : name);
 }
 
 void CellStyleComboBox::updateFormatList()
@@ -187,10 +188,11 @@
        if (currentDoc != nullptr)
        {
                QStringList st;
-               addItem( tr("No Style"));
+               addItem( CommonStrings::trDefaultCellStyle  );
                for (int x = 0; x < currentDoc->cellStyles().count(); ++x)
                {
-                       if ( !currentDoc->cellStyles()[x].name().isEmpty() )
+                       if ( !currentDoc->cellStyles()[x].name().isEmpty() &&
+                !currentDoc->cellStyles()[x].isDefaultStyle())
                                st.append(currentDoc->cellStyles()[x].name());
                }
                st.sort();
@@ -225,7 +227,7 @@
 TableStyleComboBox::TableStyleComboBox(QWidget* parent) : QComboBox(parent)
 {
        setEditable(false);
-       addItem( tr("No Style"));
+       addItem( CommonStrings::trDefaultTableStyle );
        currentDoc = nullptr;
        connect(this, SIGNAL(activated(int)), this, SLOT(selFormat(int)));
 }
@@ -238,7 +240,7 @@
 
 void TableStyleComboBox::setFormat(const QString& name)
 {
-       setCurrentComboItem(this, name.isEmpty() ? tr("No Style") : name);
+       setCurrentComboItem(this, name.isEmpty() ? 
CommonStrings::trDefaultTableStyle : name);
 }
 
 void TableStyleComboBox::updateFormatList()
@@ -252,10 +254,11 @@
        if (currentDoc != nullptr)
        {
                QStringList st;
-               addItem( tr("No Style"));
+               addItem( CommonStrings::trDefaultTableStyle );
                for (int x = 0; x < currentDoc->tableStyles().count(); ++x)
                {
-                       if ( !currentDoc->tableStyles()[x].name().isEmpty() )
+                       if ( !currentDoc->tableStyles()[x].name().isEmpty() &&
+                !currentDoc->tableStyles()[x].isDefaultStyle())
                                st.append(currentDoc->tableStyles()[x].name());
                }
                st.sort();


_______________________________________________
scribus-commit mailing list
[email protected]
http://lists.scribus.net/mailman/listinfo/scribus-commit

Reply via email to