diff --git a/resources/iconsets/1_7_0/16/table-area.svg b/resources/iconsets/1_7_0/16/table-area.svg
new file mode 100644
index 000000000..387356a8d
--- /dev/null
+++ b/resources/iconsets/1_7_0/16/table-area.svg
@@ -0,0 +1,4 @@
+
diff --git a/resources/iconsets/1_7_0/1_7_0.xml b/resources/iconsets/1_7_0/1_7_0.xml
index 310a06f17..6880d7635 100644
--- a/resources/iconsets/1_7_0/1_7_0.xml
+++ b/resources/iconsets/1_7_0/1_7_0.xml
@@ -478,6 +478,7 @@ On Dark: #e580ff; rgb(229, 128, 255); hsl(288, 100, 75)
+
diff --git a/scribus/ui/colorpicker/colorpicker.cpp b/scribus/ui/colorpicker/colorpicker.cpp
index b093ef131..dd80efcfa 100644
--- a/scribus/ui/colorpicker/colorpicker.cpp
+++ b/scribus/ui/colorpicker/colorpicker.cpp
@@ -304,6 +304,8 @@ void ColorPicker::setContext(Context config)
case Context::Text:
case Context::TextBackground:
case Context::TextOutline:
+ case Context::TableCellFill:
+ case Context::TableCellStroke:
buttonSolid->setVisible(false);
buttonGradient->setVisible(false);
buttonHatch->setVisible(false);
diff --git a/scribus/ui/colorpicker/colorpicker_color.cpp b/scribus/ui/colorpicker/colorpicker_color.cpp
index ac0907a1c..75715845b 100644
--- a/scribus/ui/colorpicker/colorpicker_color.cpp
+++ b/scribus/ui/colorpicker/colorpicker_color.cpp
@@ -88,24 +88,11 @@ void ColorPickerColor::setContext(Context config)
case Context::Text:
case Context::TextBackground:
case Context::TextOutline:
- sectionSwatches->setVisible(true);
- numberShade->setVisible(true);
- labelShade->setVisible(true);
- sliderShade->setVisible(true);
- numberAlpha->setVisible(false);
- labelAlpha->setVisible(false);
- sliderAlpha->setVisible(false);
- break;
+ case Context::TableCellFill:
+ case Context::TableCellStroke:
case Context::Fill:
- sectionSwatches->setVisible(true);
- numberShade->setVisible(true);
- labelShade->setVisible(true);
- sliderShade->setVisible(true);
- numberAlpha->setVisible(false);
- labelAlpha->setVisible(false);
- sliderAlpha->setVisible(false);
- break;
case Context::Line:
+ case Context::DropShadow:
sectionSwatches->setVisible(true);
numberShade->setVisible(true);
labelShade->setVisible(true);
@@ -125,15 +112,6 @@ void ColorPickerColor::setContext(Context config)
sliderAlpha->setVisible(true);
isMask = true;
break;
- case Context::DropShadow:
- sectionSwatches->setVisible(true);
- numberShade->setVisible(true);
- labelShade->setVisible(true);
- sliderShade->setVisible(true);
- numberAlpha->setVisible(false);
- labelAlpha->setVisible(false);
- sliderAlpha->setVisible(false);
- break;
}
updateSize();
diff --git a/scribus/ui/smcellstyle.cpp b/scribus/ui/smcellstyle.cpp
index cca89255b..4d2be5dba 100644
--- a/scribus/ui/smcellstyle.cpp
+++ b/scribus/ui/smcellstyle.cpp
@@ -422,8 +422,8 @@ void SMCellStyle::setupConnections()
{
if (!m_page)
return;
- connect(m_page->fillColor, SIGNAL(currentTextChanged(QString)), this, SLOT(slotFillColor()));
- connect(m_page->fillShade, SIGNAL(clicked()), this, SLOT(slotFillShade()));
+ connect(m_page->buttonFillColor->colorButton, SIGNAL(changed()), this, SLOT(slotFillColor()));
+ connect(m_page->buttonFillColor->parentButton, SIGNAL(clicked()), this, SLOT(slotFillColor()));
connect(m_page->parentCombo, SIGNAL(currentTextChanged(QString)), this, SLOT(slotParentChanged(QString)));
connect(m_page->cellPaddingWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(slotCellPaddingChanged(MarginStruct)));
connect(m_page, SIGNAL(bordersChanged(TableSides, TableBorder)), this, SLOT(slotBordersChanged(TableSides, TableBorder)));
@@ -433,8 +433,8 @@ void SMCellStyle::removeConnections()
{
if (!m_page)
return;
- disconnect(m_page->fillColor, SIGNAL(currentTextChanged(QString)), this, SLOT(slotFillColor()));
- disconnect(m_page->fillShade, SIGNAL(clicked()), this, SLOT(slotFillShade()));
+ disconnect(m_page->buttonFillColor->colorButton, SIGNAL(changed()), this, SLOT(slotFillColor()));
+ disconnect(m_page->buttonFillColor->parentButton, SIGNAL(clicked()), this, SLOT(slotFillColor()));
disconnect(m_page->parentCombo, SIGNAL(currentTextChanged(QString)), this, SLOT(slotParentChanged(QString)));
disconnect(m_page->cellPaddingWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(slotCellPaddingChanged(MarginStruct)));
disconnect(m_page, SIGNAL(bordersChanged(TableSides, TableBorder)), this, SLOT(slotBordersChanged(TableSides, TableBorder)));
@@ -442,40 +442,21 @@ void SMCellStyle::removeConnections()
void SMCellStyle::slotFillColor()
{
- if (m_page->fillColor->useParentValue())
- {
- for (int i = 0; i < m_selection.count(); ++i)
- m_selection[i]->resetFillColor();
- }
- else
- {
- QString col(m_page->fillColor->currentText());
- for (int i = 0; i < m_selection.count(); ++i)
- {
- m_selection[i]->setFillColor(col);
- }
- }
- if (!m_selectionIsDirty)
- {
- m_selectionIsDirty = true;
- emit selectionDirty();
- }
-}
-
-void SMCellStyle::slotFillShade()
-{
- if (m_page->fillShade->useParentValue())
+ if (m_page->buttonFillColor->useParentValue())
{
for (int i = 0; i < m_selection.count(); ++i)
{
+ m_selection[i]->resetFillColor();
m_selection[i]->resetFillShade();
}
}
else
{
- int fs = m_page->fillShade->getValue();
+ QString col = m_page->buttonFillColor->colorButton->colorName();
+ int fs = m_page->buttonFillColor->colorButton->colorData().Shade;
for (int i = 0; i < m_selection.count(); ++i)
{
+ m_selection[i]->setFillColor(col);
m_selection[i]->setFillShade(fs);
}
}
diff --git a/scribus/ui/smcellstyle.h b/scribus/ui/smcellstyle.h
index 1e7637c94..006bd8bff 100644
--- a/scribus/ui/smcellstyle.h
+++ b/scribus/ui/smcellstyle.h
@@ -94,7 +94,6 @@ private:
private slots:
void slotFillColor();
- void slotFillShade();
void slotParentChanged(const QString &parent);
void slotCellPaddingChanged(const MarginStruct &padding);
void slotBordersChanged(TableSides sides, const TableBorder& border);
diff --git a/scribus/ui/smcellstylewidget.cpp b/scribus/ui/smcellstylewidget.cpp
index 6a2689a41..daf58c24c 100644
--- a/scribus/ui/smcellstylewidget.cpp
+++ b/scribus/ui/smcellstylewidget.cpp
@@ -21,10 +21,13 @@ SMCellStyleWidget::SMCellStyleWidget(QWidget *parent)
{
setupUi(this);
- fillColor->setPixmapType(ColorCombo::fancyPixmaps);
- fillColor->addItem(CommonStrings::tr_NoneColor);
- borderLineColor->setPixmapType(ColorCombo::fancyPixmaps);
- borderLineColor->addItem(CommonStrings::tr_NoneColor);
+ buttonLineColor->colorButton->setContext(Context::TableCellStroke);
+ buttonLineColor->setColor(CommonStrings::tr_NoneColor);
+ buttonLineColor->setText(tr("Color"));
+
+ buttonFillColor->colorButton->setContext(Context::TableCellFill);
+ buttonFillColor->setColor(CommonStrings::tr_NoneColor);
+ buttonFillColor->setText(tr("Color"));
sideSelector->setInnerActive(false);
sideSelector->setStyle(TableSideSelector::CellStyle);
@@ -36,6 +39,7 @@ SMCellStyleWidget::SMCellStyleWidget(QWidget *parent)
iconSetChange();
connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
+ connect(buttonLineColor->colorButton, &ColorButton::changed, this, &SMCellStyleWidget::borderLineColorChanged);
}
void SMCellStyleWidget::changeEvent(QEvent *e)
@@ -49,8 +53,8 @@ void SMCellStyleWidget::changeEvent(QEvent *e)
void SMCellStyleWidget::iconSetChange()
{
IconManager& iconManager = IconManager::instance();
- fillColorIcon->setPixmap(iconManager.loadPixmap("color-fill"));
- fillShadeLabel->setPixmap(iconManager.loadPixmap("shade") );
+ buttonFillColor->setPixmap(iconManager.loadPixmap("color-fill"));
+ buttonLineColor->setPixmap(iconManager.loadPixmap("color-stroke"));
addBorderLineButton->setIcon(iconManager.loadIcon("stroke-add"));
removeBorderLineButton->setIcon(iconManager.loadIcon("stroke-remove"));
}
@@ -59,18 +63,14 @@ void SMCellStyleWidget::languageChange()
{
retranslateUi(this);
- if (fillColor->count() > 0)
- {
- bool fillColorBlocked = fillColor->blockSignals(true);
- fillColor->setItemText(0, CommonStrings::tr_NoneColor);
- fillColor->blockSignals(fillColorBlocked);
- }
- if (borderLineColor->count() > 0)
- {
- bool borderColorBlocked = borderLineColor->blockSignals(true);
- borderLineColor->setItemText(0, CommonStrings::tr_NoneColor);
- borderLineColor->blockSignals(borderColorBlocked);
- }
+ buttonLineColor->colorButton->setPersistentToolTip( tr("Border color of table cell"));
+ buttonLineColor->setText(tr("Color"));
+
+ buttonFillColor->colorButton->setPersistentToolTip( tr("Fill color of table cell"));
+ buttonFillColor->setText(tr("Color"));
+
+ borderLineStyleLabel->setText(tr("Type"));
+ borderLineWidthLabel->setText(tr("Width"));
}
void SMCellStyleWidget::updateBorderLineList()
@@ -99,9 +99,9 @@ void SMCellStyleWidget::updateBorderLineListItem()
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)
+ if (buttonLineColor->colorButton->colorName() != CommonStrings::None)
{
- QPixmap icon = getWidePixmap(getColor(borderLineColor->currentColor(), borderLineShade->value()));
+ QPixmap icon = getWidePixmap(getColor(buttonLineColor->colorButton->colorName(), buttonLineColor->colorButton->colorData().Shade));
item->setIcon(icon);
}
item->setText(text);
@@ -131,8 +131,6 @@ void SMCellStyleWidget::handleUpdateRequest(int updateFlags)
{
if (!m_Doc)
return;
- if (updateFlags & reqColorsUpdate)
- fillFillColorCombo(m_Doc->PageColors);
}
void SMCellStyleWidget::setDoc(ScribusDoc* doc)
@@ -148,7 +146,9 @@ void SMCellStyleWidget::setDoc(ScribusDoc* doc)
m_unitIndex = m_Doc->unitIndex();
cellPaddingWidget->setNewUnit(m_unitIndex);
- fillFillColorCombo(m_Doc->PageColors);
+ buttonLineColor->colorButton->setDoc(m_Doc);
+ buttonFillColor->colorButton->setDoc(m_Doc);
+
connect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int)));
}
@@ -163,17 +163,9 @@ void SMCellStyleWidget::show(CellStyle *cellStyle, QList &cellStyles,
const CellStyle *parent = dynamic_cast(cellStyle->parentStyle());
bool hasParent = cellStyle->hasParent() && parent != nullptr && parent->hasName() && cellStyle->parent() != "";
if (hasParent)
- {
- fillColor->setCurrentText(cellStyle->fillColor(), cellStyle->isInhFillColor());
- fillColor->setParentText(parent->fillColor());
- fillShade->setValue(qRound(cellStyle->fillShade()), cellStyle->isInhFillShade());
- fillShade->setParentValue(qRound(parent->fillShade()));
- }
+ buttonFillColor->setColor(cellStyle->fillColor(), qRound(cellStyle->fillShade()), parent->fillColor(), qRound(parent->fillShade()), cellStyle->isInhFillColor() && cellStyle->isInhFillShade());
else
- {
- fillColor->setCurrentText(cellStyle->fillColor());
- fillShade->setValue(qRound(cellStyle->fillShade()));
- }
+ buttonFillColor->setColor(cellStyle->fillColor(), qRound(cellStyle->fillShade()));
setBorders(cellStyle->leftBorder(), cellStyle->rightBorder(), cellStyle->topBorder(), cellStyle->bottomBorder());
@@ -234,10 +226,6 @@ void SMCellStyleWidget::showColors(const QList &cellStyles)
}
d = cellStyles[i]->fillShade();
}
- if (d == -30000)
- fillShade->setText( tr("Shade"));
- else
- fillShade->setValue(qRound(d));
QString s;
for (int i = 0; i < cellStyles.count(); ++i)
{
@@ -248,14 +236,8 @@ void SMCellStyleWidget::showColors(const QList &cellStyles)
}
s = cellStyles[i]->fillColor();
}
- if (s.isEmpty())
- {
- if (fillColor->itemText(fillColor->count() - 1) != "")
- fillColor->addItem("");
- fillColor->setCurrentIndex(fillColor->count() - 1);
- }
- else
- fillColor->setCurrentText(s);
+
+ buttonFillColor->setColor(s, qRound(d));
}
void SMCellStyleWidget::setBorders(const TableBorder& left, const TableBorder& right,
@@ -268,15 +250,6 @@ void SMCellStyleWidget::setBorders(const TableBorder& left, const TableBorder& r
on_sideSelector_selectionChanged();
}
-void SMCellStyleWidget::fillFillColorCombo(const ColorList &colors)
-{
- fillColor->clear();
- fillColor->setColors(colors, true);
- borderLineColor->clear();
- borderLineColor->setColors(colors, true);
-}
-
-
void SMCellStyleWidget::on_sideSelector_selectionChanged()
{
TableSides newSelection = sideSelector->selection();
@@ -353,12 +326,9 @@ void SMCellStyleWidget::on_borderLineList_currentRowChanged(int row)
{
borderLineWidth->setEnabled(false);
borderLineWidthLabel->setEnabled(false);
- borderLineColor->setEnabled(false);
- borderLineColorLabel->setEnabled(false);
+ buttonLineColor->setEnabled(false);
borderLineStyle->setEnabled(false);
borderLineStyleLabel->setEnabled(false);
- borderLineShade->setEnabled(false);
- borderLineShadeLabel->setEnabled(false);
return;
}
@@ -369,17 +339,13 @@ void SMCellStyleWidget::on_borderLineList_currentRowChanged(int row)
borderLineWidth->setEnabled(true);
borderLineWidthLabel->setEnabled(true);
- borderLineColor->setEnabled(true);
- borderLineColorLabel->setEnabled(true);
+ buttonLineColor->setEnabled(true);
borderLineStyle->setEnabled(true);
borderLineStyleLabel->setEnabled(true);
- borderLineShade->setEnabled(true);
- borderLineShadeLabel->setEnabled(true);
borderLineWidth->showValue(line.width());
- setCurrentComboItem(borderLineColor, line.color());
+ buttonLineColor->setColor(line.color(), line.shade());
borderLineStyle->setCurrentIndex(static_cast(line.style()) - 1);
- borderLineShade->setValue(line.shade());
}
void SMCellStyleWidget::on_addBorderLineButton_clicked()
@@ -414,29 +380,17 @@ void SMCellStyleWidget::on_borderLineWidth_valueChanged(double width)
emit bordersChanged(sideSelector->selection(), m_currentBorder);
}
-void SMCellStyleWidget::on_borderLineShade_valueChanged(double shade)
-{
- int index = borderLineList->currentRow();
- if (index < 0)
- return;
- TableBorderLine line = m_currentBorder.borderLines().at(index);
- line.setShade(shade);
- m_currentBorder.replaceBorderLine(index, line);
- mirrorCurrentBorderToSelectedSides();
- updateBorderLineListItem();
- emit bordersChanged(sideSelector->selection(), m_currentBorder);
-}
-
-void SMCellStyleWidget::on_borderLineColor_textActivated(const QString& colorName)
+void SMCellStyleWidget::borderLineColorChanged()
{
int index = borderLineList->currentRow();
if (index < 0)
return;
TableBorderLine line = m_currentBorder.borderLines().at(index);
- QString color = colorName;
- if (colorName == CommonStrings::tr_NoneColor)
+ QString color = buttonLineColor->colorButton->colorName();
+ if (color == CommonStrings::tr_NoneColor)
color = CommonStrings::None;
line.setColor(color);
+ line.setShade(buttonLineColor->colorButton->colorData().Shade);
m_currentBorder.replaceBorderLine(index, line);
mirrorCurrentBorderToSelectedSides();
updateBorderLineListItem();
diff --git a/scribus/ui/smcellstylewidget.h b/scribus/ui/smcellstylewidget.h
index 1944ceb92..a723a002c 100644
--- a/scribus/ui/smcellstylewidget.h
+++ b/scribus/ui/smcellstylewidget.h
@@ -60,13 +60,6 @@ class SMCellStyleWidget : public QWidget, public Ui::SMCellStyleWidget
* This function is called when the language is changed.
*/
void languageChange();
-
- /**
- * Populates the fill color combo with the given color list.
- *
- * @param colors list of colors to populate the combo with.
- */
- void fillFillColorCombo(const ColorList &colors);
void showColors(const QList &cellStyles);
void setBorders(const TableBorder& left, const TableBorder& right, const TableBorder& top, const TableBorder& bottom);
@@ -107,8 +100,7 @@ class SMCellStyleWidget : public QWidget, public Ui::SMCellStyleWidget
void on_addBorderLineButton_clicked();
void on_removeBorderLineButton_clicked();
void on_borderLineWidth_valueChanged(double width);
- void on_borderLineShade_valueChanged(double shade);
- void on_borderLineColor_textActivated(const QString& colorName);
+ void borderLineColorChanged();
void on_borderLineStyle_activated(int style);
};
diff --git a/scribus/ui/smcellstylewidget.ui b/scribus/ui/smcellstylewidget.ui
index 94cb585ef..02ab68107 100644
--- a/scribus/ui/smcellstylewidget.ui
+++ b/scribus/ui/smcellstylewidget.ui
@@ -6,11 +6,26 @@
0
0
- 364
- 418
+ 485
+ 392
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
-
-
@@ -30,85 +45,57 @@
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ 0
+ 0
+
+
+
+
-
-
-
- Colors
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 22
- 22
-
-
-
-
-
-
- fillColor
-
-
-
- -
-
-
- Fill Color
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
- -
-
-
- Fill Shade
-
-
-
-
-
-
+
+ -
+
+
+ Fill
+
+
-
-
-
- Qt::Orientation::Horizontal
-
-
-
- 40
- 20
-
-
-
+
+
-
+
+
+
+
+
+
+
-
-
-
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ 0
+ 0
+
+
+
+
+
-
@@ -117,19 +104,19 @@
- 3
+ 8
- 6
+ 8
- 6
+ 8
- 6
+ 8
- 6
+ 8
-
@@ -177,7 +164,7 @@
- 20
+ 0
40
@@ -229,172 +216,124 @@
-
-
+
- 3
+ 4
-
-
-
- QFormLayout::FieldGrowthPolicy::ExpandingFieldsGrow
+
+
+ false
-
- 3
+
+
-
- 3
+
+
+ -
+
+
+
+ 0
+ 0
+
-
-
-
-
- false
-
-
- Width:
-
-
- borderLineWidth
-
-
-
- -
-
-
- false
-
-
- Color:
-
-
- borderLineColor
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
-
- 100
- 0
-
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
-
- 100
- 0
-
-
-
-
-
+
+ Width
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 0
+
+
+
+
+
+
-
-
-
- 3
+
+
+
+ 0
+ 0
+
-
- 3
+
+ Type
-
-
-
-
- false
-
-
- Type:
-
-
- borderLineStyle
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
-
- 100
- 0
-
-
-
-
- -
-
-
- false
-
-
- Shade:
-
-
- borderLineShade
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
-
- 100
- 0
-
-
-
- %
-
-
- 0
-
-
- 100.000000000000000
-
-
- 100.000000000000000
-
-
-
-
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 0
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ 0
+ 0
+
+
+
@@ -443,7 +382,7 @@
- 20
+ 0
0
@@ -452,6 +391,12 @@
+
+ FormWidget
+ QWidget
+
+ 1
+
ScrSpinBox
QDoubleSpinBox
@@ -469,9 +414,9 @@
1
- ColorCombo
- QComboBox
-
+ SMColorButton
+ QToolButton
+
NewMarginWidget
@@ -479,16 +424,6 @@
1
-
- SMColorCombo
- QComboBox
-
-
-
- SMShadeButton
- QPushButton
-
-
diff --git a/scribus/ui/smtablestyle.cpp b/scribus/ui/smtablestyle.cpp
index ad6a30093..3d652229f 100644
--- a/scribus/ui/smtablestyle.cpp
+++ b/scribus/ui/smtablestyle.cpp
@@ -427,8 +427,8 @@ void SMTableStyle::setupConnections()
{
if (!m_page)
return;
- connect(m_page->fillColor, SIGNAL(currentTextChanged(QString)), this, SLOT(slotFillColor()));
- connect(m_page->fillShade, SIGNAL(clicked()), this, SLOT(slotFillShade()));
+ connect(m_page->buttonFillColor->colorButton, SIGNAL(changed()), this, SLOT(slotFillColor()));
+ connect(m_page->buttonFillColor->parentButton, SIGNAL(clicked()), this, SLOT(slotFillColor()));
connect(m_page->parentCombo, SIGNAL(currentTextChanged(QString)), this, SLOT(slotParentChanged(QString)));
connect(m_page, SIGNAL(bordersChanged(TableSides, TableBorder)), this, SLOT(slotBordersChanged(TableSides, TableBorder)));
connect(m_page->headerRowsSpinBox, SIGNAL(valueChanged(int)), this, SLOT(slotHeaderRows()));
@@ -447,8 +447,8 @@ void SMTableStyle::removeConnections()
{
if (!m_page)
return;
- disconnect(m_page->fillColor, SIGNAL(currentTextChanged(QString)), this, SLOT(slotFillColor()));
- disconnect(m_page->fillShade, SIGNAL(clicked()), this, SLOT(slotFillShade()));
+ disconnect(m_page->buttonFillColor->colorButton, SIGNAL(changed()), this, SLOT(slotFillColor()));
+ disconnect(m_page->buttonFillColor->parentButton, SIGNAL(clicked()), this, SLOT(slotFillColor()));
disconnect(m_page->parentCombo, SIGNAL(currentTextChanged(QString)), this, SLOT(slotParentChanged(QString)));
disconnect(m_page, SIGNAL(bordersChanged(TableSides, TableBorder)), this, SLOT(slotBordersChanged(TableSides, TableBorder)));
disconnect(m_page->headerRowsSpinBox, SIGNAL(valueChanged(int)), this, SLOT(slotHeaderRows()));
@@ -466,49 +466,36 @@ void SMTableStyle::removeConnections()
void SMTableStyle::slotFillColor()
{
TableArea area = m_page->currentArea();
- QString col = m_page->fillColor->currentText();
+ QString col = m_page->buttonFillColor->colorButton->colorName();
+ int fs = m_page->buttonFillColor->colorButton->colorData().Shade;
for (int i = 0; i < m_selection.count(); ++i)
{
if (area == TableArea::WholeTable)
{
- if (m_page->fillColor->useParentValue())
+ if (m_page->buttonFillColor->useParentValue())
+ {
m_selection[i]->resetFillColor();
+ m_selection[i]->resetFillShade();
+ }
else
+ {
m_selection[i]->setFillColor(col);
+ m_selection[i]->setFillShade(fs);
+ }
}
else
{
CellStyle cs = m_selection[i]->conditionalStyle(area);
cs.setFillColor(col);
- m_selection[i]->setConditionalStyle(area, cs);
- }
- }
- if (!m_selectionIsDirty)
- {
- m_selectionIsDirty = true;
- emit selectionDirty();
- }
-}
+ cs.setFillShade(fs);
-void SMTableStyle::slotFillShade()
-{
- TableArea area = m_page->currentArea();
- int fs = m_page->fillShade->getValue();
+ if (m_page->buttonFillColor->useParentValue())
+ {
+ cs.resetFillColor();
+ cs.resetFillShade();
+ }
- for (int i = 0; i < m_selection.count(); ++i)
- {
- if (area == TableArea::WholeTable)
- {
- if (m_page->fillShade->useParentValue())
- m_selection[i]->resetFillShade();
- else
- m_selection[i]->setFillShade(fs);
- }
- else
- {
- CellStyle cs = m_selection[i]->conditionalStyle(area);
- cs.setFillShade(fs);
m_selection[i]->setConditionalStyle(area, cs);
}
}
diff --git a/scribus/ui/smtablestyle.h b/scribus/ui/smtablestyle.h
index 65dbd0fd8..daa6cd0d0 100644
--- a/scribus/ui/smtablestyle.h
+++ b/scribus/ui/smtablestyle.h
@@ -93,7 +93,6 @@ private:
private slots:
void slotFillColor();
- void slotFillShade();
void slotParentChanged(const QString &parent);
void slotBordersChanged(TableSides sides, const TableBorder& border);
void slotHeaderRows();
diff --git a/scribus/ui/smtablestylewidget.cpp b/scribus/ui/smtablestylewidget.cpp
index 7ac3763e6..36bb9f0cb 100644
--- a/scribus/ui/smtablestylewidget.cpp
+++ b/scribus/ui/smtablestylewidget.cpp
@@ -21,17 +21,21 @@ SMTableStyleWidget::SMTableStyleWidget(QWidget *parent)
{
setupUi(this);
- fillColor->setPixmapType(ColorCombo::fancyPixmaps);
- fillColor->addItem(CommonStrings::tr_NoneColor);
- borderLineColor->setPixmapType(ColorCombo::fancyPixmaps);
- borderLineColor->addItem(CommonStrings::tr_NoneColor);
-
sideSelector->setInnerActive(false);
sideSelector->setStyle(TableSideSelector::TableStyle);
+ buttonLineColor->colorButton->setContext(Context::TableCellStroke);
+ buttonLineColor->setColor(CommonStrings::tr_NoneColor);
+ buttonLineColor->setText(tr("Color"));
+
+ buttonFillColor->colorButton->setContext(Context::TableCellFill);
+ buttonFillColor->setColor(CommonStrings::tr_NoneColor);
+ buttonFillColor->setText(tr("Color"));
+
iconSetChange();
connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
+ connect(buttonLineColor->colorButton, &ColorButton::changed, this, &SMTableStyleWidget::borderLineColorChanged);
}
void SMTableStyleWidget::changeEvent(QEvent *e)
@@ -45,19 +49,20 @@ void SMTableStyleWidget::changeEvent(QEvent *e)
void SMTableStyleWidget::iconSetChange()
{
IconManager& iconManager = IconManager::instance();
- fillColorIcon->setPixmap(iconManager.loadPixmap("color-fill"));
- fillShadeLabel->setPixmap(iconManager.loadPixmap("shade") );
addBorderLineButton->setIcon(iconManager.loadIcon("stroke-add"));
removeBorderLineButton->setIcon(iconManager.loadIcon("stroke-remove"));
cellStyleClearButton->setIcon(iconManager.loadIcon("reset"));
+ buttonFillColor->setPixmap(iconManager.loadPixmap("color-fill"));
+ buttonLineColor->setPixmap(iconManager.loadPixmap("color-stroke"));
+ labelCellStyle->setPixmap(iconManager.loadPixmap("table-cell-style"));
+ labelParagraphStyle->setPixmap(iconManager.loadPixmap("paragraph-style"));
+ editingAreaLabel->setPixmap(iconManager.loadPixmap("table-area"));
}
void SMTableStyleWidget::handleUpdateRequest(int updateFlags)
{
if (!m_Doc)
return;
- if (updateFlags & reqColorsUpdate)
- fillFillColorCombo(m_Doc->PageColors);
if (updateFlags & reqTextStylesUpdate)
{
paragraphStyleComboBox->updateStyleList();
@@ -74,7 +79,8 @@ void SMTableStyleWidget::setDoc(ScribusDoc* doc)
if (!m_Doc)
return;
- fillFillColorCombo(m_Doc->PageColors);
+ buttonLineColor->colorButton->setDoc(m_Doc);
+ buttonFillColor->colorButton->setDoc(m_Doc);
paragraphStyleComboBox->setDoc(m_Doc);
basedOnComboBox->setDoc(m_Doc);
connect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int)));
@@ -119,7 +125,9 @@ void SMTableStyleWidget::show(TableStyle *tableStyle, QList &tableSt
}
if (tableStyle->isDefaultStyle() || !hasParent)
+ {
parentCombo->setCurrentIndex(0);
+ }
else if (hasParent)
{
int index = parentCombo->findText(tableStyle->parentStyle()->name());
@@ -152,10 +160,6 @@ void SMTableStyleWidget::showColors(const QList &tableStyles)
}
d = tableStyles[i]->fillShade();
}
- if (d == -30000)
- fillShade->setText( tr("Shade"));
- else
- fillShade->setValue(qRound(d));
QString s;
for (int i = 0; i < tableStyles.count(); ++i)
{
@@ -166,26 +170,22 @@ void SMTableStyleWidget::showColors(const QList &tableStyles)
}
s = tableStyles[i]->fillColor();
}
- if (s.isEmpty())
- {
- if (fillColor->itemText(fillColor->count() - 1) != "")
- fillColor->addItem("");
- fillColor->setCurrentIndex(fillColor->count() - 1);
- }
- else
- fillColor->setCurrentText(s);
+
+ buttonFillColor->setColor(s, qRound(d));
}
void SMTableStyleWidget::languageChange()
{
retranslateUi(this);
- if (fillColor->count() > 0)
- {
- bool fillColorBlocked = fillColor->blockSignals(true);
- fillColor->setItemText(0, CommonStrings::tr_NoneColor);
- fillColor->blockSignals(fillColorBlocked);
- }
+ buttonLineColor->colorButton->setPersistentToolTip( tr("Border color of table"));
+ buttonLineColor->setText(tr("Color"));
+
+ buttonFillColor->colorButton->setPersistentToolTip( tr("Fill color of table"));
+ buttonFillColor->setText(tr("Color"));
+
+ borderLineStyleLabel->setText(tr("Type"));
+ borderLineWidthLabel->setText(tr("Width"));
}
void SMTableStyleWidget::setBorders(const TableBorder& left, const TableBorder& right,
@@ -220,14 +220,6 @@ void SMTableStyleWidget::setBorders(const TableBorder& left, const TableBorder&
on_sideSelector_selectionChanged();
}
-void SMTableStyleWidget::fillFillColorCombo(ColorList &colors)
-{
- fillColor->clear();
- fillColor->setColors(colors, true);
- borderLineColor->clear();
- borderLineColor->setColors(colors, true);
-}
-
void SMTableStyleWidget::on_sideSelector_selectionChanged()
{
TableSides newSelection = sideSelector->selection();
@@ -301,12 +293,9 @@ void SMTableStyleWidget::on_borderLineList_currentRowChanged(int row)
{
borderLineWidth->setEnabled(false);
borderLineWidthLabel->setEnabled(false);
- borderLineColor->setEnabled(false);
- borderLineColorLabel->setEnabled(false);
+ buttonLineColor->setEnabled(false);
borderLineStyle->setEnabled(false);
borderLineStyleLabel->setEnabled(false);
- borderLineShade->setEnabled(false);
- borderLineShadeLabel->setEnabled(false);
return;
}
@@ -317,17 +306,13 @@ void SMTableStyleWidget::on_borderLineList_currentRowChanged(int row)
borderLineWidth->setEnabled(true);
borderLineWidthLabel->setEnabled(true);
- borderLineColor->setEnabled(true);
- borderLineColorLabel->setEnabled(true);
+ buttonLineColor->setEnabled(true);
borderLineStyle->setEnabled(true);
borderLineStyleLabel->setEnabled(true);
- borderLineShade->setEnabled(true);
- borderLineShadeLabel->setEnabled(true);
borderLineWidth->showValue(line.width());
- setCurrentComboItem(borderLineColor, line.color());
+ buttonLineColor->setColor(line.color(), line.shade());
borderLineStyle->setCurrentIndex(static_cast(line.style()) - 1);
- borderLineShade->setValue(line.shade());
}
void SMTableStyleWidget::on_addBorderLineButton_clicked()
@@ -362,29 +347,17 @@ void SMTableStyleWidget::on_borderLineWidth_valueChanged(double width)
emit bordersChanged(sideSelector->selection(), m_currentBorder);
}
-void SMTableStyleWidget::on_borderLineShade_valueChanged(double shade)
+void SMTableStyleWidget::borderLineColorChanged()
{
int index = borderLineList->currentRow();
if (index < 0)
return;
TableBorderLine line = m_currentBorder.borderLines().at(index);
- line.setShade(shade);
- m_currentBorder.replaceBorderLine(index, line);
- mirrorCurrentBorderToSelectedSides();
- updateBorderLineListItem();
- emit bordersChanged(sideSelector->selection(), m_currentBorder);
-}
-
-void SMTableStyleWidget::on_borderLineColor_textActivated(const QString& colorName)
-{
- int index = borderLineList->currentRow();
- if (index < 0)
- return;
- TableBorderLine line = m_currentBorder.borderLines().at(index);
- QString color = colorName;
- if (colorName == CommonStrings::tr_NoneColor)
+ QString color = buttonLineColor->colorButton->colorName();
+ if (color == CommonStrings::tr_NoneColor)
color = CommonStrings::None;
line.setColor(color);
+ line.setShade(buttonLineColor->colorButton->colorData().Shade);
m_currentBorder.replaceBorderLine(index, line);
mirrorCurrentBorderToSelectedSides();
updateBorderLineListItem();
@@ -447,9 +420,9 @@ void SMTableStyleWidget::updateBorderLineListItem()
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)
+ if (buttonLineColor->colorButton->colorName() != CommonStrings::None)
{
- QPixmap icon = getWidePixmap(getColor(borderLineColor->currentColor(), borderLineShade->value()));
+ QPixmap icon = getWidePixmap(getColor(buttonLineColor->colorButton->colorName(), buttonLineColor->colorButton->colorData().Shade));
item->setIcon(icon);
}
item->setText(text);
@@ -529,17 +502,9 @@ void SMTableStyleWidget::showFillForCurrentArea(TableStyle *tableStyle)
const TableStyle *parent = dynamic_cast(tableStyle->parentStyle());
bool hasParent = tableStyle->hasParent() && parent && parent->hasName() && tableStyle->parent() != "";
if (hasParent)
- {
- fillColor->setCurrentText(tableStyle->fillColor(), tableStyle->isInhFillColor());
- fillColor->setParentText(parent->fillColor());
- fillShade->setValue(qRound(tableStyle->fillShade()), tableStyle->isInhFillShade());
- fillShade->setParentValue(qRound(parent->fillShade()));
- }
+ buttonFillColor->setColor(tableStyle->fillColor(), qRound(tableStyle->fillShade()), parent->fillColor(), qRound(parent->fillShade()), tableStyle->isInhFillColor() && tableStyle->isInhFillShade());
else
- {
- fillColor->setCurrentText(tableStyle->fillColor());
- fillShade->setValue(qRound(tableStyle->fillShade()));
- }
+ buttonFillColor->setColor(tableStyle->fillColor(), qRound(tableStyle->fillShade()));
return;
}
@@ -549,10 +514,14 @@ void SMTableStyleWidget::showFillForCurrentArea(TableStyle *tableStyle)
// the real inherited state rather than hardcoding "not inherited".
CellStyle cs = tableStyle->conditionalStyle(m_currentArea);
cs.setContext(&m_Doc->cellStyles());
- fillColor->setCurrentText(cs.fillColor(), cs.isInhFillColor());
- fillColor->setParentText(QString());
- fillShade->setValue(qRound(cs.fillShade()), cs.isInhFillShade());
- fillShade->setParentValue(0);
+
+ const CellStyle *parent = dynamic_cast(cs.parentStyle());
+ bool hasParent = cs.hasParent() && parent != nullptr && parent->hasName() && cs.parent() != "";
+ if (hasParent)
+ buttonFillColor->setColor(cs.fillColor(), qRound(cs.fillShade()), parent->fillColor(), qRound(parent->fillShade()), cs.isInhFillColor() && cs.isInhFillShade());
+ else
+ buttonFillColor->setColor(cs.fillColor(), qRound(cs.fillShade()));
+
}
void SMTableStyleWidget::showBordersForCurrentArea(TableStyle *tableStyle)
diff --git a/scribus/ui/smtablestylewidget.h b/scribus/ui/smtablestylewidget.h
index bb3cef10d..180bd87b7 100644
--- a/scribus/ui/smtablestylewidget.h
+++ b/scribus/ui/smtablestylewidget.h
@@ -66,7 +66,7 @@ class SMTableStyleWidget : public QWidget, public Ui::SMTableStyleWidget
*
* @param colors list of colors to populate the combo with.
*/
- void fillFillColorCombo(ColorList &colors);
+ // void fillFillColorCombo(ColorList &colors);
void showColors(const QList &tableStyles);
void setBorders(const TableBorder& left, const TableBorder& right, const TableBorder& top, const TableBorder& bottom);
TableArea currentArea() const { return m_currentArea; }
@@ -115,8 +115,7 @@ class SMTableStyleWidget : public QWidget, public Ui::SMTableStyleWidget
void on_addBorderLineButton_clicked();
void on_removeBorderLineButton_clicked();
void on_borderLineWidth_valueChanged(double width);
- void on_borderLineShade_valueChanged(double shade);
- void on_borderLineColor_textActivated(const QString& colorName);
+ void borderLineColorChanged();
void on_borderLineStyle_activated(int style);
void on_conditionalAreaComboBox_currentIndexChanged(int index);
};
diff --git a/scribus/ui/smtablestylewidget.ui b/scribus/ui/smtablestylewidget.ui
index 603d9cd1b..b3447e5ea 100644
--- a/scribus/ui/smtablestylewidget.ui
+++ b/scribus/ui/smtablestylewidget.ui
@@ -6,12 +6,27 @@
0
0
- 613
- 740
+ 633
+ 424
-
- -
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
-
-
@@ -30,174 +45,110 @@
-
-
- -
-
-
-
-
-
- Editing Area:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
- -
-
-
-
-
- Cell Style Based On:
+
+
+ Qt::Orientation::Horizontal
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
+
+
+ 0
+ 0
+
-
+
- -
-
-
- Colors
+
-
+
+
+ 8
-
-
-
-
-
-
-
-
-
- 22
- 22
-
-
-
-
-
-
- fillColor
-
-
-
- -
-
-
- Fill Color
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Fill Shade
-
-
-
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+ 0
-
-
- -
-
-
- Qt::Orientation::Horizontal
+
+ 0
-
-
- 40
- 20
-
+
+ 0
-
-
-
-
-
-
-
- -
-
-
- Borders
-
-
-
- 3
-
-
- 6
-
-
- 6
-
-
- 6
-
-
- 6
-
-
-
-
-
- 3
-
-
-
-
-
- 3
+
+ 0
-
-
-
- true
-
+
-
+
0
0
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
-
-
-
- true
-
+
-
+
0
0
@@ -205,371 +156,516 @@
-
-
-
- Qt::Orientation::Vertical
-
-
- QSizePolicy::Policy::Minimum
-
-
-
- 20
- 40
-
+
+
+
-
+
-
- -
-
-
- true
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Fill
+
+
+
+ 4
-
-
- 0
- 0
-
+
+ 8
-
-
- 0
- 50
-
+
+ 8
-
-
- -
-
-
-
- 0
- 0
-
+
+ 8
-
-
- 80
- 80
-
+
+ 8
-
- QFrame::Shape::StyledPanel
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Text
+
+
+
+ 4
-
- QFrame::Shadow::Sunken
+
+ 8
-
-
-
-
- -
-
-
- 3
-
-
-
-
-
- QFormLayout::FieldGrowthPolicy::ExpandingFieldsGrow
+
+ 8
-
- 3
+
+ 8
-
- 3
+
+ 8
-
-
-
-
- false
+
-
+
+
+
+ 0
+ 0
+
-
- Width:
+
+
-
- borderLineWidth
+
+ true
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Paragraph style of currently selected text or paragraph
+
+
+
+
- -
-
-
- false
-
-
- Color:
-
-
- borderLineColor
-
-
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
+ Borders
+
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
-
+
+
+ 4
+
+
-
+
+
+ 4
+
+
-
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ Qt::Orientation::Vertical
+
+
+ QSizePolicy::Policy::Minimum
+
+
+
+ 0
+ 40
+
+
+
+
+
- -
-
+
-
+
- false
+ true
-
+
0
0
- 100
- 0
+ 0
+ 50
- -
-
-
- false
-
+
-
+
-
+
0
0
- 100
- 0
+ 80
+ 80
+
+ QFrame::Shape::StyledPanel
+
+
+ QFrame::Shadow::Sunken
+
-
-
-
- 3
-
-
- 3
+
+
+ 4
-
-
-
+
-
+
false
- Type:
-
-
- borderLineStyle
+
- -
-
-
- false
-
+
-
+
-
+
0
0
-
-
- 100
- 0
-
-
-
-
- -
-
-
- false
-
-
- Shade:
-
-
- borderLineShade
-
+
+ Width
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 0
+
+
+
+
+
- -
-
-
- false
-
+
-
+
-
+
0
0
-
+
+ Type
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 0
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
- 100
+ 0
0
-
- %
-
-
- 0
-
-
- 100.000000000000000
-
-
- 100.000000000000000
-
-
+
-
-
-
+
+
+ -
+
+
+ Qt::Orientation::Vertical
+
+
+
+ 0
+ 0
+
+
+
+
+
- -
-
-
- Conditional Formatting
-
-
-
-
-
+
-
+
+
-
+
+
+ Conditional Formatting
+
+
+
+ 4
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
+
+ 8
+
-
-
+
- Number of Header Rows:
+ Banded Rows
-
-
-
- 10
+
+
+ Banded Columns
-
-
-
- Qt::Orientation::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
-
-
+
- Number of Totals Rows:
+ First Column
-
-
-
- 10
+
+
+ Last Column
-
-
-
- Qt::Orientation::Horizontal
-
-
-
- 40
- 20
-
-
-
+
+
-
+
+
+ 10
+
+
+
+ -
+
+
+ Number of Total Rows:
+
+
+
+ -
+
+
+ Number of Header Rows:
+
+
+
+ -
+
+
+ 10
+
+
+
+
-
- -
-
-
- Banded Rows
-
-
-
- -
-
-
- Banded Columns
-
-
-
- -
-
-
- First Column
-
-
-
- -
-
-
- Last Column
-
-
-
-
-
-
- -
-
-
- Text
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Paragraph style of currently selected text or paragraph
-
-
-
-
-
+
+
+ -
+
+
+ Qt::Orientation::Vertical
+
+
+
+ 0
+ 0
+
+
+
+
+
- -
-
+
-
+
- Qt::Orientation::Vertical
-
-
- QSizePolicy::Policy::MinimumExpanding
+ Qt::Orientation::Horizontal
- 20
+ 0
0
@@ -578,6 +674,12 @@
+
+ FormWidget
+ QWidget
+
+ 1
+
ScrSpinBox
QDoubleSpinBox
@@ -594,21 +696,6 @@
1
-
- ColorCombo
- QComboBox
-
-
-
- SMColorCombo
- QComboBox
-
-
-
- SMShadeButton
- QPushButton
-
-
ParaStyleComboBox
QComboBox
@@ -619,6 +706,11 @@
QComboBox
+
+ SMColorButton
+ QToolButton
+
+