diff -Naur scribus15/scribus/pdflib_core.cpp scribus15-new/scribus/pdflib_core.cpp
--- scribus15/scribus/pdflib_core.cpp 2017-10-02 21:08:49.608222244 +0200
+++ scribus15-new/scribus/pdflib_core.cpp 2017-10-05 23:16:26.813486770 +0200
@@ -2615,12 +2615,15 @@
PutDoc("/Name ");
PutDoc(EncStringUTF16(ll.Name, optionalContent));
PutDoc("\n");
- PutDoc("/Usage <> /View <> ");
+ }
+ else
+ PutDoc("/Print <> ");
+ PutDoc("/View <at(la2);
layer.isViewable = ll.isViewable;
layer.isPrintable = ll.isPrintable;
+ layer.isPrintableVisible = ll.isPrintableVisible;
layer.isEditable = ll.isEditable;
layer.isSelectable = ll.isSelectable;
layer.ID = ll.ID;
@@ -505,7 +509,26 @@
return false;
}
-bool ScLayers::layerVisible(const int layerID) const
+bool ScLayers::layerPrintableVisible(const int layerID) const
+{
+ const ScLayer* layer = layerByID(layerID);
+ if (layer)
+ return layer->isPrintableVisible;
+ return false;
+}
+
+bool ScLayers::setLayerPrintableVisible(const int layerID, const bool isPrintableVisible)
+{
+ ScLayer* layer = byID(layerID);
+ if (layer)
+ {
+ layer->isPrintableVisible = isPrintableVisible;
+ return true;
+ }
+ return false;
+}
+
+ bool ScLayers::layerVisible(const int layerID) const
{
const ScLayer* layer = layerByID(layerID);
if (layer)
diff -Naur scribus15/scribus/sclayer.h scribus15-new/scribus/sclayer.h
--- scribus15/scribus/sclayer.h 2017-10-02 21:08:55.421639058 +0200
+++ scribus15-new/scribus/sclayer.h 2017-10-05 21:37:47.935946728 +0200
@@ -23,6 +23,7 @@
int ID;
int Level;
bool isPrintable;
+ bool isPrintableVisible;
bool isViewable;
bool isEditable;
bool isSelectable;
@@ -214,11 +215,26 @@
/**
* @brief Set the layer printable via the layer ID
* @param layerID ID of the layer
- * @param isPrintable bool true = layer is prantable
+ * @param isPrintable bool true = layer is printable
* @return Success or failure
*/
bool setLayerPrintable(const int layerID, const bool isPrintable);
+ /**
+ * @brief Is the layer printable on visible only
+ * @param layerID ID of the layer
+ * @return Printable on visible only or not
+ */
+ bool layerPrintableVisible(const int layerID) const;
+
+ /**
+ * @brief Set the layer printable on visible only via the layer ID
+ * @param layerID ID of the layer
+ * @param IsPrintableVisible bool true = layer is printable on visible only
+ * @return Success or failure
+ */
+ bool setLayerPrintableVisible(const int layerID, const bool IsPrintableVisible);
+
/**
* @brief Is the layer visible
* @param layerID ID of the layer
diff -Naur scribus15/scribus/scribusdoc.cpp scribus15-new/scribus/scribusdoc.cpp
--- scribus15/scribus/scribusdoc.cpp 2017-10-02 21:08:49.608222244 +0200
+++ scribus15-new/scribus/scribusdoc.cpp 2017-10-02 21:51:09.690880124 +0200
@@ -1790,6 +1790,12 @@
setLayerPrintable(ss->getInt("ACTIVE"), isUndo ? !print : print);
layersUndo=true;
}
+ else if (ss->contains("PRINTVISIBLE_LAYER"))
+ {
+ bool print = ss->getBool("PRINTVISIBLE");
+ setLayerPrintableVisible(ss->getInt("ACTIVE"), isUndo ? !print : print);
+ layersUndo=true;
+ }
else if (ss->contains("LAYER_FLOW"))
{
bool flow = ss->getBool("FLOW");
@@ -3095,6 +3101,47 @@
}
return false;
}
+
+
+bool ScribusDoc::setLayerPrintableVisible(const int layerID, const bool isPrintableVisible)
+{
+ ScLayers::iterator itend=Layers.end();
+ ScLayers::iterator it;
+ bool found=false;
+ for (it = Layers.begin(); it != itend; ++it)
+ {
+ if (it->ID == layerID)
+ {
+ if (it->isPrintableVisible!=isPrintableVisible && UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(isPrintableVisible ? Um::PrintLayer : Um::DoNotPrintLayer, "", Um::IPrint);
+ ss->set("PRINTVISIBLE_LAYER");
+ ss->set("ACTIVE", it->ID);
+ ss->set("PRINTVISIBLE", isPrintableVisible);
+ m_undoManager->action(this, ss, it->Name, Um::ILayer);
+ }
+ it->isPrintableVisible = isPrintableVisible;
+ found=true;
+ break;
+ }
+ }
+ if (found)
+ changed();
+ return found;
+}
+
+
+bool ScribusDoc::layerPrintableVisible(const int layerID)
+{
+ ScLayers::iterator itend=Layers.end();
+ ScLayers::iterator it;
+ for (it = Layers.begin(); it != itend; ++it)
+ {
+ if (it->ID == layerID)
+ return it->isPrintableVisible;
+ }
+ return false;
+}
bool ScribusDoc::setLayerVisible(const int layerID, const bool isViewable)
diff -Naur scribus15/scribus/scribusdoc.h scribus15-new/scribus/scribusdoc.h
--- scribus15/scribus/scribusdoc.h 2017-10-02 21:08:49.608222244 +0200
+++ scribus15-new/scribus/scribusdoc.h 2017-10-02 21:55:47.451209825 +0200
@@ -325,6 +325,19 @@
* @return Printable or not
*/
bool layerPrintable(const int layerID);
+ /**
+ * @brief Set the layer printable on visible via the layer number
+ * @param layerID ID of the layer
+ * @param isPrintableVisible bool true = layer is printable on visible
+ * @return Success or failure
+ */
+ bool setLayerPrintableVisible(const int layerID, const bool isPrintableVisible);
+ /**
+ * @brief Is the layer printable on visible
+ * @param layerID ID of the layer
+ * @return Printable on visible or not
+ */
+ bool layerPrintableVisible(const int layerID);
/**
* @brief Set the layer visible via the layer number
* @param layerID ID of the layer
diff -Naur scribus15/scribus/ui/layers.cpp scribus15-new/scribus/ui/layers.cpp
--- scribus15/scribus/ui/layers.cpp 2017-10-02 21:08:40.578091849 +0200
+++ scribus15-new/scribus/ui/layers.cpp 2017-10-02 22:12:22.587219765 +0200
@@ -69,15 +69,16 @@
LayerPaletteLayout->addLayout( layout1 );
IconManager* im = IconManager::instance();
- Table = new QTableWidget(0, 8, this );
+ Table = new QTableWidget(0, 9, this );
Table->setHorizontalHeaderItem(0, new QTableWidgetItem(""));
Table->setHorizontalHeaderItem(1, new QTableWidgetItem(im->loadIcon("16/show-object.png"), ""));
Table->setHorizontalHeaderItem(2, new QTableWidgetItem(im->loadIcon("16/document-print.png"), ""));
- Table->setHorizontalHeaderItem(3, new QTableWidgetItem(im->loadIcon("16/lock.png"), ""));
- Table->setHorizontalHeaderItem(4, new QTableWidgetItem(im->loadIcon("16/layer-flow-around.png"), ""));
- Table->setHorizontalHeaderItem(5, new QTableWidgetItem(im->loadIcon("layer-outline.png"), ""));
- Table->setHorizontalHeaderItem(6, new QTableWidgetItem(im->loadIcon("16/pointer.png"), ""));
- Table->setHorizontalHeaderItem(7, new QTableWidgetItem( tr("Name")));
+ Table->setHorizontalHeaderItem(3, new QTableWidgetItem(im->loadIcon("acroread16.png"), ""));
+ Table->setHorizontalHeaderItem(4, new QTableWidgetItem(im->loadIcon("16/lock.png"), ""));
+ Table->setHorizontalHeaderItem(5, new QTableWidgetItem(im->loadIcon("16/layer-flow-around.png"), ""));
+ Table->setHorizontalHeaderItem(6, new QTableWidgetItem(im->loadIcon("layer-outline.png"), ""));
+ Table->setHorizontalHeaderItem(7, new QTableWidgetItem(im->loadIcon("16/pointer.png"), ""));
+ Table->setHorizontalHeaderItem(8, new QTableWidgetItem( tr("Name")));
QHeaderView *header = Table->horizontalHeader();
header->setStretchLastSection(true);
@@ -93,6 +94,7 @@
Table->setColumnWidth(4, 24);
Table->setColumnWidth(5, 24);
Table->setColumnWidth(6, 24);
+ Table->setColumnWidth(7, 24);
Table->setSortingEnabled(false);
Table->setSelectionBehavior( QAbstractItemView::SelectRows );
QHeaderView *Header = Table->verticalHeader();
@@ -256,48 +258,59 @@
QWidget *cw3 = new QWidget(Table);
QCheckBox *cp3 = new QCheckBox(cw3);
cp3->setObjectName(tmp);
- cp3->setChecked(m_Doc->layerLocked(layerID));
+ cp3->setChecked(m_Doc->layerPrintableVisible(layerID));
QHBoxLayout *cl3 = new QHBoxLayout(cw3);
cl3->addWidget(cp3);
cl3->setAlignment(Qt::AlignCenter);
cl3->setContentsMargins(0,0,0,0);
Table->setCellWidget(row, 3, cw3);
- connect(cp3, SIGNAL(clicked()), this, SLOT(lockLayer()));
+ connect(cp3, SIGNAL(clicked()), this, SLOT(printviewLayer()));
QWidget *cw4 = new QWidget(Table);
QCheckBox *cp4 = new QCheckBox(cw4);
cp4->setObjectName(tmp);
- cp4->setChecked(m_Doc->layerFlow(layerID));
+ cp4->setChecked(m_Doc->layerLocked(layerID));
QHBoxLayout *cl4 = new QHBoxLayout(cw4);
cl4->addWidget(cp4);
cl4->setAlignment(Qt::AlignCenter);
cl4->setContentsMargins(0,0,0,0);
Table->setCellWidget(row, 4, cw4);
- connect(cp4, SIGNAL(clicked()), this, SLOT(flowToggleLayer()));
+ connect(cp4, SIGNAL(clicked()), this, SLOT(lockLayer()));
QWidget *cw5 = new QWidget(Table);
QCheckBox *cp5 = new QCheckBox(cw5);
cp5->setObjectName(tmp);
- cp5->setChecked(m_Doc->layerOutline(layerID));
+ cp5->setChecked(m_Doc->layerFlow(layerID));
QHBoxLayout *cl5 = new QHBoxLayout(cw5);
cl5->addWidget(cp5);
cl5->setAlignment(Qt::AlignCenter);
cl5->setContentsMargins(0,0,0,0);
Table->setCellWidget(row, 5, cw5);
- connect(cp5, SIGNAL(clicked()), this, SLOT(outlineToggleLayer()));
+ connect(cp5, SIGNAL(clicked()), this, SLOT(flowToggleLayer()));
QWidget *cw6 = new QWidget(Table);
QCheckBox *cp6 = new QCheckBox(cw6);
cp6->setObjectName(tmp);
- cp6->setChecked(m_Doc->layerSelectable(layerID));
+ cp6->setChecked(m_Doc->layerOutline(layerID));
QHBoxLayout *cl6 = new QHBoxLayout(cw6);
cl6->addWidget(cp6);
cl6->setAlignment(Qt::AlignCenter);
cl6->setContentsMargins(0,0,0,0);
Table->setCellWidget(row, 6, cw6);
- connect(cp6, SIGNAL(clicked()), this, SLOT(selectToggleLayer()));
+ connect(cp6, SIGNAL(clicked()), this, SLOT(outlineToggleLayer()));
- Table->setItem(row, 7, new QTableWidgetItem(m_Doc->layerName(layerID)));
+ QWidget *cw7 = new QWidget(Table);
+ QCheckBox *cp7 = new QCheckBox(cw6);
+ cp7->setObjectName(tmp);
+ cp7->setChecked(m_Doc->layerSelectable(layerID));
+ QHBoxLayout *cl7 = new QHBoxLayout(cw7);
+ cl7->addWidget(cp7);
+ cl7->setAlignment(Qt::AlignCenter);
+ cl7->setContentsMargins(0,0,0,0);
+ Table->setCellWidget(row, 7, cw7);
+ connect(cp7, SIGNAL(clicked()), this, SLOT(selectToggleLayer()));
+
+ Table->setItem(row, 8, new QTableWidgetItem(m_Doc->layerName(layerID)));
}
connect(Table, SIGNAL(cellChanged(int, int)), this, SLOT(changeName(int, int)));
connect(Table, SIGNAL(cellClicked(int, int)), this, SLOT(setActiveLayer(int, int)));
@@ -446,6 +459,23 @@
}
}
+void LayerPalette::printvisibleLayer()
+{
+ if (!m_Doc)
+ return;
+ int level = QString(sender()->objectName()).toInt();
+ int layerID=m_Doc->layerIDFromLevel(level);
+ if (layerID==-1)
+ return;
+ const QObject* senderBox=sender();
+ if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
+ {
+ m_Doc->setLayerPrintableVisible(layerID,((QCheckBox*)(senderBox))->isChecked());
+ setActiveLayer(Table->currentRow(), -1);
+ emit LayerChanged();
+ }
+}
+
void LayerPalette::lockLayer()
{
if (!m_Doc)
@@ -537,17 +567,22 @@
if (index == 3)
{
((QCheckBox*)(Table->cellWidget(row, 3)))->toggle();
- it->isEditable = !((QCheckBox*)(Table->cellWidget(row, 3)))->isChecked();
+ it->isPrintableVisible = ((QCheckBox*)(Table->cellWidget(row, 3)))->isChecked();
}
if (index == 4)
{
((QCheckBox*)(Table->cellWidget(row, 4)))->toggle();
- it->flowControl = ((QCheckBox*)(Table->cellWidget(row, 4)))->isChecked();
+ it->isEditable = !((QCheckBox*)(Table->cellWidget(row, 4)))->isChecked();
}
- else if (index == 5)
+ if (index == 5)
{
((QCheckBox*)(Table->cellWidget(row, 5)))->toggle();
- it->outlineMode = ((QCheckBox*)(Table->cellWidget(row, 5)))->isChecked();
+ it->flowControl = ((QCheckBox*)(Table->cellWidget(row, 5)))->isChecked();
+ }
+ else if (index == 6)
+ {
+ ((QCheckBox*)(Table->cellWidget(row, 6)))->toggle();
+ it->outlineMode = ((QCheckBox*)(Table->cellWidget(row, 6)))->isChecked();
}
}
emit LayerChanged();
@@ -719,10 +754,11 @@
Table->horizontalHeaderItem(0)->setToolTip("" + tr("Color of the Layer Indicator. Each layer has a color assigned to display on the canvas when layer indicators are enabled. You can double click to edit the color.") + "");
Table->horizontalHeaderItem(1)->setToolTip("" + tr("Make Layer Visible. Uncheck to hide the layer from the display.") + "" );
Table->horizontalHeaderItem(2)->setToolTip("" + tr("Print Layer. Uncheck to disable printing.") + "" );
- Table->horizontalHeaderItem(3)->setToolTip("" + tr("Lock or Unlock Layer. Unchecked is unlocked.") + "" );
- Table->horizontalHeaderItem(4)->setToolTip("" + tr("Make text in lower layers flow around objects. Enabling this forces text in lower layers to flow around objects of the layer for which this option has been enabled.") + "" );
- Table->horizontalHeaderItem(5)->setToolTip("" + tr("Outline Mode. Toggles the 'wireframe' display of objects to speed the display of very complex objects.") + "" ) ;
- Table->horizontalHeaderItem(6)->setToolTip("" + tr("Select Objects on Layer. Check to enable selecting.") + "" );
- Table->horizontalHeaderItem(7)->setToolTip("" + tr("Name of the Layer. Double click on the name of a layer to edit the name.") + "" );
+ Table->horizontalHeaderItem(3)->setToolTip("" + tr("Print Layer on visible only. Check to print layer PDF on visible only.") + "" );
+ Table->horizontalHeaderItem(4)->setToolTip("" + tr("Lock or Unlock Layer. Unchecked is unlocked.") + "" );
+ Table->horizontalHeaderItem(5)->setToolTip("" + tr("Make text in lower layers flow around objects. Enabling this forces text in lower layers to flow around objects of the layer for which this option has been enabled.") + "" );
+ Table->horizontalHeaderItem(6)->setToolTip("" + tr("Outline Mode. Toggles the 'wireframe' display of objects to speed the display of very complex objects.") + "" ) ;
+ Table->horizontalHeaderItem(7)->setToolTip("" + tr("Select Objects on Layer. Check to enable selecting.") + "" );
+ Table->horizontalHeaderItem(8)->setToolTip("" + tr("Name of the Layer. Double click on the name of a layer to edit the name.") + "" );
}
diff -Naur scribus15/scribus/ui/layers.h scribus15-new/scribus/ui/layers.h
--- scribus15/scribus/ui/layers.h 2017-10-02 21:08:42.331450571 +0200
+++ scribus15-new/scribus/ui/layers.h 2017-10-02 22:11:27.996539903 +0200
@@ -52,6 +52,7 @@
void changeName(int row, int col);
void visibleLayer();
void printLayer();
+ void printvisibleLayer();
void lockLayer();
void flowToggleLayer();
void outlineToggleLayer();