[haiku-commits] r38796 - haiku/trunk/src/libs/alm

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 23 Sep 2010 10:05:45 +0200 (CEST)

Author: czeidler
Date: 2010-09-23 10:05:45 +0200 (Thu, 23 Sep 2010)
New Revision: 38796
Changeset: http://dev.haiku-os.org/changeset/38796

Modified:
   haiku/trunk/src/libs/alm/Area.cpp
Log:
Add the possibility to unset the aspect ratio again.



Modified: haiku/trunk/src/libs/alm/Area.cpp
===================================================================
--- haiku/trunk/src/libs/alm/Area.cpp   2010-09-23 07:57:40 UTC (rev 38795)
+++ haiku/trunk/src/libs/alm/Area.cpp   2010-09-23 08:05:45 UTC (rev 38796)
@@ -263,7 +263,11 @@
 Area::SetContentAspectRatio(double ratio)
 {
        fContentAspectRatio = ratio;
-       if (fContentAspectRatioC == NULL) {
+       if (fContentAspectRatio <= 0) {
+               delete fContentAspectRatioC;
+               fContentAspectRatioC = NULL;
+       }
+       else if (fContentAspectRatioC == NULL) {
                fContentAspectRatioC = fLS->AddConstraint(-1.0, fLeft, 1.0, 
fRight,
                        ratio, fTop, -ratio, fBottom, OperatorType(EQ), 0.0);
                fConstraints.AddItem(fContentAspectRatioC);
@@ -491,7 +495,7 @@
        fPreferredContentWidth(NULL),
        fPreferredContentHeight(NULL),
 
-       fContentAspectRatio(0),
+       fContentAspectRatio(-1),
        fContentAspectRatioC(NULL)
 {
 


Other related posts: