Bug 111641 - When several printing images in a row, "Keep Ratio" keeps ratio of first image
Summary: When several printing images in a row, "Keep Ratio" keeps ratio of first image
Status: RESOLVED FIXED
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-28 11:36 UTC by Niels Ganser
Modified: 2012-10-19 13:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niels Ganser 2005-08-28 11:36:00 UTC
Version:            (using KDE KDE 3.4.2)
Installed from:    Debian testing/unstable Packages
OS:                Linux

When printing several images out of gwenview and trying to keep the ratio (checking the "Keep ratio" checkbox on kdeprint-dialog -> image settings -> scale to) only the ratio of the first image is kept. In order not to "distort" the other images you always have to uncheck and check the keep ratio checkbox again. Can be quite annoying after a while :)
Comment 1 Cristian Tibirna 2005-08-28 19:39:29 UTC
This option is in the printing dialog tab plugged in by gwenview. The option is operated from that app, not from kprinter.
Comment 2 Niels Ganser 2005-08-28 23:56:46 UTC
OK. Can somebody please move the report then? Or do I have to create a new one and mark this as resolved?
Comment 3 Angelo Naselli 2005-08-29 09:32:56 UTC
> OK. Can somebody please move the report then?

Why do you want to move it? The "Keep ratio" checkbox is added by
gwenview. I think it can be a gwenview problem, at least if you don't mean
you're using kipi-plugins to print out your photos.
Comment 4 Angelo Naselli 2005-08-29 23:14:00 UTC
Can the reporter please tell what it's wrong? It prints wrongly?
I cannot understand, the ratio seems to be ok here.

Every time you select a new picture, you have to check the scale box.
If you uncheck-and-check the keep-ratio the choice i made is to fix 
the print-out area as about 15x10 cm. Well I fixed 15 cm the one 
between weight and height is bigger and the latter is calculate
maintaining ratio.
The value you see as soon as you check scale is different because it
does not start as 15 cm.

To argue this try to use your workaround and after that put one of 
the old height value on its entry and you should find the old weight.
(at least +-1 it depend on the round).

Angelo 
Comment 5 Angelo Naselli 2006-12-31 17:21:22 UTC
SVN commit 618214 by anaselli:

gwenview now prints a picture at a time, if more than one are selected only the last one is printed.

BUG: 111641
CCMAIL: gwenview-general@lists.sourceforge.net

 M  +3 -3      document.cpp  
 M  +17 -10    printdialog.cpp  
 M  +6 -0      printdialog.h  
 M  +3 -3      printdialogpagebase.ui  


--- trunk/extragear/graphics/gwenview/gvcore/document.cpp #618213:618214
@@ -388,13 +388,13 @@
 	int scaling = printer->option( "app-gwenview-scale" ).toInt();
 
 	QSize size = image.size();
