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

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 27 Apr 2011 07:11:21 +0200 (CEST)

Author: czeidler
Date: 2011-04-27 07:11:21 +0200 (Wed, 27 Apr 2011)
New Revision: 41284
Changeset: https://dev.haiku-os.org/changeset/41284

Modified:
   haiku/trunk/src/libs/alm/Area.cpp
   haiku/trunk/src/libs/alm/RowColumnManager.cpp
Log:
Fix a bug in RowColumnManager when adding / removing views to / from a layout.



Modified: haiku/trunk/src/libs/alm/Area.cpp
===================================================================
--- haiku/trunk/src/libs/alm/Area.cpp   2011-04-26 18:14:54 UTC (rev 41283)
+++ haiku/trunk/src/libs/alm/Area.cpp   2011-04-27 05:11:21 UTC (rev 41284)
@@ -173,8 +173,6 @@
 {
        fLeft = left;
 
-       fColumn = NULL;
-
        fMinContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
        if (fMaxContentWidth != NULL)
                fMaxContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
@@ -194,8 +192,6 @@
 {
        fRight = right;
 
-       fColumn = NULL;
-
        fMinContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
        if (fMaxContentWidth != NULL)
                fMaxContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
@@ -213,8 +209,6 @@
 {
        fTop = top;
 
-       fRow = NULL;
-
        fMinContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
        if (fMaxContentHeight != NULL)
                fMaxContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
@@ -232,8 +226,6 @@
 {
        fBottom = bottom;
 
-       fRow = NULL;
-
        fMinContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
        if (fMaxContentHeight != NULL)
                fMaxContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);

Modified: haiku/trunk/src/libs/alm/RowColumnManager.cpp
===================================================================
--- haiku/trunk/src/libs/alm/RowColumnManager.cpp       2011-04-26 18:14:54 UTC 
(rev 41283)
+++ haiku/trunk/src/libs/alm/RowColumnManager.cpp       2011-04-27 05:11:21 UTC 
(rev 41284)
@@ -33,7 +33,7 @@
                delete fColumns.ItemAt(i)->fPrefSizeConstraint;
 }
 
-                                                               
+                                       
 void
 RowColumnManager::AddArea(Area* area)
 {
@@ -41,16 +41,16 @@
        if (row == NULL) {
                row = new Row(fLinearSpec, area->Top(), area->Bottom());
                fRows.AddItem(row);
-               area->fRow = row;
        }
+       area->fRow = row;
        row->fAreas.AddItem(area);
 
        Column* column = _FindColumnFor(area);
        if (column == NULL) {
                column = new Column(fLinearSpec, area->Left(), area->Right());
                fColumns.AddItem(column);
-               area->fColumn = column;
        }
+       area->fColumn = column;
        column->fAreas.AddItem(area);
 
        _UpdateConstraints(row);
@@ -61,24 +61,26 @@
 void
 RowColumnManager::RemoveArea(Area* area)
 {
-       Row* row = _FindRowFor(area);
+       Row* row = area->fRow;
        if (row) {
                row->fAreas.RemoveItem(area);
+               area->fRow = NULL;
                if (row->fAreas.CountItems() == 0) {
                        fRows.RemoveItem(row);
                        delete row;
-               } else
-                       _UpdateConstraints(row);
+               }
+               _UpdateConstraints(row);
        }
 
-       Column* column = _FindColumnFor(area);
+       Column* column = area->fColumn;
        if (column) {
                column->fAreas.RemoveItem(area);
+               area->fColumn = NULL;
                if (column->fAreas.CountItems() == 0) {
                        fColumns.RemoveItem(column);
                        delete column;
-               } else
-                       _UpdateConstraints(column);
+               }
+               _UpdateConstraints(column);
        }
 }
 


Other related posts:

  • » [haiku-commits] r41284 - haiku/trunk/src/libs/alm - clemens . zeidler