From 3911a92a63e61294f984db6982997e6724b1cfd0 Mon Sep 17 00:00:00 2001 From: Ale Rimoldi Date: Thu, 29 Oct 2015 00:55:18 +0100 Subject: [PATCH] apply the patch by dawoodalbadi --- scribus/ui/propertiespalette_image.cpp | 57 ++++++++++ scribus/ui/propertiespalette_image.h | 2 + scribus/ui/propertiespalette_imagebase.ui | 131 +++++++++++++++++----- 3 files changed, 165 insertions(+), 25 deletions(-) diff --git a/scribus/ui/propertiespalette_image.cpp b/scribus/ui/propertiespalette_image.cpp index b0ae4ea434..5ee684c6ad 100644 --- a/scribus/ui/propertiespalette_image.cpp +++ b/scribus/ui/propertiespalette_image.cpp @@ -110,6 +110,8 @@ PropertiesPalette_Image::PropertiesPalette_Image( QWidget* parent) : QWidget(par connect(renderIntent , SIGNAL(activated(int)) , this, SLOT(handleIntent())); connect(compressionMethod , SIGNAL(activated(int)) , this, SLOT(handleCompressionMethod())); connect(compressionQuality , SIGNAL(activated(int)) , this, SLOT(handleCompressionQuality())); + connect(alignvertical , SIGNAL(currentIndexChanged(int)) , this, SLOT(alignImageVertical(int))); + connect(alignhorozintal , SIGNAL(currentIndexChanged(int)), this, SLOT(alignImageHorozintal(int))); } void PropertiesPalette_Image::updateSpinBoxConstants() @@ -902,4 +904,59 @@ void PropertiesPalette_Image::spinboxFinishUserAction() } } +void PropertiesPalette_Image::alignImageVertical(int idx){ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + if ((m_haveDoc) && (m_haveItem) && (m_item->asImageFrame())) + { + double newY; + double imageHeight = m_item->pixm.height() * m_item->imageYScale() * m_item->pixm.imgInfo.lowResScale; + double frameHeight= m_item->height(); + + switch (idx) + { + case 1: + newY = 0; + break; + case 2: + newY = (frameHeight - imageHeight) / 2.0; + break; + case 3: + newY = frameHeight - imageHeight; + break; + default: + newY = m_item->imageYOffset(); //do nothing + break; + } + m_doc->itemSelection_SetImageOffset(m_item->imageXOffset(), newY / m_item->imageYScale()); + } +} + +void PropertiesPalette_Image::alignImageHorozintal(int idx) { + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + + if ((m_haveDoc) && (m_haveItem) && (m_item->asImageFrame())) + { + double newX; + double imageWidth = m_item->pixm.width() * m_item->imageXScale() * m_item->pixm.imgInfo.lowResScale; + double frameWidth = m_item->width(); + switch (idx) + { + case 1: + newX = 0; + break; + case 2: + newX = (frameWidth - imageWidth) / 2.0; + break; + case 3: + newX = frameWidth - imageWidth; + break; + default: + newX = m_item->imageXOffset(); // do nothing + break; + } + m_doc->itemSelection_SetImageOffset(newX / m_item->imageXScale(), m_item->imageYOffset()); + } +} diff --git a/scribus/ui/propertiespalette_image.h b/scribus/ui/propertiespalette_image.h index fb4e46baa2..d4fdb12d53 100644 --- a/scribus/ui/propertiespalette_image.h +++ b/scribus/ui/propertiespalette_image.h @@ -103,6 +103,8 @@ private slots: void handleImageEffects(); void handleExtImgProperties(); + void alignImageVertical(int); + void alignImageHorozintal(int); signals: void UpdtGui(int); diff --git a/scribus/ui/propertiespalette_imagebase.ui b/scribus/ui/propertiespalette_imagebase.ui index cfb44ca751..eb03f92aa7 100644 --- a/scribus/ui/propertiespalette_imagebase.ui +++ b/scribus/ui/propertiespalette_imagebase.ui @@ -6,8 +6,8 @@ 0 0 - 286 - 617 + 297 + 690 @@ -17,7 +17,16 @@ 2 - + + 2 + + + 2 + + + 2 + + 2 @@ -63,13 +72,6 @@ - - - - Y-Pos: - - - @@ -80,6 +82,13 @@ + + + + Y-Pos: + + + @@ -89,6 +98,77 @@ + + + + Alignment + + + + + + Horizontal + + + + + + + Vertical + + + + + + + + None + + + + + Left + + + + + Center + + + + + Right + + + + + + + + + None + + + + + Top + + + + + Middle + + + + + Bottom + + + + + + + @@ -200,17 +280,17 @@ - - + + - Proportional + To Frame Size - - + + - To Frame Size + Proportional @@ -223,13 +303,6 @@ Color Management - - - - Input Profile - - - @@ -250,6 +323,13 @@ + + + + Input Profile + + + @@ -326,6 +406,9 @@ + + + @@ -365,8 +448,6 @@ imgDpiY keepImageWHRatioButton keepImageDPIRatioButton - frameScale - cbProportional inputProfiles renderIntent compressionMethod