-	if (scaling==1 /* Fit to page */) {
+	if (scaling==GV_FITTOPAGE /* Fit to page */) {
 		bool enlargeToFit = printer->option( "app-gwenview-enlargeToFit" ) != f;
 		if ((image.width() > pdWidth || image.height() > pdHeight) || enlargeToFit) {
 			size.scale( pdWidth, pdHeight, QSize::ScaleMin );
 		}
 	} else {
-		if (scaling==2 /* Scale To */) {
+		if (scaling==GV_SCALE /* Scale To */) {
 			int unit = (printer->option("app-gwenview-scaleUnit").isEmpty() ?
 				GV_INCHES : printer->option("app-gwenview-scaleUnit").toInt());
 			double inches = 1;
@@ -410,7 +410,7 @@
 			size.setWidth( int(wImg * printer->resolution()) );
 			size.setHeight( int(hImg * printer->resolution()) );
 		} else {
-			/* No scaling */
+			/* GV_NOSCALE: no scaling */
 			size = image.size();
 		}
 
--- trunk/extragear/graphics/gwenview/gvcore/printdialog.cpp #618213:618214
@@ -37,6 +37,7 @@
 #include "document.h"
 #include "printdialogpagebase.h"
 #include "printdialog.moc"
+
 namespace Gwenview {
 
 
@@ -99,9 +100,9 @@
 	opts["app-gwenview-printFilename"] = mContent->mAddFileName->isChecked() ? STR_TRUE : STR_FALSE;
 	opts["app-gwenview-printComment"] = mContent->mAddComment->isChecked() ? STR_TRUE : STR_FALSE;
 	opts["app-gwenview-scale"] = QString::number(
-		mContent->mNoScale->isChecked() ? 0
-		: mContent->mFitToPage->isChecked() ? 1
-		: 2);
+		mContent->mNoScale->isChecked() ? GV_NOSCALE
+		: mContent->mFitToPage->isChecked() ? GV_FITTOPAGE
+		: GV_SCALE);
 	opts["app-gwenview-fitToPage"] = mContent->mFitToPage->isChecked() ? STR_TRUE : STR_FALSE;
 	opts["app-gwenview-enlargeToFit"] = mContent->mEnlargeToFit->isChecked() ? STR_TRUE : STR_FALSE;
 
@@ -125,13 +126,14 @@
 
 	mContent->mAddFileName->setChecked( opts["app-gwenview-printFilename"] == STR_TRUE );
 	mContent->mAddComment->setChecked( opts["app-gwenview-printComment"] == STR_TRUE );
-	
-	val = opts["app-gwenview-scale"].toInt( &ok );
-	if (ok) {
-		mContent->mScaleGroup->setButton( val );
-	} else {
-		mContent->mScaleGroup->setButton( 0 );
-	}
+	// Starts from id 1 because 0 is returned if not ok, and seems to have a weird
+	// problem with id 2 (last id) otherwise :(
+	ScaleId scaleButtonId = static_cast<ScaleId>( opts["app-gwenview-scale"].toInt( &ok ) );
+ 	if (ok) {
+		mContent->mScaleGroup->setButton( scaleButtonId );
+ 	} else {
+ 		mContent->mScaleGroup->setButton( GV_NOSCALE );
+ 	}
 	mContent->mEnlargeToFit->setChecked( opts["app-gwenview-enlargeToFit"] == STR_TRUE );
 
 	Unit unit = static_cast<Unit>( opts["app-gwenview-scaleUnit"].toInt( &ok ) );
@@ -250,12 +252,17 @@
 
 void PrintDialogPage::toggleRatio(bool enable) {
 	if (!enable) return;
+	// choosing a startup value of 15x10 cm (common photo dimention)
+	// mContent->mHeight->value() or mContent->mWidth->value()
+	// are usually empty at startup and hxw (0x0) isn't good IMO keeping ratio
 	double hValue, wValue;
 	if (mDocument->height() > mDocument->width()) {
 		hValue = mContent->mHeight->value();
+		if (!hValue) hValue = 150*unitToMM(mPreviousUnit);
 		wValue = (mDocument->width() * hValue)/ mDocument->height();
 	} else {
 		wValue = mContent->mWidth->value();
+		if (!wValue) wValue = 150*unitToMM(mPreviousUnit);
 		hValue = (mDocument->height() * wValue)/ mDocument->width();
 	}
 	
--- trunk/extragear/graphics/gwenview/gvcore/printdialog.h #618213:618214
@@ -40,6 +40,12 @@
 	GV_INCHES
 };
 
+enum ScaleId {
+	GV_NOSCALE=1,
+	GV_FITTOPAGE,
+	GV_SCALE
+};
+
 class LIBGWENVIEW_EXPORT PrintDialogPage : public KPrintDialogPage {
 	Q_OBJECT
 
--- trunk/extragear/graphics/gwenview/gvcore/printdialogpagebase.ui #618213:618214
@@ -151,7 +151,7 @@
                         <bool>true</bool>
                     </property>
                     <property name="buttonGroupId">
-                        <number>0</number>
+                        <number>1</number>
                     </property>
                 </widget>
                 <widget class="QRadioButton">
@@ -165,7 +165,7 @@
                         <bool>false</bool>
                     </property>
                     <property name="buttonGroupId">
-                        <number>1</number>
+                        <number>2</number>
                     </property>
                 </widget>
                 <widget class="QLayoutWidget">
@@ -231,7 +231,7 @@
                         <string>&amp;Scale to:</string>
                     </property>
                     <property name="buttonGroupId">
-                        <number>2</number>
+                        <number>3</number>
                     </property>
                 </widget>
                 <widget class="QLayoutWidget">