Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 23174 → Rev 23175

/trunk/Scribus/scribus/scribus.cpp
4346,13 → 4346,13
m_styleManager->setDoc(nullptr);
marksManager->setDoc(nullptr);
nsEditor->setDoc(nullptr);
layerPalette->ClearInhalt();
layerPalette->clearContent();
docCheckerPalette->buildErrorList(nullptr);
HaveDoc--;
delete doc;
doc = nullptr;
ActWin = nullptr;
if ( HaveDoc == 0 )
if (HaveDoc == 0)
{
QString prefsDocDir( PrefsManager::instance().documentDir() );
if ( QDir().exists(prefsDocDir) )
/trunk/Scribus/scribus/selection.cpp
276,49 → 276,81
 
bool Selection::removeItem(PageItem *item)
{
bool removeOk(false);
if (!m_SelList.isEmpty() && m_SelList.contains(item))
if (m_SelList.isEmpty() || !m_SelList.contains(item))
return false;
 
bool removeOk = (m_SelList.removeAll(item) == 1);
if (removeOk)
{
removeOk = (m_SelList.removeAll(item)==1);
if (removeOk)
if (m_isGUISelection)
{
if (m_isGUISelection)
{
item->setSelected(false);
item->disconnectFromGUI();
}
item->isSingleSel = false;
item->setSelected(false);
item->disconnectFromGUI();
}
item->isSingleSel = false;
}
 
if (m_isGUISelection)
if (m_isGUISelection)
{
m_sigSelectionChanged = true;
sendSignals();
}
return removeOk;
}
 
bool Selection::removeItemsOfLayer(int layedID)
{
if (m_SelList.isEmpty())
return false;
 
int oldSelCount = m_SelList.count();
 
delaySignalsOn();
int selIndex = 0;
while (selIndex < m_SelList.count())
{
QPointer<PageItem> pi = m_SelList.at(selIndex);
if (pi.isNull())
{
m_sigSelectionChanged = true;
sendSignals();
removeItem(itemAt(selIndex));
continue;
}
return removeOk;
 
if (pi->m_layerID != layedID)
{
++selIndex;
continue;
}
 
removeItem(itemAt(selIndex));
}
return removeOk;
 
delaySignalsOff();
 
bool itemsRemoved = (oldSelCount != m_SelList.count());
return itemsRemoved;
}
 
PageItem* Selection::takeItem(int itemIndex)
{
if (!m_SelList.isEmpty() && itemIndex<m_SelList.count())
if (m_SelList.isEmpty() || itemIndex >= m_SelList.count())
return nullptr;
 
PageItem *item = m_SelList[itemIndex];
bool removeOk = (m_SelList.removeAll(item) == 1);
if (removeOk)
{
PageItem *item = m_SelList[itemIndex];
bool removeOk = (m_SelList.removeAll(item) == 1);
if (removeOk)
item->isSingleSel = false;
if (m_isGUISelection)
{
item->isSingleSel = false;
if (m_isGUISelection)
{
item->setSelected(false);
m_sigSelectionChanged = true;
if (itemIndex == 0)
item->disconnectFromGUI();
}
sendSignals();
return item;
item->setSelected(false);
m_sigSelectionChanged = true;
if (itemIndex == 0)
item->disconnectFromGUI();
}
sendSignals();
return item;
}
return nullptr;
}
/trunk/Scribus/scribus/selection.h
98,6 → 98,10
*/
bool removeItem(PageItem *item);
/**
* \briefRemove items from specified layer
*/
bool removeItemsOfLayer(int layedID);
/**
* \brief Remove the first item from the list
* @return If the remove was successful
*/
/trunk/Scribus/scribus/ui/layers.cpp
35,6 → 35,7
#include "sccombobox.h"
#include "scribus.h"
#include "scribusdoc.h"
#include "selection.h"
#include "ui/scrspinbox.h"
#include "undomanager.h"
 
145,7 → 146,7
LayerPaletteLayout->addLayout( Layout1 );
containerWidget->setLayout( LayerPaletteLayout );
setWidget( containerWidget );
ClearInhalt();
clearContent();
languageChange();
 
connect(newLayerButton, SIGNAL(clicked()), this, SLOT(addLayer()));
159,7 → 160,7
connect(header, SIGNAL(sectionClicked(int)), this, SLOT(toggleAllfromHeader(int)));
}
 
void LayerPalette::ClearInhalt()
void LayerPalette::clearContent()
{
disconnect(blendMode, SIGNAL(activated(int)), this, SLOT(changeBlendMode(int)));
disconnect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeOpacity()));
191,7 → 192,7
lowerLayerButton->setEnabled(false);
markActiveLayer(0);
}
layers=&m_Doc->Layers;
layers = &m_Doc->Layers;
rebuildList();
 
