Layout properties.
|
@ -151,6 +151,12 @@ void VPCarrouselPieceList::startDrag(Qt::DropActions supportedActions)
|
||||||
{
|
{
|
||||||
m_carrousel->Refresh();
|
m_carrousel->Refresh();
|
||||||
piece->SetSelected(true);
|
piece->SetSelected(true);
|
||||||
|
|
||||||
|
VPLayoutPtr layout = piece->Layout();
|
||||||
|
if (not layout.isNull())
|
||||||
|
{
|
||||||
|
emit layout->PieceSelectionChanged(piece);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) :
|
||||||
|
|
||||||
InitLayoutUnits();
|
InitLayoutUnits();
|
||||||
VAbstractLayoutDialog::InitTemplates(ui->comboBoxSheetTemplates);
|
VAbstractLayoutDialog::InitTemplates(ui->comboBoxSheetTemplates);
|
||||||
VAbstractLayoutDialog::InitTemplates(ui->comboBoxTileTemplates);
|
VAbstractLayoutDialog::InitTileTemplates(ui->comboBoxTileTemplates);
|
||||||
MinimumSheetPaperSize();
|
MinimumSheetPaperSize();
|
||||||
MinimumTilePaperSize();
|
MinimumTilePaperSize();
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ void PuzzlePreferencesLayoutPage::ConvertPaperSize()
|
||||||
ui->doubleSpinBoxTileMarginTop->setValue(newTileTopMargin);
|
ui->doubleSpinBoxTileMarginTop->setValue(newTileTopMargin);
|
||||||
ui->doubleSpinBoxTileMarginBottom->setValue(newTileBottomMargin);
|
ui->doubleSpinBoxTileMarginBottom->setValue(newTileBottomMargin);
|
||||||
|
|
||||||
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(50, Unit::Cm, layoutUnit));
|
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(VPSettings::GetMaxLayoutPieceGap(), Unit::Cm, layoutUnit));
|
||||||
ui->doubleSpinBoxPiecesGap->setValue(newGap);
|
ui->doubleSpinBoxPiecesGap->setValue(newGap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ void PuzzlePreferencesLayoutPage::ReadSettings()
|
||||||
ui->checkBoxWarningPiecesOutOfBound->setChecked(settings->GetLayoutWarningPiecesOutOfBound());
|
ui->checkBoxWarningPiecesOutOfBound->setChecked(settings->GetLayoutWarningPiecesOutOfBound());
|
||||||
ui->checkBoxFollowGrainline->setChecked(settings->GetLayoutFollowGrainline());
|
ui->checkBoxFollowGrainline->setChecked(settings->GetLayoutFollowGrainline());
|
||||||
|
|
||||||
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(50, Unit::Cm, LayoutUnit()));
|
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(VPSettings::GetMaxLayoutPieceGap(), Unit::Px, LayoutUnit()));
|
||||||
SetPieceGap(settings->GetLayoutPieceGap());
|
SetPieceGap(settings->GetLayoutPieceGap());
|
||||||
|
|
||||||
FindSheetTemplate();
|
FindSheetTemplate();
|
||||||
|
@ -637,7 +637,7 @@ void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qrea
|
||||||
if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize)
|
if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize)
|
||||||
{
|
{
|
||||||
box->blockSignals(true);
|
box->blockSignals(true);
|
||||||
const int index = ui->comboBoxTileTemplates->findData(i);
|
const int index = box->findData(i);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
box->setCurrentIndex(index);
|
box->setCurrentIndex(index);
|
||||||
|
|
|
@ -90,6 +90,8 @@ signals:
|
||||||
void PieceTransformationChanged(const VPPiecePtr &piece);
|
void PieceTransformationChanged(const VPPiecePtr &piece);
|
||||||
void TransformationOriginChanged();
|
void TransformationOriginChanged();
|
||||||
void SheetListChanged();
|
void SheetListChanged();
|
||||||
|
void PieceSelectionChanged(const VPPiecePtr &piece);
|
||||||
|
void LayoutChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit VPLayout(QUndoStack *undoStack);
|
explicit VPLayout(QUndoStack *undoStack);
|
||||||
|
|
|
@ -100,8 +100,8 @@ void VPLayoutSettings::SetTilesSize(qreal width, qreal height)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPLayoutSettings::SetTilesSizeConverted(qreal width, qreal height)
|
void VPLayoutSettings::SetTilesSizeConverted(qreal width, qreal height)
|
||||||
{
|
{
|
||||||
m_tilesSize.setWidth(UnitConvertor(width, GetUnit(), Unit::Px));
|
m_tilesSize.setWidth(UnitConvertor(width, m_unit, Unit::Px));
|
||||||
m_tilesSize.setHeight(UnitConvertor(height, GetUnit(), Unit::Px));
|
m_tilesSize.setHeight(UnitConvertor(height, m_unit, Unit::Px));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -142,12 +142,6 @@ auto VPLayoutSettings::GetTilesSizeConverted() const -> QSizeF
|
||||||
return GetTilesSize(GetUnit());
|
return GetTilesSize(GetUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
auto VPLayoutSettings::GetTilesOrientation() -> PageOrientation
|
|
||||||
{
|
|
||||||
return m_tilesSize.height() >= m_tilesSize.width() ? PageOrientation::Portrait : PageOrientation::Landscape;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPLayoutSettings::SetTilesMargins(qreal left, qreal top, qreal right, qreal bottom)
|
void VPLayoutSettings::SetTilesMargins(qreal left, qreal top, qreal right, qreal bottom)
|
||||||
{
|
{
|
||||||
|
@ -497,21 +491,6 @@ auto VPLayoutSettings::GetSheetSizeConverted() const -> QSizeF
|
||||||
return convertedSize;
|
return convertedSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
auto VPLayoutSettings::GetOrientation() -> PageOrientation
|
|
||||||
{
|
|
||||||
return m_orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VPLayoutSettings::SetOrientation(PageOrientation orientation)
|
|
||||||
{
|
|
||||||
if(orientation != m_orientation)
|
|
||||||
{
|
|
||||||
m_orientation = orientation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPLayoutSettings::SetSheetMargins(qreal left, qreal top, qreal right, qreal bottom)
|
void VPLayoutSettings::SetSheetMargins(qreal left, qreal top, qreal right, qreal bottom)
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,12 +191,6 @@ public:
|
||||||
*/
|
*/
|
||||||
auto GetTilesSizeConverted() const -> QSizeF;
|
auto GetTilesSizeConverted() const -> QSizeF;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GetOrientation Returns the orientation of the tiles
|
|
||||||
* @return orientation of the tiles
|
|
||||||
*/
|
|
||||||
auto GetTilesOrientation() -> PageOrientation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetTilesMargins, set the margins of the tiles, the values have to be in Unit::Px
|
* @brief SetTilesMargins, set the margins of the tiles, the values have to be in Unit::Px
|
||||||
* @param left in Unit::Px
|
* @param left in Unit::Px
|
||||||
|
@ -332,18 +326,6 @@ public:
|
||||||
*/
|
*/
|
||||||
auto GetSheetSizeConverted() const -> QSizeF;
|
auto GetSheetSizeConverted() const -> QSizeF;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GetOrientation Returns the orientation of the sheet
|
|
||||||
* @return orientation of the sheet
|
|
||||||
*/
|
|
||||||
auto GetOrientation() -> PageOrientation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SetOrientation Sets the orientation of the sheet to the given value
|
|
||||||
* @param orientation the new page orientation
|
|
||||||
*/
|
|
||||||
void SetOrientation(PageOrientation orientation);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetSheetMargins, set the margins of the sheet, the values have to be in Unit::Px
|
* @brief SetSheetMargins, set the margins of the sheet, the values have to be in Unit::Px
|
||||||
* @param left in Unit::Px
|
* @param left in Unit::Px
|
||||||
|
@ -488,11 +470,6 @@ private:
|
||||||
*/
|
*/
|
||||||
QSizeF m_size{};
|
QSizeF m_size{};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief holds the orientation of the sheet
|
|
||||||
*/
|
|
||||||
PageOrientation m_orientation {PageOrientation::Portrait};
|
|
||||||
|
|
||||||
// margins
|
// margins
|
||||||
/**
|
/**
|
||||||
* @brief m_margins the margins in Unit::Px
|
* @brief m_margins the margins in Unit::Px
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "vpsheet.h"
|
#include "vpsheet.h"
|
||||||
|
|
||||||
#include "vplayout.h"
|
#include "vplayout.h"
|
||||||
|
#include "vppiece.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPSheet::VPSheet(const VPLayoutPtr &layout) :
|
VPSheet::VPSheet(const VPLayoutPtr &layout) :
|
||||||
|
@ -45,8 +46,6 @@ auto VPSheet::GetLayout() const -> VPLayoutPtr
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
|
auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> list;
|
|
||||||
|
|
||||||
VPLayoutPtr layout = GetLayout();
|
VPLayoutPtr layout = GetLayout();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
|
@ -56,6 +55,31 @@ auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSheet::GetSelectedPieces() const -> QList<VPPiecePtr>
|
||||||
|
{
|
||||||
|
VPLayoutPtr layout = GetLayout();
|
||||||
|
if (not layout.isNull())
|
||||||
|
{
|
||||||
|
QList<VPPiecePtr> list = layout->PiecesForSheet(m_uuid);
|
||||||
|
|
||||||
|
QList<VPPiecePtr> selected;
|
||||||
|
selected.reserve(list.size());
|
||||||
|
|
||||||
|
for (const auto& piece : list)
|
||||||
|
{
|
||||||
|
if (not piece.isNull() && piece->IsSelected())
|
||||||
|
{
|
||||||
|
selected.append(piece);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::GetName() const -> QString
|
auto VPSheet::GetName() const -> QString
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,8 @@ public:
|
||||||
|
|
||||||
auto GetPieces() const -> QList<VPPiecePtr>;
|
auto GetPieces() const -> QList<VPPiecePtr>;
|
||||||
|
|
||||||
|
auto GetSelectedPieces() const -> QList<VPPiecePtr>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetName Returns the name of the sheet
|
* @brief GetName Returns the name of the sheet
|
||||||
* @return the name
|
* @return the name
|
||||||
|
|
|
@ -76,7 +76,7 @@ VPGraphicsPiece::VPGraphicsPiece(const VPPiecePtr &piece, QGraphicsItem *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPGraphicsPiece::GetPiece() -> VPPiecePtr
|
auto VPGraphicsPiece::GetPiece() -> VPPiecePtr
|
||||||
{
|
{
|
||||||
return m_piece;
|
return m_piece.toStrongRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -245,7 +245,7 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
|
||||||
if (painter != nullptr)
|
if (painter != nullptr)
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setBrush(isSelected() ? selectionBrush : noBrush);
|
painter->setBrush(piece->IsSelected() ? selectionBrush : noBrush);
|
||||||
painter->drawPath(m_seamLine);
|
painter->drawPath(m_seamLine);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
@ -362,15 +362,6 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPGraphicsPiece::GroupMove(const QPointF &pos)
|
void VPGraphicsPiece::GroupMove(const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (scene() != nullptr)
|
|
||||||
{
|
|
||||||
QList<QGraphicsItem *> list = scene()->selectedItems();
|
|
||||||
|
|
||||||
if (list.isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VPPiecePtr piece = m_piece.toStrongRef();
|
VPPiecePtr piece = m_piece.toStrongRef();
|
||||||
if (piece.isNull())
|
if (piece.isNull())
|
||||||
{
|
{
|
||||||
|
@ -383,24 +374,27 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto PreparePieces = [list]()
|
auto PreparePieces = [layout]()
|
||||||
{
|
{
|
||||||
QVector<VPPiecePtr> pieces;
|
QList<VPPiecePtr> pieces;
|
||||||
for (auto *item : list)
|
|
||||||
|
VPSheetPtr sheet = layout->GetFocusedSheet();
|
||||||
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
if (item->type() == VPGraphicsPiece::Type)
|
return sheet->GetSelectedPieces();
|
||||||
{
|
|
||||||
auto *pieceItem = dynamic_cast<VPGraphicsPiece*>(item);
|
|
||||||
pieces.append(pieceItem->GetPiece());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pieces;
|
return pieces;
|
||||||
};
|
};
|
||||||
|
|
||||||
QVector<VPPiecePtr> pieces = PreparePieces();
|
QList<VPPiecePtr> pieces = PreparePieces();
|
||||||
QPointF newPos = pos - m_moveStartPoint;
|
QPointF newPos = pos - m_moveStartPoint;
|
||||||
|
|
||||||
|
if (qFuzzyIsNull(newPos.x()) && qFuzzyIsNull(newPos.y()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pieces.size() == 1)
|
if (pieces.size() == 1)
|
||||||
{
|
{
|
||||||
auto *command = new VPUndoPieceMove(pieces.first(), newPos.x(), newPos.y(), allowChangeMerge);
|
auto *command = new VPUndoPieceMove(pieces.first(), newPos.x(), newPos.y(), allowChangeMerge);
|
||||||
|
@ -412,7 +406,6 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos)
|
||||||
layout->UndoStack()->push(command);
|
layout->UndoStack()->push(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPGraphicsPiece::on_RefreshPiece(const VPPiecePtr &piece)
|
void VPGraphicsPiece::on_RefreshPiece(const VPPiecePtr &piece)
|
||||||
|
@ -435,8 +428,13 @@ auto VPGraphicsPiece::itemChange(GraphicsItemChange change, const QVariant &valu
|
||||||
VPPiecePtr piece = m_piece.toStrongRef();
|
VPPiecePtr piece = m_piece.toStrongRef();
|
||||||
if (not piece.isNull())
|
if (not piece.isNull())
|
||||||
{
|
{
|
||||||
emit PieceSelectionChanged();
|
|
||||||
piece->SetSelected(value.toBool());
|
piece->SetSelected(value.toBool());
|
||||||
|
|
||||||
|
VPLayoutPtr layout = piece->Layout();
|
||||||
|
if (not layout.isNull())
|
||||||
|
{
|
||||||
|
emit layout->PieceSelectionChanged(piece);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ public:
|
||||||
enum { Type = UserType + static_cast<int>(PGraphicsItem::Piece)};
|
enum { Type = UserType + static_cast<int>(PGraphicsItem::Piece)};
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void PieceSelectionChanged();
|
|
||||||
void HideTransformationHandles(bool hide);
|
void HideTransformationHandles(bool hide);
|
||||||
void PieceTransformationChanged();
|
void PieceTransformationChanged();
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
#include "../vwidgets/global.h"
|
#include "../vwidgets/global.h"
|
||||||
#include "../layout/vplayout.h"
|
#include "../layout/vplayout.h"
|
||||||
|
#include "../layout/vppiece.h"
|
||||||
#include "../undocommands/vpundopiecerotate.h"
|
#include "../undocommands/vpundopiecerotate.h"
|
||||||
#include "../undocommands/vpundooriginmove.h"
|
#include "../undocommands/vpundooriginmove.h"
|
||||||
#include "vpgraphicspiece.h"
|
#include "vpgraphicspiece.h"
|
||||||
|
@ -479,16 +480,21 @@ void VPGraphicsPieceControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
auto PreparePieces = [this]()
|
auto PreparePieces = [this]()
|
||||||
{
|
{
|
||||||
QVector<VPPiecePtr> pieces;
|
QList<VPPiecePtr> pieces;
|
||||||
for (auto *item : m_selectedPieces)
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
pieces.append(item->GetPiece());
|
VPSheetPtr sheet = layout->GetFocusedSheet();
|
||||||
|
if (not sheet.isNull())
|
||||||
|
{
|
||||||
|
pieces = sheet->GetSelectedPieces();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pieces;
|
return pieces;
|
||||||
};
|
};
|
||||||
|
|
||||||
QVector<VPPiecePtr> pieces = PreparePieces();
|
QList<VPPiecePtr> pieces = PreparePieces();
|
||||||
|
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
|
@ -662,7 +668,7 @@ auto VPGraphicsPieceControls::ControllersRect() const -> QRectF
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPGraphicsPieceControls::ArrowPath() const -> QPainterPath
|
auto VPGraphicsPieceControls::ArrowPath() const -> QPainterPath
|
||||||
{
|
{
|
||||||
const qreal scale = SceneScale(scene());
|
const qreal scale = SceneScale(scene())/2;
|
||||||
QPainterPath arrow;
|
QPainterPath arrow;
|
||||||
|
|
||||||
QRectF pieceRect = ControllersRect();
|
QRectF pieceRect = ControllersRect();
|
||||||
|
@ -764,23 +770,17 @@ auto VPGraphicsPieceControls::ArrowPath() const -> QPainterPath
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPGraphicsPieceControls::SelectedPieces() const -> QVector<VPGraphicsPiece *>
|
auto VPGraphicsPieceControls::SelectedPieces() const -> QList<VPPiecePtr>
|
||||||
{
|
{
|
||||||
QVector<VPGraphicsPiece *> pieces;
|
QList<VPPiecePtr> pieces;
|
||||||
QGraphicsScene *scene = this->scene();
|
|
||||||
if (scene != nullptr)
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> list = scene->selectedItems();
|
VPSheetPtr sheet = layout->GetFocusedSheet();
|
||||||
for (auto *item : list)
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
if (item->type() == VPGraphicsPiece::Type)
|
pieces = sheet->GetSelectedPieces();
|
||||||
{
|
|
||||||
auto *pieceItem = dynamic_cast<VPGraphicsPiece*>(item);
|
|
||||||
if (pieceItem != nullptr)
|
|
||||||
{
|
|
||||||
pieces.append(pieceItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,12 +788,15 @@ auto VPGraphicsPieceControls::SelectedPieces() const -> QVector<VPGraphicsPiece
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPGraphicsPieceControls::PiecesBoundingRect(const QVector<VPGraphicsPiece *> &selectedPieces) -> QRectF
|
auto VPGraphicsPieceControls::PiecesBoundingRect(const QList<VPPiecePtr> &selectedPieces) -> QRectF
|
||||||
{
|
{
|
||||||
QRectF rect;
|
QRectF rect;
|
||||||
for (auto *item : selectedPieces)
|
for (const auto& item : selectedPieces)
|
||||||
{
|
{
|
||||||
rect = rect.united(item->sceneBoundingRect());
|
if (not item.isNull())
|
||||||
|
{
|
||||||
|
rect = rect.united(item->MappedDetailBoundingRect());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
|
|
|
@ -114,7 +114,7 @@ private:
|
||||||
VPTransformationOrigon m_savedOrigin{};
|
VPTransformationOrigon m_savedOrigin{};
|
||||||
bool m_originSaved{false};
|
bool m_originSaved{false};
|
||||||
bool allowChangeMerge{false};
|
bool allowChangeMerge{false};
|
||||||
QVector<VPGraphicsPiece *> m_selectedPieces{};
|
QList<VPPiecePtr> m_selectedPieces{};
|
||||||
bool m_ignorePieceTransformation{false};
|
bool m_ignorePieceTransformation{false};
|
||||||
|
|
||||||
auto TopLeftControl(QPainter *painter = nullptr) const -> QPainterPath;
|
auto TopLeftControl(QPainter *painter = nullptr) const -> QPainterPath;
|
||||||
|
@ -130,8 +130,8 @@ private:
|
||||||
|
|
||||||
auto HandleCorner(const QPointF &pos) const -> int;
|
auto HandleCorner(const QPointF &pos) const -> int;
|
||||||
|
|
||||||
auto SelectedPieces() const -> QVector<VPGraphicsPiece *>;
|
auto SelectedPieces() const -> QList<VPPiecePtr>;
|
||||||
static auto PiecesBoundingRect(const QVector<VPGraphicsPiece *> &selectedPieces) -> QRectF;
|
static auto PiecesBoundingRect(const QList<VPPiecePtr> &selectedPieces) -> QRectF;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPGRAPHICSPIECECONTROLS_H
|
#endif // VPGRAPHICSPIECECONTROLS_H
|
||||||
|
|
|
@ -113,10 +113,6 @@ auto VPGraphicsSheet::GetSheetRect() const -> QRectF
|
||||||
|
|
||||||
QPoint topLeft = QPoint(0,0);
|
QPoint topLeft = QPoint(0,0);
|
||||||
QSizeF size = layout->LayoutSettings().GetSheetSize();
|
QSizeF size = layout->LayoutSettings().GetSheetSize();
|
||||||
if(layout->LayoutSettings().GetOrientation() == PageOrientation::Landscape)
|
|
||||||
{
|
|
||||||
size.transpose();
|
|
||||||
}
|
|
||||||
QRectF rect = QRectF(topLeft, size);
|
QRectF rect = QRectF(topLeft, size);
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
@ -130,19 +126,19 @@ auto VPGraphicsSheet::GetMarginsRect() const -> QRectF
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QMarginsF margins = layout->LayoutSettings().GetSheetMargins();
|
|
||||||
QSizeF size = layout->LayoutSettings().GetSheetSize();
|
QSizeF size = layout->LayoutSettings().GetSheetSize();
|
||||||
|
|
||||||
if(layout->LayoutSettings().GetOrientation() == PageOrientation::Landscape)
|
if (not layout->LayoutSettings().IgnoreMargins())
|
||||||
{
|
{
|
||||||
size.transpose();
|
QMarginsF margins = layout->LayoutSettings().GetSheetMargins();
|
||||||
}
|
|
||||||
|
|
||||||
QRectF rect = QRectF(QPointF(margins.left(), margins.top()),
|
QRectF rect = QRectF(QPointF(margins.left(), margins.top()),
|
||||||
QPointF(size.width()-margins.right(), size.height()-margins.bottom()));
|
QPointF(size.width()-margins.right(), size.height()-margins.bottom()));
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return QRectF(0, 0, size.width(), size.height());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPGraphicsSheet::SetShowMargin(bool value)
|
void VPGraphicsSheet::SetShowMargin(bool value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,13 +13,7 @@ VPGraphicsTileGrid::VPGraphicsTileGrid(const VPLayoutPtr &layout, VPTileFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPGraphicsTileGrid::~VPGraphicsTileGrid()
|
auto VPGraphicsTileGrid::boundingRect() const -> QRectF
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QRectF VPGraphicsTileGrid::boundingRect() const
|
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
if(not layout.isNull() && layout->LayoutSettings().GetShowTiles())
|
if(not layout.isNull() && layout->LayoutSettings().GetShowTiles())
|
||||||
|
|
|
@ -42,7 +42,7 @@ class VPGraphicsTileGrid : public QGraphicsItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit VPGraphicsTileGrid(const VPLayoutPtr &layout, VPTileFactory *tileFactory, QGraphicsItem *parent = nullptr);
|
explicit VPGraphicsTileGrid(const VPLayoutPtr &layout, VPTileFactory *tileFactory, QGraphicsItem *parent = nullptr);
|
||||||
~VPGraphicsTileGrid();
|
~VPGraphicsTileGrid()=default;
|
||||||
|
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
|
@ -70,6 +70,8 @@ VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, VPTileFactory
|
||||||
SCASSERT(not m_layout.isNull())
|
SCASSERT(not m_layout.isNull())
|
||||||
setScene(m_scene);
|
setScene(m_scene);
|
||||||
|
|
||||||
|
connect(m_scene, &VMainGraphicsScene::ItemClicked, this, &VPMainGraphicsView::on_ItemClicked);
|
||||||
|
|
||||||
m_graphicsSheet = new VPGraphicsSheet(m_layout);
|
m_graphicsSheet = new VPGraphicsSheet(m_layout);
|
||||||
m_graphicsSheet->setPos(0, 0);
|
m_graphicsSheet->setPos(0, 0);
|
||||||
m_scene->addItem(m_graphicsSheet);
|
m_scene->addItem(m_graphicsSheet);
|
||||||
|
@ -262,6 +264,8 @@ void VPMainGraphicsView::keyPressEvent(QKeyEvent *event)
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
|
emit layout->PieceSelectionChanged(piece);
|
||||||
|
|
||||||
auto *command = new VPUndoMovePieceOnSheet(VPSheetPtr(), piece);
|
auto *command = new VPUndoMovePieceOnSheet(VPSheetPtr(), piece);
|
||||||
layout->UndoStack()->push(command);
|
layout->UndoStack()->push(command);
|
||||||
}
|
}
|
||||||
|
@ -429,11 +433,12 @@ void VPMainGraphicsView::RestoreOrigin() const
|
||||||
origin.custom = false;
|
origin.custom = false;
|
||||||
|
|
||||||
QRectF boundingRect;
|
QRectF boundingRect;
|
||||||
for (auto *graphicsPiece : m_graphicsPieces)
|
QList<VPPiecePtr> selectedPieces = sheet->GetSelectedPieces();
|
||||||
|
for (const auto& piece : selectedPieces)
|
||||||
{
|
{
|
||||||
if (graphicsPiece->isSelected())
|
if (piece->IsSelected())
|
||||||
{
|
{
|
||||||
boundingRect = boundingRect.united(graphicsPiece->sceneBoundingRect());
|
boundingRect = boundingRect.united(piece->MappedDetailBoundingRect());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
origin.origin = boundingRect.center();
|
origin.origin = boundingRect.center();
|
||||||
|
@ -444,6 +449,60 @@ void VPMainGraphicsView::RestoreOrigin() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPMainGraphicsView::on_ItemClicked(QGraphicsItem *item)
|
||||||
|
{
|
||||||
|
if (item == nullptr || (item->type() != VPGraphicsPiece::Type &&
|
||||||
|
item->type() != VPGraphicsPieceControls::Type &&
|
||||||
|
item->type() != VPGraphicsTransformationOrigin::Type))
|
||||||
|
{
|
||||||
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
|
if (not layout.isNull())
|
||||||
|
{
|
||||||
|
VPSheetPtr sheet = layout->GetFocusedSheet();
|
||||||
|
if (not sheet.isNull())
|
||||||
|
{
|
||||||
|
QList<VPPiecePtr> selectedPieces = sheet->GetSelectedPieces();
|
||||||
|
for (const auto& piece : selectedPieces)
|
||||||
|
{
|
||||||
|
if (piece->IsSelected())
|
||||||
|
{
|
||||||
|
piece->SetSelected(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not selectedPieces.isEmpty())
|
||||||
|
{
|
||||||
|
emit layout->PieceSelectionChanged(VPPiecePtr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->type() == VPGraphicsPiece::Type)
|
||||||
|
{
|
||||||
|
auto *pieceItem = dynamic_cast<VPGraphicsPiece*>(item);
|
||||||
|
if (pieceItem != nullptr)
|
||||||
|
{
|
||||||
|
VPPiecePtr piece = pieceItem->GetPiece();
|
||||||
|
if (not piece.isNull())
|
||||||
|
{
|
||||||
|
if (not piece->IsSelected())
|
||||||
|
{
|
||||||
|
piece->SetSelected(true);
|
||||||
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
|
if (not layout.isNull())
|
||||||
|
{
|
||||||
|
emit layout->PieceSelectionChanged(piece);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPMainGraphicsView::ConnectPiece(VPGraphicsPiece *piece)
|
void VPMainGraphicsView::ConnectPiece(VPGraphicsPiece *piece)
|
||||||
{
|
{
|
||||||
|
@ -453,7 +512,7 @@ void VPMainGraphicsView::ConnectPiece(VPGraphicsPiece *piece)
|
||||||
|
|
||||||
connect(layout.get(), &VPLayout::PieceTransformationChanged, piece,
|
connect(layout.get(), &VPLayout::PieceTransformationChanged, piece,
|
||||||
&VPGraphicsPiece::on_RefreshPiece);
|
&VPGraphicsPiece::on_RefreshPiece);
|
||||||
connect(piece, &VPGraphicsPiece::PieceSelectionChanged,
|
connect(layout.get(), &VPLayout::PieceSelectionChanged,
|
||||||
m_rotationControls, &VPGraphicsPieceControls::on_UpdateControls);
|
m_rotationControls, &VPGraphicsPieceControls::on_UpdateControls);
|
||||||
connect(piece, &VPGraphicsPiece::PieceTransformationChanged,
|
connect(piece, &VPGraphicsPiece::PieceTransformationChanged,
|
||||||
m_rotationControls, &VPGraphicsPieceControls::on_UpdateControls);
|
m_rotationControls, &VPGraphicsPieceControls::on_UpdateControls);
|
||||||
|
@ -485,19 +544,21 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle)
|
||||||
|
|
||||||
auto PreparePieces = [this]()
|
auto PreparePieces = [this]()
|
||||||
{
|
{
|
||||||
QVector<VPPiecePtr> pieces;
|
QList<VPPiecePtr> pieces;
|
||||||
for (auto *item : m_graphicsPieces)
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
if (item->isSelected())
|
VPSheetPtr sheet = layout->GetFocusedSheet();
|
||||||
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
pieces.append(item->GetPiece());
|
pieces = sheet->GetSelectedPieces();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pieces;
|
return pieces;
|
||||||
};
|
};
|
||||||
|
|
||||||
QVector<VPPiecePtr> pieces = PreparePieces();
|
QList<VPPiecePtr> pieces = PreparePieces();
|
||||||
|
|
||||||
if (pieces.size() == 1)
|
if (pieces.size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -535,19 +596,21 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
|
||||||
|
|
||||||
auto PreparePieces = [this]()
|
auto PreparePieces = [this]()
|
||||||
{
|
{
|
||||||
QVector<VPPiecePtr> pieces;
|
QList<VPPiecePtr> pieces;
|
||||||
for (auto *graphicsPiece : m_graphicsPieces)
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
if (graphicsPiece->isSelected())
|
VPSheetPtr sheet = layout->GetFocusedSheet();
|
||||||
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
pieces.append(graphicsPiece->GetPiece());
|
pieces = sheet->GetSelectedPieces();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pieces;
|
return pieces;
|
||||||
};
|
};
|
||||||
|
|
||||||
QVector<VPPiecePtr> pieces = PreparePieces();
|
QList<VPPiecePtr> pieces = PreparePieces();
|
||||||
if (pieces.size() == 1)
|
if (pieces.size() == 1)
|
||||||
{
|
{
|
||||||
auto *command = new VPUndoPieceMove(pieces.first(), dx, dy, m_allowChangeMerge);
|
auto *command = new VPUndoPieceMove(pieces.first(), dx, dy, m_allowChangeMerge);
|
||||||
|
|
|
@ -95,6 +95,7 @@ protected:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void RestoreOrigin() const;
|
void RestoreOrigin() const;
|
||||||
|
void on_ItemClicked(QGraphicsItem* item);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPMainGraphicsView)
|
Q_DISABLE_COPY(VPMainGraphicsView)
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
<file>puzzleicon/64x64/iconCurrentPiece.png</file>
|
<file>puzzleicon/64x64/iconCurrentPiece.png</file>
|
||||||
<file>puzzleicon/64x64/iconLayers.png</file>
|
<file>puzzleicon/64x64/iconLayers.png</file>
|
||||||
<file>puzzleicon/64x64/iconTiles.png</file>
|
<file>puzzleicon/64x64/iconTiles.png</file>
|
||||||
<file>puzzleicon/64x64/iconLandscape.png</file>
|
|
||||||
<file>puzzleicon/64x64/iconPortrait.png</file>
|
|
||||||
<file>puzzleicon/64x64/iconGrainlineVertical.png</file>
|
|
||||||
<file>puzzleicon/64x64/iconGrainlineHorizontal.png</file>
|
|
||||||
<file>puzzleicon/64x64/iconProperties.png</file>
|
<file>puzzleicon/64x64/iconProperties.png</file>
|
||||||
<file>puzzleicon/svg/icon_scissors.svg</file>
|
<file>puzzleicon/svg/icon_scissors.svg</file>
|
||||||
<file>puzzleicon/svg/icon_scissors_vertical.svg</file>
|
<file>puzzleicon/svg/icon_scissors_vertical.svg</file>
|
||||||
|
@ -18,10 +14,6 @@
|
||||||
<file>puzzleicon/svg/cursor_rotate.svg</file>
|
<file>puzzleicon/svg/cursor_rotate.svg</file>
|
||||||
<file>puzzleicon/svg/icon_rotate_90_anticlockwise.svg</file>
|
<file>puzzleicon/svg/icon_rotate_90_anticlockwise.svg</file>
|
||||||
<file>puzzleicon/svg/icon_rotate_90_clockwise.svg</file>
|
<file>puzzleicon/svg/icon_rotate_90_clockwise.svg</file>
|
||||||
<file>puzzleicon/64x64/iconRotate90Anticlockwise.png</file>
|
|
||||||
<file>puzzleicon/64x64/iconRotate90Clockwise.png</file>
|
|
||||||
<file>puzzleicon/64x64/iconRotateGrainlineHorizontal.png</file>
|
|
||||||
<file>puzzleicon/64x64/iconRotateGrainlineVertical.png</file>
|
|
||||||
<file>puzzleicon/svg/icon_rotate_grainline_horizontal.svg</file>
|
<file>puzzleicon/svg/icon_rotate_grainline_horizontal.svg</file>
|
||||||
<file>puzzleicon/svg/icon_rotate_grainline_vertical.svg</file>
|
<file>puzzleicon/svg/icon_rotate_grainline_vertical.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
|
Before Width: | Height: | Size: 979 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 984 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.6 KiB |
|
@ -59,7 +59,7 @@ void VPUndoMovePieceOnSheet::undo()
|
||||||
if (not activateSheet.isNull())
|
if (not activateSheet.isNull())
|
||||||
{
|
{
|
||||||
layout = activateSheet->GetLayout();
|
layout = activateSheet->GetLayout();
|
||||||
if (not layout.isNull() && not activateSheet->TrashSheet())
|
if (not layout.isNull() && not activateSheet->TrashSheet() && layout->GetFocusedSheet() != activateSheet)
|
||||||
{
|
{
|
||||||
layout->SetFocusedSheet(activateSheet);
|
layout->SetFocusedSheet(activateSheet);
|
||||||
}
|
}
|
||||||
|
@ -69,10 +69,12 @@ void VPUndoMovePieceOnSheet::undo()
|
||||||
if (not piece.isNull())
|
if (not piece.isNull())
|
||||||
{
|
{
|
||||||
piece->SetSheet(sourceSheet);
|
piece->SetSheet(sourceSheet);
|
||||||
|
piece->SetSelected(false);
|
||||||
|
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
emit layout->PieceSheetChanged(piece);
|
emit layout->PieceSheetChanged(piece);
|
||||||
|
emit layout->PieceSelectionChanged(piece);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +94,7 @@ void VPUndoMovePieceOnSheet::redo()
|
||||||
if (not activateSheet.isNull())
|
if (not activateSheet.isNull())
|
||||||
{
|
{
|
||||||
layout = activateSheet->GetLayout();
|
layout = activateSheet->GetLayout();
|
||||||
if (not layout.isNull() && not activateSheet->TrashSheet())
|
if (not layout.isNull() && not activateSheet->TrashSheet() && layout->GetFocusedSheet() != activateSheet)
|
||||||
{
|
{
|
||||||
layout->SetFocusedSheet(activateSheet);
|
layout->SetFocusedSheet(activateSheet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,10 @@ void VPUndoOriginMove::undo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layout->GetFocusedSheet() != sheet)
|
||||||
|
{
|
||||||
layout->SetFocusedSheet(sheet);
|
layout->SetFocusedSheet(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
sheet->SetTransformationOrigin(m_oldOrigin);
|
sheet->SetTransformationOrigin(m_oldOrigin);
|
||||||
layout->TransformationOriginChanged();
|
layout->TransformationOriginChanged();
|
||||||
|
@ -80,7 +83,10 @@ void VPUndoOriginMove::redo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layout->GetFocusedSheet() != sheet)
|
||||||
|
{
|
||||||
layout->SetFocusedSheet(sheet);
|
layout->SetFocusedSheet(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
sheet->SetTransformationOrigin(m_origin);
|
sheet->SetTransformationOrigin(m_origin);
|
||||||
emit layout->TransformationOriginChanged();
|
emit layout->TransformationOriginChanged();
|
||||||
|
|
|
@ -59,7 +59,10 @@ void VPUndoPieceMove::undo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layout->GetFocusedSheet() != piece->Sheet())
|
||||||
|
{
|
||||||
layout->SetFocusedSheet(piece->Sheet());
|
layout->SetFocusedSheet(piece->Sheet());
|
||||||
|
}
|
||||||
|
|
||||||
piece->SetMatrix(m_oldTransform);
|
piece->SetMatrix(m_oldTransform);
|
||||||
emit layout->PieceTransformationChanged(piece);
|
emit layout->PieceTransformationChanged(piece);
|
||||||
|
@ -80,7 +83,10 @@ void VPUndoPieceMove::redo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layout->GetFocusedSheet() != piece->Sheet())
|
||||||
|
{
|
||||||
layout->SetFocusedSheet(piece->Sheet());
|
layout->SetFocusedSheet(piece->Sheet());
|
||||||
|
}
|
||||||
|
|
||||||
piece->Translate(m_dx, m_dy);
|
piece->Translate(m_dx, m_dy);
|
||||||
emit layout->PieceTransformationChanged(piece);
|
emit layout->PieceTransformationChanged(piece);
|
||||||
|
@ -117,7 +123,7 @@ auto VPUndoPieceMove::id() const -> int
|
||||||
|
|
||||||
// move pieces
|
// move pieces
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPUndoPiecesMove::VPUndoPiecesMove(const QVector<VPPiecePtr> &pieces, qreal dx, qreal dy, bool allowMerge,
|
VPUndoPiecesMove::VPUndoPiecesMove(const QList<VPPiecePtr> &pieces, qreal dx, qreal dy, bool allowMerge,
|
||||||
QUndoCommand *parent)
|
QUndoCommand *parent)
|
||||||
: VPUndoCommand(allowMerge, parent),
|
: VPUndoCommand(allowMerge, parent),
|
||||||
m_dx(dx),
|
m_dx(dx),
|
||||||
|
@ -149,7 +155,11 @@ void VPUndoPiecesMove::undo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->SetFocusedSheet(Sheet());
|
VPSheetPtr sheet = Sheet();
|
||||||
|
if (layout->GetFocusedSheet() != sheet)
|
||||||
|
{
|
||||||
|
layout->SetFocusedSheet(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& piece : m_pieces)
|
for (const auto& piece : m_pieces)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +189,11 @@ void VPUndoPiecesMove::redo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->SetFocusedSheet(Sheet());
|
VPSheetPtr sheet = Sheet();
|
||||||
|
if (layout->GetFocusedSheet() != sheet)
|
||||||
|
{
|
||||||
|
layout->SetFocusedSheet(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& piece : m_pieces)
|
for (const auto& piece : m_pieces)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ class VPUndoPieceMove : public VPUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VPUndoPieceMove(const VPPiecePtr &piece, qreal dx, qreal dy, bool allowMerge,
|
explicit VPUndoPieceMove(const VPPiecePtr &piece, qreal dx, qreal dy, bool allowMerge = false,
|
||||||
QUndoCommand *parent = nullptr);
|
QUndoCommand *parent = nullptr);
|
||||||
virtual ~VPUndoPieceMove()=default;
|
virtual ~VPUndoPieceMove()=default;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class VPUndoPiecesMove : public VPUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VPUndoPiecesMove(const QVector<VPPiecePtr> &pieces, qreal dx, qreal dy, bool allowMerge,
|
explicit VPUndoPiecesMove(const QList<VPPiecePtr> &pieces, qreal dx, qreal dy, bool allowMerge = false,
|
||||||
QUndoCommand *parent = nullptr);
|
QUndoCommand *parent = nullptr);
|
||||||
virtual ~VPUndoPiecesMove()=default;
|
virtual ~VPUndoPiecesMove()=default;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,10 @@ void VPUndoPieceRotate::undo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layout->GetFocusedSheet() != piece->Sheet())
|
||||||
|
{
|
||||||
layout->SetFocusedSheet(piece->Sheet());
|
layout->SetFocusedSheet(piece->Sheet());
|
||||||
|
}
|
||||||
|
|
||||||
piece->SetMatrix(m_oldTransform);
|
piece->SetMatrix(m_oldTransform);
|
||||||
emit layout->PieceTransformationChanged(piece);
|
emit layout->PieceTransformationChanged(piece);
|
||||||
|
@ -80,7 +83,10 @@ void VPUndoPieceRotate::redo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layout->GetFocusedSheet() != piece->Sheet())
|
||||||
|
{
|
||||||
layout->SetFocusedSheet(piece->Sheet());
|
layout->SetFocusedSheet(piece->Sheet());
|
||||||
|
}
|
||||||
|
|
||||||
piece->Rotate(m_origin, m_angle);
|
piece->Rotate(m_origin, m_angle);
|
||||||
emit layout->PieceTransformationChanged(piece);
|
emit layout->PieceTransformationChanged(piece);
|
||||||
|
@ -116,7 +122,7 @@ auto VPUndoPieceRotate::id() const -> int
|
||||||
|
|
||||||
// rotate pieces
|
// rotate pieces
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPUndoPiecesRotate::VPUndoPiecesRotate(const QVector<VPPiecePtr> &pieces, const QPointF &origin, qreal angle,
|
VPUndoPiecesRotate::VPUndoPiecesRotate(const QList<VPPiecePtr> &pieces, const QPointF &origin, qreal angle,
|
||||||
bool allowMerge, QUndoCommand *parent)
|
bool allowMerge, QUndoCommand *parent)
|
||||||
: VPUndoCommand(allowMerge, parent),
|
: VPUndoCommand(allowMerge, parent),
|
||||||
m_origin(origin),
|
m_origin(origin),
|
||||||
|
@ -148,7 +154,11 @@ void VPUndoPiecesRotate::undo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->SetFocusedSheet(Sheet());
|
VPSheetPtr sheet = Sheet();
|
||||||
|
if (layout->GetFocusedSheet() != sheet)
|
||||||
|
{
|
||||||
|
layout->SetFocusedSheet(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& piece : m_pieces)
|
for (const auto& piece : m_pieces)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +188,11 @@ void VPUndoPiecesRotate::redo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->SetFocusedSheet(Sheet());
|
VPSheetPtr sheet = Sheet();
|
||||||
|
if (layout->GetFocusedSheet() != sheet)
|
||||||
|
{
|
||||||
|
layout->SetFocusedSheet(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& piece : m_pieces)
|
for (const auto& piece : m_pieces)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ class VPUndoPieceRotate : public VPUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VPUndoPieceRotate(const VPPiecePtr &piece, const QPointF &origin, qreal angle, bool allowMerge,
|
VPUndoPieceRotate(const VPPiecePtr &piece, const QPointF &origin, qreal angle, bool allowMerge = false,
|
||||||
QUndoCommand *parent = nullptr);
|
QUndoCommand *parent = nullptr);
|
||||||
|
|
||||||
virtual ~VPUndoPieceRotate()=default;
|
virtual ~VPUndoPieceRotate()=default;
|
||||||
|
@ -85,8 +85,8 @@ class VPUndoPiecesRotate : public VPUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VPUndoPiecesRotate(const QVector<VPPiecePtr> &pieces, const QPointF &origin, qreal angle, bool allowMerge,
|
explicit VPUndoPiecesRotate(const QList<VPPiecePtr> &pieces, const QPointF &origin, qreal angle,
|
||||||
QUndoCommand *parent = nullptr);
|
bool allowMerge = false, QUndoCommand *parent = nullptr);
|
||||||
virtual ~VPUndoPiecesRotate()=default;
|
virtual ~VPUndoPiecesRotate()=default;
|
||||||
|
|
||||||
virtual void undo() override;
|
virtual void undo() override;
|
||||||
|
|
|
@ -44,10 +44,6 @@ void VPExporter::Export(VPLayout* layout, LayoutExportFormats format, VPMainGrap
|
||||||
SetFileName(fileName);
|
SetFileName(fileName);
|
||||||
|
|
||||||
QSizeF size = QSizeF(layout->GetFocusedSheet()->GetLayout()->LayoutSettings().GetSheetSize());
|
QSizeF size = QSizeF(layout->GetFocusedSheet()->GetLayout()->LayoutSettings().GetSheetSize());
|
||||||
if(layout->GetFocusedSheet()->GetLayout()->LayoutSettings().GetOrientation() == PageOrientation::Landscape)
|
|
||||||
{
|
|
||||||
size.transpose();
|
|
||||||
}
|
|
||||||
const QRectF rect = QRectF(0, 0, size.width(), size.height());
|
const QRectF rect = QRectF(0, 0, size.width(), size.height());
|
||||||
|
|
||||||
SetImageRect(rect);
|
SetImageRect(rect);
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "../vlayout/vlayoutdef.h"
|
#include "../vlayout/vlayoutdef.h"
|
||||||
#include "../vwidgets/vabstractmainwindow.h"
|
#include "../vwidgets/vabstractmainwindow.h"
|
||||||
#include "../vmisc/vlockguard.h"
|
#include "../vmisc/vlockguard.h"
|
||||||
|
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -154,40 +155,24 @@ private slots:
|
||||||
void on_actionAboutPuzzle_triggered();
|
void on_actionAboutPuzzle_triggered();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_comboBoxLayoutUnit_currentIndexChanged When the unit is changed in
|
* @brief on_LayoutUnitChanged When the unit is changed in
|
||||||
* the layout property tab.
|
* the layout property tab.
|
||||||
* The slot is automatically connected through name convention.
|
* The slot is automatically connected through name convention.
|
||||||
* @param index the index of the selected unit
|
* @param index the index of the selected unit
|
||||||
*/
|
*/
|
||||||
void on_comboBoxLayoutUnit_currentIndexChanged(int index);
|
void on_LayoutUnitChanged(int index);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_lineEditSheetName_textChanged When the name of the sheet is changed
|
|
||||||
* in the sheet layout tab
|
|
||||||
* @param text name of the sheet
|
|
||||||
*/
|
|
||||||
void on_lineEditSheetName_textChanged(const QString &text);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_comboBoxLayoutTemplate_currentIndexChanged When the template is
|
|
||||||
* changed in the sheet property tab.
|
|
||||||
* The slot is automatically connected through name convention.
|
|
||||||
* @param index the index of the selected templated
|
|
||||||
*/
|
|
||||||
void on_comboBoxSheetTemplate_currentIndexChanged(int index);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_SheetSizeChanged When the width or the length has been changed in
|
* @brief on_SheetSizeChanged When the width or the length has been changed in
|
||||||
* the sheet property tab
|
* the sheet property tab
|
||||||
* @param changedViaSizeCombobox true if the change happened through the combobox
|
|
||||||
*/
|
*/
|
||||||
void on_SheetSizeChanged(bool changedViaSizeCombobox = true);
|
void on_SheetSizeChanged();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_SheetOrientationChanged When one of the radio boxes for the sheet
|
* @brief on_SheetOrientationChanged When one of the radio boxes for the sheet
|
||||||
* orientation has been clicked
|
* orientation has been clicked
|
||||||
*/
|
*/
|
||||||
void on_SheetOrientationChanged();
|
void on_SheetOrientationChanged(bool checked);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_pushButtonLayoutRemoveUnusedLength_clicked When the button
|
* @brief on_pushButtonLayoutRemoveUnusedLength_clicked When the button
|
||||||
|
@ -225,40 +210,17 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void on_doubleSpinBoxSheetGridRowHeight_valueChanged(double value);
|
void on_doubleSpinBoxSheetGridRowHeight_valueChanged(double value);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief LayoutFollowGrainlineChanged When one of the radio boxes for the
|
|
||||||
* "Follow grainline" has been clicked in the sheet property tab.
|
|
||||||
*/
|
|
||||||
void on_SheetFollowGrainlineChanged();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_doubleSpinBoxLayoutPiecesGap_valueChanged When the "pieces gap"
|
|
||||||
* value is changed in the layout property tab.
|
|
||||||
* The slot is automatically connected through name convention.
|
|
||||||
* @param value the new value of the pieces gap
|
|
||||||
*/
|
|
||||||
void on_doubleSpinBoxSheetPiecesGap_valueChanged(double value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_comboBoxTilesTemplate_currentIndexChanged When the template is
|
|
||||||
* changed in the tiles property tab.
|
|
||||||
* The slot is automatically connected through name convention.
|
|
||||||
* @param index the index of the selected templated
|
|
||||||
*/
|
|
||||||
void on_comboBoxTilesTemplate_currentIndexChanged(int index);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_TilesSizeChanged When the width or the length has been changed in
|
* @brief on_TilesSizeChanged When the width or the length has been changed in
|
||||||
* the tiles property tab
|
* the tiles property tab
|
||||||
* @param changedViaSizeCombobox true if the change happened through the combobox
|
|
||||||
*/
|
*/
|
||||||
void on_TilesSizeChanged(bool changedViaSizeCombobox = true);
|
void on_TilesSizeChanged();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_TilesOrientationChanged When one of the radio boxes for the tiles
|
* @brief on_TilesOrientationChanged When one of the radio boxes for the tiles
|
||||||
* orientation has been clicked
|
* orientation has been clicked
|
||||||
*/
|
*/
|
||||||
void on_TilesOrientationChanged();
|
void on_TilesOrientationChanged(bool checked);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_TilesMarginChanged When one of the margin values has been changed
|
* @brief on_TilesMarginChanged When one of the margin values has been changed
|
||||||
|
@ -266,44 +228,11 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void on_TilesMarginChanged();
|
void on_TilesMarginChanged();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_checkBoxTilesShowTiles_toggled When the checkbox "show tiles" is
|
|
||||||
* clicked
|
|
||||||
* @param checked show tiles
|
|
||||||
*/
|
|
||||||
void on_checkBoxTilesShowTiles_toggled(bool checked);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_pushButtonTilesExport_clicked When the export tiles button is clicked
|
* @brief on_pushButtonTilesExport_clicked When the export tiles button is clicked
|
||||||
*/
|
*/
|
||||||
void on_pushButtonTilesExport_clicked();
|
void on_pushButtonTilesExport_clicked();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_checkBoxLayoutWarningPiecesSuperposition_toggled When the
|
|
||||||
* "Warning when pieces superposition" checkbox value in the layout
|
|
||||||
* property tab is toggled.
|
|
||||||
* The slot is automatically connected through name convention.
|
|
||||||
* @param checked the new checked value
|
|
||||||
*/
|
|
||||||
void on_checkBoxLayoutWarningPiecesSuperposition_toggled(bool checked);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_checkBoxLayoutWarningPiecesOutOfBound_toggled When the
|
|
||||||
* "Warning when pieces out of bound" checkbox value in the layout property
|
|
||||||
* tab is toggled.
|
|
||||||
* The slot is automatically connected through name convention.
|
|
||||||
* @param checked the new checked value
|
|
||||||
*/
|
|
||||||
void on_checkBoxLayoutWarningPiecesOutOfBound_toggled(bool checked);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_checkBoxLayoutStickyEdges_toggled When the "Sticky edges"
|
|
||||||
* checkbox value in the layout property tab is toggled.
|
|
||||||
* The slot is automatically connected through name convention.
|
|
||||||
* @param checked the new checked value
|
|
||||||
*/
|
|
||||||
void on_checkBoxSheetStickyEdges_toggled(bool checked);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_pushButtonLayoutExport_clicked When the button
|
* @brief on_pushButtonLayoutExport_clicked When the button
|
||||||
* "Export layout" in the layout property is clicked.
|
* "Export layout" in the layout property is clicked.
|
||||||
|
@ -327,30 +256,6 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void on_checkBoxCurrentPieceMirrorPiece_toggled(bool checked);
|
void on_checkBoxCurrentPieceMirrorPiece_toggled(bool checked);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_pushButtonCurrentPieceRotate90Antilockwise_clicked When the 90
|
|
||||||
* anticlockwise angle button is clicked
|
|
||||||
*/
|
|
||||||
void on_pushButtonCurrentPieceRotate90Anticlockwise_clicked();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_pushButtonCurrentPieceRotate90Clockwise_clicked When the 90
|
|
||||||
* clockwise angle button is clicked
|
|
||||||
*/
|
|
||||||
void on_pushButtonCurrentPieceRotate90Clockwise_clicked();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_pushButtonCurrentPieceRotateGrainlineVertical_clicked
|
|
||||||
* When the grainline vertical angle button is clicked
|
|
||||||
*/
|
|
||||||
void on_pushButtonCurrentPieceRotateGrainlineVertical_clicked();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_pushButtonCurrentPieceRotateGrainlineHorizontal_clicked
|
|
||||||
* When the grainline horizontal angle button is clicked
|
|
||||||
*/
|
|
||||||
void on_pushButtonCurrentPieceRotateGrainlineHorizontal_clicked();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_doubleSpinBoxCurrentPieceAngle_valueChanged When the
|
* @brief on_doubleSpinBoxCurrentPieceAngle_valueChanged When the
|
||||||
* "Current Piece Angle" value in the current piece property is changed
|
* "Current Piece Angle" value in the current piece property is changed
|
||||||
|
@ -359,12 +264,6 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void on_doubleSpinBoxCurrentPieceAngle_valueChanged(double value);
|
void on_doubleSpinBoxCurrentPieceAngle_valueChanged(double value);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_CurrentPiecePositionChanged When the positionX or the positionY
|
|
||||||
* is changed in the current piece tab
|
|
||||||
*/
|
|
||||||
void on_CurrentPiecePositionEdited();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CarrouselLocationChanged When the piece carrousel's location
|
* @brief CarrouselLocationChanged When the piece carrousel's location
|
||||||
* has been changed
|
* has been changed
|
||||||
|
@ -377,16 +276,6 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void on_PieceSelectionChanged();
|
void on_PieceSelectionChanged();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_PiecePositionChanged When the current piece position has changed
|
|
||||||
*/
|
|
||||||
void on_PiecePositionChanged();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief on_PieceRotationChanged When the current piece rotation has changed
|
|
||||||
*/
|
|
||||||
void on_PieceRotationChanged();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief on_ScaleChanged When the scale of the graphic view is changed
|
* @brief on_ScaleChanged When the scale of the graphic view is changed
|
||||||
*/
|
*/
|
||||||
|
@ -406,6 +295,14 @@ private slots:
|
||||||
|
|
||||||
void on_actionAddSheet_triggered();
|
void on_actionAddSheet_triggered();
|
||||||
|
|
||||||
|
void on_ApplyPieceTransformation();
|
||||||
|
|
||||||
|
void on_ResetPieceTransformationSettings();
|
||||||
|
|
||||||
|
void on_RelativeTranslationChanged(bool checked);
|
||||||
|
|
||||||
|
void on_ConvertPaperSize();
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
void AboutToShowDockMenu();
|
void AboutToShowDockMenu();
|
||||||
#endif //defined(Q_OS_MAC)
|
#endif //defined(Q_OS_MAC)
|
||||||
|
@ -422,7 +319,6 @@ private:
|
||||||
QUndoStack *m_undoStack;
|
QUndoStack *m_undoStack;
|
||||||
|
|
||||||
VPLayoutPtr m_layout;
|
VPLayoutPtr m_layout;
|
||||||
QList<VPPiece *>m_selectedPieces{QList<VPPiece *>()};
|
|
||||||
|
|
||||||
VPTileFactory *m_tileFactory{nullptr};
|
VPTileFactory *m_tileFactory{nullptr};
|
||||||
|
|
||||||
|
@ -449,6 +345,9 @@ private:
|
||||||
QAction *undoAction{nullptr};
|
QAction *undoAction{nullptr};
|
||||||
QAction *redoAction{nullptr};
|
QAction *redoAction{nullptr};
|
||||||
|
|
||||||
|
Unit m_oldPieceTranslationUnit{Unit::Mm};
|
||||||
|
Unit m_oldLayoutUnit{Unit::Mm};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CreatePiece creates a piece from the given VLayoutPiece data
|
* @brief CreatePiece creates a piece from the given VLayoutPiece data
|
||||||
* @param rawPiece the raw piece data
|
* @param rawPiece the raw piece data
|
||||||
|
@ -535,22 +434,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void SetPropertyTabLayoutData();
|
void SetPropertyTabLayoutData();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SetDoubleSpinBoxValue sets the given spinbox to the given value.
|
|
||||||
* the signals are blocked before changing the value and unblocked after
|
|
||||||
* @param spinBox pointer to spinbox
|
|
||||||
* @param value spinbox value
|
|
||||||
*/
|
|
||||||
void SetDoubleSpinBoxValue(QDoubleSpinBox *spinBox, qreal value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SetCheckBoxValue sets the given checkbox to the given value.
|
|
||||||
* the signals are blocked before changing the value and unblocked after
|
|
||||||
* @param checkbox pointer to checkbox
|
|
||||||
* @param value checkbox value
|
|
||||||
*/
|
|
||||||
void SetCheckBoxValue(QCheckBox *checkbox, bool value);
|
|
||||||
|
|
||||||
void ReadSettings();
|
void ReadSettings();
|
||||||
void WriteSettings();
|
void WriteSettings();
|
||||||
|
|
||||||
|
@ -567,6 +450,34 @@ private:
|
||||||
auto IsLayoutReadOnly() const -> bool;
|
auto IsLayoutReadOnly() const -> bool;
|
||||||
|
|
||||||
void ConnectToPreferences(const QSharedPointer<DialogPuzzlePreferences> &preferences);
|
void ConnectToPreferences(const QSharedPointer<DialogPuzzlePreferences> &preferences);
|
||||||
|
|
||||||
|
auto SelectedPieces() const -> QList<VPPiecePtr>;
|
||||||
|
|
||||||
|
auto TranslateUnit() const -> Unit;
|
||||||
|
auto LayoutUnit() const -> Unit;
|
||||||
|
|
||||||
|
QSizeF Template(VAbstractLayoutDialog::PaperSizeTemplate t) const;
|
||||||
|
QSizeF SheetTemplate() const;
|
||||||
|
QSizeF TileTemplate() const;
|
||||||
|
|
||||||
|
void SheetSize(const QSizeF &size);
|
||||||
|
void TileSize(const QSizeF &size);
|
||||||
|
|
||||||
|
void CorrectPaperDecimals();
|
||||||
|
|
||||||
|
void SheetPaperSizeChanged();
|
||||||
|
void TilePaperSizeChanged();
|
||||||
|
|
||||||
|
void MinimumSheetPaperSize();
|
||||||
|
void MinimumTilePaperSize();
|
||||||
|
|
||||||
|
void FindTemplate(QComboBox *box, qreal width, qreal height);
|
||||||
|
void FindSheetTemplate();
|
||||||
|
void FindTileTemplate();
|
||||||
|
|
||||||
|
void CorrectTileMaxMargins();
|
||||||
|
void CorrectSheetMaxMargins();
|
||||||
|
void CorrectMaxMargins();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPMAINWINDOW_H
|
#endif // VPMAINWINDOW_H
|
||||||
|
|
|
@ -273,6 +273,13 @@ auto VPSettings::GetLayoutFollowGrainline() const -> bool
|
||||||
return value(*settingLayoutFollowGrainline, false).toBool();
|
return value(*settingLayoutFollowGrainline, false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VPSettings::GetMaxLayoutPieceGap()
|
||||||
|
{
|
||||||
|
return UnitConvertor(50, Unit::Cm, Unit::Px);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSettings::SetLayoutPieceGap(qreal value)
|
void VPSettings::SetLayoutPieceGap(qreal value)
|
||||||
{
|
{
|
||||||
setValue(*settingLayoutPieceGap, value);
|
setValue(*settingLayoutPieceGap, value);
|
||||||
|
|
|
@ -90,6 +90,7 @@ public:
|
||||||
void SetLayoutFollowGrainline(bool value);
|
void SetLayoutFollowGrainline(bool value);
|
||||||
auto GetLayoutFollowGrainline() const -> bool;
|
auto GetLayoutFollowGrainline() const -> bool;
|
||||||
|
|
||||||
|
static auto GetMaxLayoutPieceGap() -> qreal;
|
||||||
void SetLayoutPieceGap(qreal value);
|
void SetLayoutPieceGap(qreal value);
|
||||||
auto GetLayoutPieceGap() const -> qreal;
|
auto GetLayoutPieceGap() const -> qreal;
|
||||||
|
|
||||||
|
|
|
@ -22,43 +22,38 @@ void VPTileFactory::refreshTileInfos()
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
if(not layout.isNull())
|
if(not layout.isNull())
|
||||||
{
|
{
|
||||||
PageOrientation tilesOrientation = layout->LayoutSettings().GetTilesOrientation();
|
|
||||||
QSizeF tilesSize = layout->LayoutSettings().GetTilesSize();
|
QSizeF tilesSize = layout->LayoutSettings().GetTilesSize();
|
||||||
QMarginsF tilesMargins = layout->LayoutSettings().GetTilesMargins();
|
QMarginsF tilesMargins = layout->LayoutSettings().GetTilesMargins();
|
||||||
|
|
||||||
// sets the drawing height
|
// sets the drawing height
|
||||||
m_drawingAreaHeight = (tilesOrientation == PageOrientation::Portrait)?
|
m_drawingAreaHeight = tilesSize.height();
|
||||||
tilesSize.height() : tilesSize.width();
|
|
||||||
m_drawingAreaHeight -=
|
|
||||||
tilesMargins.top() + tilesMargins.bottom() + m_infoStripeWidth;
|
|
||||||
|
|
||||||
// sets the drawing width
|
if (not layout->LayoutSettings().IgnoreTilesMargins())
|
||||||
m_drawingAreaWidth = (tilesOrientation == PageOrientation::Portrait)?
|
|
||||||
tilesSize.width() : tilesSize.height();
|
|
||||||
m_drawingAreaWidth -=
|
|
||||||
tilesMargins.left() + tilesMargins.right() + m_infoStripeWidth;
|
|
||||||
|
|
||||||
|
|
||||||
QSizeF sheetSize = layout->LayoutSettings().GetSheetSize();
|
|
||||||
qreal totalDrawingWidth = 0;
|
|
||||||
qreal totaldrawingHeight = 0;
|
|
||||||
|
|
||||||
if(layout->LayoutSettings().GetOrientation() == PageOrientation::Portrait)
|
|
||||||
{
|
{
|
||||||
totalDrawingWidth = sheetSize.width();
|
m_drawingAreaHeight -= tilesMargins.top() + tilesMargins.bottom() + m_infoStripeWidth;
|
||||||
totaldrawingHeight = sheetSize.height();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalDrawingWidth = sheetSize.height();
|
m_drawingAreaHeight += m_infoStripeWidth;
|
||||||
totaldrawingHeight = sheetSize.width();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_nbCol = qCeil(totalDrawingWidth/m_drawingAreaWidth);
|
// sets the drawing width
|
||||||
m_nbRow = qCeil(totaldrawingHeight/m_drawingAreaHeight);
|
m_drawingAreaWidth = tilesSize.width();
|
||||||
|
|
||||||
|
if (not layout->LayoutSettings().IgnoreTilesMargins())
|
||||||
|
{
|
||||||
|
m_drawingAreaWidth -= tilesMargins.left() + tilesMargins.right() + m_infoStripeWidth;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_drawingAreaWidth += m_infoStripeWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSizeF sheetSize = layout->LayoutSettings().GetSheetSize();
|
||||||
|
m_nbCol = qCeil(sheetSize.width()/m_drawingAreaWidth);
|
||||||
|
m_nbRow = qCeil(sheetSize.height()/m_drawingAreaHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPTileFactory::drawTile(QPainter *painter, VPMainGraphicsView *graphicsView, int row, int col)
|
void VPTileFactory::drawTile(QPainter *painter, VPMainGraphicsView *graphicsView, int row, int col)
|
||||||
|
|
|
@ -147,8 +147,6 @@ void VPLayoutFileWriter::WriteFile(const VPLayoutPtr &layout, QIODevice *file)
|
||||||
.arg(APP_VERSION_STR));
|
.arg(APP_VERSION_STR));
|
||||||
WriteLayout(layout);
|
WriteLayout(layout);
|
||||||
writeEndDocument();
|
writeEndDocument();
|
||||||
|
|
||||||
file->close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -149,7 +149,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
||||||
|
|
||||||
ui->lineEditPath->setText(VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout());
|
ui->lineEditPath->setText(VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout());
|
||||||
|
|
||||||
InitTemplates(ui->comboBoxTemplates);
|
InitTileTemplates(ui->comboBoxTemplates);
|
||||||
|
|
||||||
connect(ui->toolButtonScaleConnected, &QToolButton::clicked, this, &DialogSaveLayout::ToggleScaleConnection);
|
connect(ui->toolButtonScaleConnected, &QToolButton::clicked, this, &DialogSaveLayout::ToggleScaleConnection);
|
||||||
|
|
||||||
|
@ -163,20 +163,6 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
||||||
ShowExample();//Show example for current format.
|
ShowExample();//Show example for current format.
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogSaveLayout::InitTemplates(QComboBox *comboBoxTemplates)
|
|
||||||
{
|
|
||||||
SCASSERT(comboBoxTemplates != nullptr)
|
|
||||||
VAbstractLayoutDialog::InitTemplates(comboBoxTemplates);
|
|
||||||
|
|
||||||
// remove unused formats
|
|
||||||
for (int i = static_cast<int>(PaperSizeTemplate::Roll24in); i <= static_cast<int>(PaperSizeTemplate::Custom); ++i)
|
|
||||||
{
|
|
||||||
comboBoxTemplates->removeItem(comboBoxTemplates->findData(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void DialogSaveLayout::SelectFormat(LayoutExportFormats format)
|
void DialogSaveLayout::SelectFormat(LayoutExportFormats format)
|
||||||
|
|
|
@ -83,7 +83,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event) override;
|
virtual void showEvent(QShowEvent *event) override;
|
||||||
void InitTemplates(QComboBox *comboBoxTemplates);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Save();
|
void Save();
|
||||||
|
|
|
@ -84,6 +84,23 @@ void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)
|
||||||
comboBoxTemplates->setCurrentIndex(-1);
|
comboBoxTemplates->setCurrentIndex(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractLayoutDialog::InitTileTemplates(QComboBox *comboBoxTemplates, bool keepCustom)
|
||||||
|
{
|
||||||
|
SCASSERT(comboBoxTemplates != nullptr)
|
||||||
|
InitTemplates(comboBoxTemplates);
|
||||||
|
|
||||||
|
// remove unused formats
|
||||||
|
for (int i = static_cast<int>(PaperSizeTemplate::Roll24in); i <= static_cast<int>(PaperSizeTemplate::Custom); ++i)
|
||||||
|
{
|
||||||
|
if (keepCustom && i == static_cast<int>(PaperSizeTemplate::Custom))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
comboBoxTemplates->removeItem(comboBoxTemplates->findData(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractLayoutDialog::GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF
|
auto VAbstractLayoutDialog::GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,6 +62,7 @@ public:
|
||||||
static auto GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF;
|
static auto GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF;
|
||||||
|
|
||||||
static void InitTemplates(QComboBox *comboBoxTemplates);
|
static void InitTemplates(QComboBox *comboBoxTemplates);
|
||||||
|
static void InitTileTemplates(QComboBox *comboBoxTemplates, bool keepCustom = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef QStringList FormatsVector;
|
typedef QStringList FormatsVector;
|
||||||
|
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 2.0 KiB |
|
@ -102,5 +102,8 @@
|
||||||
<file alias="16x16/actions/view-refresh.png">icons/win.icon.theme/16x16/actions/view-refresh.png</file>
|
<file alias="16x16/actions/view-refresh.png">icons/win.icon.theme/16x16/actions/view-refresh.png</file>
|
||||||
<file alias="24x24/actions/view-refresh.png">icons/win.icon.theme/24x24/actions/view-refresh.png</file>
|
<file alias="24x24/actions/view-refresh.png">icons/win.icon.theme/24x24/actions/view-refresh.png</file>
|
||||||
<file alias="32x32/actions/view-refresh.png">icons/win.icon.theme/32x32/actions/view-refresh.png</file>
|
<file alias="32x32/actions/view-refresh.png">icons/win.icon.theme/32x32/actions/view-refresh.png</file>
|
||||||
|
<file alias="16x16/actions/object-rotate-right.png">icons/win.icon.theme/16x16/actions/object-rotate-right.png</file>
|
||||||
|
<file alias="24x24/actions/object-rotate-right.png">icons/win.icon.theme/24x24/actions/object-rotate-right.png</file>
|
||||||
|
<file alias="32x32/actions/object-rotate-right.png">icons/win.icon.theme/32x32/actions/object-rotate-right.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|