Summary: | When several printing images in a row, "Keep Ratio" keeps ratio of first image | ||
---|---|---|---|
Product: | [Applications] gwenview | Reporter: | Niels Ganser <kde.bugs> |
Component: | general | Assignee: | Gwenview Bugs <gwenview-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Debian testing | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Niels Ganser
2005-08-28 11:36:00 UTC
This option is in the printing dialog tab plugged in by gwenview. The option is operated from that app, not from kprinter. OK. Can somebody please move the report then? Or do I have to create a new one and mark this as resolved? > 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.
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 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>&Scale to:</string> </property> <property name="buttonGroupId"> - <number>2</number> + <number>3</number> </property> </widget> <widget class="QLayoutWidget"> |