markActiveLayer(m_Doc->activeLayer());
338,11 → 339,11
{
if (!m_Doc)
return;
int layerCount=m_Doc->layerCount();
int layerCount = m_Doc->layerCount();
if (layerCount < 2)
return;
int level = layerCount-1-Table->currentRow();
int layerID=m_Doc->layerIDFromLevel(level);
int layerID = m_Doc->layerIDFromLevel(level);
bool delToo = false;
if (m_Doc->layerContainsItems(layerID))
{
368,7 → 369,7
{
if (!m_Doc)
return;
int layerCount=m_Doc->layerCount();
int layerCount = m_Doc->layerCount();
if ((layerCount < 2) || (Table->currentRow() == 0))
return;
int layerLevel = layerCount-1-Table->currentRow();
384,7 → 385,7
{
if (!m_Doc)
return;
int layerCount=m_Doc->layerCount();
int layerCount = m_Doc->layerCount();
if ((layerCount < 2) || (Table->currentRow() == static_cast<int>(layerCount) - 1))
return;
int layerLevel = layerCount-1-Table->currentRow();
403,8 → 404,8
if (col == 7)
{
int layerLevel = m_Doc->layerCount()-1-row;
int layerID=m_Doc->layerIDFromLevel(layerLevel);
if (layerID!=-1)
int layerID = m_Doc->layerIDFromLevel(layerLevel);
if (layerID != -1)
m_Doc->changeLayerName(layerID, Table->item(row, col)->text());
}
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
415,13 → 416,16
if (!m_Doc)
return;
int level = QString(sender()->objectName()).toInt();
int layerID=m_Doc->layerIDFromLevel(level);
if (layerID==-1)
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
const QObject* senderBox=sender();
const QObject* senderBox = sender();
if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
{
m_Doc->setLayerVisible(layerID,((QCheckBox*)(senderBox))->isChecked());
bool isLayerVisible = ((QCheckBox*)(senderBox))->isChecked();
m_Doc->setLayerVisible(layerID, isLayerVisible);
if (!isLayerVisible)
m_Doc->m_Selection->removeItemsOfLayer(layerID);
setActiveLayer(Table->currentRow(), -1);
emit LayerChanged();
}
432,13 → 436,13
if (!m_Doc)
return;
int level = QString(sender()->objectName()).toInt();
int layerID=m_Doc->layerIDFromLevel(level);
if (layerID==-1)
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
const QObject* senderBox=sender();
const QObject* senderBox = sender();
if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
{
m_Doc->setLayerPrintable(layerID,((QCheckBox*)(senderBox))->isChecked());
m_Doc->setLayerPrintable(layerID, ((QCheckBox*)(senderBox))->isChecked());
setActiveLayer(Table->currentRow(), -1);
emit LayerChanged();
}
449,14 → 453,17
if (!m_Doc)
return;
int level = QString(sender()->objectName()).toInt();
int layerID=m_Doc->layerIDFromLevel(level);
if (layerID==-1)
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
const QObject* senderBox=sender();
const QObject* senderBox = sender();
if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
{
m_Doc->setLayerLocked(layerID,((QCheckBox*)(senderBox))->isChecked());
deleteLayerButton->setEnabled(!((QCheckBox*)(senderBox))->isChecked());
bool isLayerLocked = ((QCheckBox*)(senderBox))->isChecked();
m_Doc->setLayerLocked(layerID, isLayerLocked);
if (isLayerLocked)
m_Doc->m_Selection->removeItemsOfLayer(layerID);
deleteLayerButton->setEnabled(!isLayerLocked);
setActiveLayer(Table->currentRow(), -1);
}
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
467,13 → 474,13
if (!m_Doc)
return;
int level = QString(sender()->objectName()).toInt();
int layerID=m_Doc->layerIDFromLevel(level);
if (layerID==-1)
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
const QObject* senderBox=sender();
const QObject* senderBox = sender();
if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
{
m_Doc->setLayerFlow(layerID,((QCheckBox*)(senderBox))->isChecked());
m_Doc->setLayerFlow(layerID, ((QCheckBox*)(senderBox))->isChecked());
emit LayerChanged();
setActiveLayer(Table->currentRow(), -1);
}
484,13 → 491,13
if (!m_Doc)
return;
int level = QString(sender()->objectName()).toInt();
int layerID=m_Doc->layerIDFromLevel(level);
if (layerID==-1)
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
const QObject* senderBox=sender();
const QObject* senderBox = sender();
if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
{
m_Doc->setLayerOutline(layerID,((QCheckBox*)(senderBox))->isChecked());
m_Doc->setLayerOutline(layerID, ((QCheckBox*)(senderBox))->isChecked());
emit LayerChanged();
setActiveLayer(Table->currentRow(), -1);
}
501,13 → 508,14
if (!m_Doc)
return;
int level = QString(sender()->objectName()).toInt();
int layerID=m_Doc->layerIDFromLevel(level);
if (layerID==-1)
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
const QObject* senderBox=sender();
const QObject* senderBox = sender();
if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
{
m_Doc->setLayerSelectable(layerID,((QCheckBox*)(senderBox))->isChecked());
bool isLayerSelectable = ((QCheckBox*)(senderBox))->isChecked();
m_Doc->setLayerSelectable(layerID, isLayerSelectable);
emit LayerChanged();
setActiveLayer(Table->currentRow(), -1);
}
556,10 → 564,10
if (!m_Doc)
return;
int level = QString(sender()->objectName()).toInt();
int layerID=m_Doc->layerIDFromLevel(level);
if (layerID==-1)
int layerID = m_Doc->layerIDFromLevel(level);
if (layerID == -1)
return;
const QObject* senderBox=sender();
const QObject* senderBox = sender();
if (strcmp(senderBox->metaObject()->className(), "QToolButton") == 0)
{
QColor neu = QColor();
601,18 → 609,18
disconnect(blendMode, SIGNAL(activated(int)), this, SLOT(changeBlendMode(int)));
disconnect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeOpacity()));
disconnect(Table, SIGNAL(cellClicked(int, int)), this, SLOT(setActiveLayer(int, int)));
int layerToMark=layerID;
if (layerID==-1)
layerToMark=m_Doc->activeLayer();
int layerToMark = layerID;
if (layerID == -1)
layerToMark = m_Doc->activeLayer();
Table->setCurrentCell(m_Doc->layerCount()-1-m_Doc->layerLevelFromID(layerToMark), 6);
opacitySpinBox->setValue(qRound(m_Doc->layerTransparency(layerToMark) * 100));
blendMode->setCurrentIndex(m_Doc->layerBlendMode(layerToMark));
deleteLayerButton->setEnabled(m_Doc->layerCount()>1 && !m_Doc->layerLocked( m_Doc->activeLayer() ));
deleteLayerButton->setEnabled(m_Doc->layerCount() > 1 && !m_Doc->layerLocked( m_Doc->activeLayer() ));
if (layers->count()>1)
if (layers->count() > 1)
{
raiseLayerButton->setEnabled(Table->currentRow()!=0);
lowerLayerButton->setEnabled(Table->currentRow()!=Table->rowCount()-1);
raiseLayerButton->setEnabled(Table->currentRow() != 0);
lowerLayerButton->setEnabled(Table->currentRow() != Table->rowCount() - 1);
}
else
{
635,7 → 643,7
}
disconnect(blendMode, SIGNAL(activated(int)), this, SLOT(changeBlendMode(int)));
disconnect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeOpacity()));
int layerID=m_Doc->layerIDFromLevel(m_Doc->layerCount()-1-row);
int layerID = m_Doc->layerIDFromLevel(m_Doc->layerCount()-1-row);
bool found=m_Doc->setActiveLayer(layerID);
if (found)
{
642,8 → 650,8
m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
opacitySpinBox->setValue(qRound(m_Doc->layerTransparency(m_Doc->activeLayer()) * 100));
blendMode->setCurrentIndex(m_Doc->layerBlendMode(m_Doc->activeLayer()));
deleteLayerButton->setEnabled(m_Doc->layerCount()>1 && !m_Doc->layerLocked( m_Doc->activeLayer() ));
if (layers->count()>1)
deleteLayerButton->setEnabled(m_Doc->layerCount() > 1 && !m_Doc->layerLocked( m_Doc->activeLayer() ));
if (layers->count() > 1)
{
raiseLayerButton->setEnabled(Table->currentRow()!= 0);
lowerLayerButton->setEnabled(Table->currentRow()!= Table->rowCount()-1);
/trunk/Scribus/scribus/ui/layers.h
61,7 → 61,7
void changeOpacity();
void changeBlendMode(int blend);
void setActiveLayer(int row, int col);
void ClearInhalt();
void clearContent();
void markActiveLayer(int layerID=-1);
void languageChange();
 
/trunk/Scribus/scribus/ui/outlinepalette.cpp
624,7 → 624,10
 
void OutlinePalette::setLayerVisible(int layerID)
{
currDoc->setLayerVisible(layerID, !currDoc->layerVisible(layerID));
bool isLayerVisible = !currDoc->layerVisible(layerID);
currDoc->setLayerVisible(layerID, isLayerVisible);
if (!isLayerVisible)
currDoc->m_Selection->removeItemsOfLayer(layerID);
currDoc->scMW()->showLayer();
currDoc->scMW()->layerPalette->rebuildList();
currDoc->scMW()->layerPalette->markActiveLayer();
632,7 → 635,10
 
void OutlinePalette::setLayerLocked(int layerID)
{
currDoc->setLayerLocked(layerID, !currDoc->layerLocked(layerID));
bool isLayerLocked = !currDoc->layerLocked(layerID);
currDoc->setLayerLocked(layerID, isLayerLocked);
if (isLayerLocked)
currDoc->m_Selection->removeItemsOfLayer(layerID);
currDoc->scMW()->layerPalette->rebuildList();
currDoc->scMW()->layerPalette->markActiveLayer();
}