[haiku-commits] haiku: hrev44092 - src/libs/alm src/libs/linprog headers/libs/alm src/tests/libs/alm

  • From: yourpalal2@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 2 May 2012 23:00:55 +0200 (CEST)

hrev44092 adds 72 changesets to branch 'master'
old head: ab0d7676f84bd5127738935c49028966c29f5be5
new head: 6457a6517eaa53baeb531ce9995617c3caa7010e

----------------------------------------------------------------------------

b7630c4: Save and restore layout.

                                     [ czeidler <haiku@xxxxxxxxxxxxxxxxxx> ]

c3e57dc: Give the area an id.

                                     [ czeidler <haiku@xxxxxxxxxxxxxxxxxx> ]

fefa17f: Remove unused 'PerformancePath' stuff.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

1be46cf: In ALM Views test, use explicit AddViews() method.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

75e2dcf: In BALMLayout, allow for more flexibility in spacing and insets.
  
  * allow for independent left, top, right and bottom insets
  * allow for independent vertical and horizontal spacing between tabs
  * allow for the usage of Haiku's spacing constants such as B_USE_WINDOW_INSETS

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

9b0221f: In alm tests, replace calls to SetInset() with SetInsets().

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

574533e: In BALMLayout, make AddView(...) consistent with other layouts.
  
  If a BView is added which has a BLayout, use the layout as a BLayoutItem
  to represent that view, as other layouts do.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

8b52747: In Area, remove unused ItemFrame() method.
  
  Also modify Frame() method to return a rect with rounded coordinates.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

b50d4ed: Add new methods to BALMLayout for adding multiple x/y tabs at once.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

50cc24b: Add a Builder for BALMLayout.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

2bf5ded: Add BALMLayoutBuilder implementations to ALM tests.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

d814593: Remove BALMLayout::Add*To* methods, which are availabe in the builder.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

b99cf18: Remove old implementatoins of ALM tests that used the Add*To* methods.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

7dd1720: Make Area insets more consistent with other HAIKU inset APIs.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

ddb6512: In alm test TableDemo: include Row.h and Column.h directly.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

a25ffa4: Style cleanup in alm: mostly clean includes.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

0da6f2e: Rename BALM::GroupItem to BALM::ALMGroup, and move it to its own files.
  
  Also make ALMGroup totally self-contained, i.e. BALMLayout no longer
  does the parsing, and is completely unaware of ALMGroup. A small touch
  of refactoring as well.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

7e021d4: Make BALM::InsetForTab() methods const.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

324ce28: Add FBC padding to ALM classes.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

f0307e7: Fix spacing before first header in src/libs/alm.
  
  Also add copyright header in ALMGroup.cpp.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

895414d: In BALM::Area rename fTopLeftInset to fLeftTopInset.
  
  This is consistent with for instance, the BSize ctor.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

20cc993: Remove BALM::Area::fConstraints field, which is not needed.
  
  It's easier to just delete all the constraints in the dtor, the ones that
  wouldn't have been in fConstraints are NULL at this point anyway.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

de245ca: Adjust IMAP addon for changes in BALMLayout.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

548c302: Adjust MusicCollection app for changes in BALMLayout.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

3479e51: Compose spacing given to BALMLayout constructor.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

57d93f8: Disable debug output by default in linprog.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

2bbf8b1: Add the ability to handle bad layouts to BALMLayout.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

03adc8c: Add test for BALMLayout's bad layout handling.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

51b5b66: Remove lp_solve as a dependency of the linprog lib.
  
  Really, it hasn't depended on lp_solve for a while, but it was still
  linked in in some places.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

f6db102: Make BALMLayout respect its position when nested.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

1c8104a: Add a test for nested BALMLayouts.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

7c38000: Make LinearProgramming::LinearSpec BReferenceable.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

f9cabdd: Use BReferenceable properties of LinearSpec in BALMLayout.
  
  This saves us from a potential use-afte-free bug.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

c761a8a: Let BALM::{X|Y}Tabs be in multiple BALMLayouts, if they are friendly.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

c640be1: Add a test for ALM's 'friend' behaviour.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

9397727: When adding tabs to a BALMLayout, ensure they are fully added.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

a9761ae: Refactor BALMLayout::AddItem to reduce repitition.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

708a298: Refactor XTab and YTab to share a common base, TabBase.
  
  TabBase takes care of layout tracking etc..

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

419fe0b: Introduce SharedSolver class to improve BALMLayout's friend feature.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

82a0965: Improve efficiency when validating an ALM layout.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

93904ad: Have SharedSolver return the solver result from Validate*() methods.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

09e87fa: Pass more information to BadLayoutPolicy.
  
  Also, re-add BadLayoutPolicy invocations, which were lost while creating
  SharedSolver.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

ac84362: Update BadLayout test to sync with OnBadLayout changes.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

3ade12d: Make BALMLayout::BasePreferredSize() useful again.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

1cbe951: Refactor SharedSolver::Validate*() methods a bit more.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

a9242e3: Properly handle unbounded results in SharedSolver::Validate{Min|Max}()

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

fbd2dfc: Refactor ActiveSetSolver::Find{Min|Max}s().

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

af6ddb0: Improve FriendLayout test to test invalidations as well.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

6169a6e: Minimize the effect invisible items have on a BALMLayout.
  
  There seems to still be some effect on positioning, but invisible items
  no longer constrain the layout.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

681f48f: Replace BALMLayout::Ordered*Tabs() method with *TabAt(int, bool 
sorted).

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

0bd511a: Avoid use after free in RowColumnManager.cpp
  
  Fixes CID 10862

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

35babcf: Allow left and top tab to be NULL.

                                     [ czeidler <haiku@xxxxxxxxxxxxxxxxxx> ]

c4340ea: Fix row column weight.

                                     [ czeidler <haiku@xxxxxxxxxxxxxxxxxx> ]

4878cc7: Don't remove ourselves from a BLayoutContext when it is leaving.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

15ef732: Check first if we own the constraint before deleting it.

                                     [ czeidler <haiku@xxxxxxxxxxxxxxxxxx> ]

d7568ea: Add IndexOf methods.

                                    [ czeidler <czei002@xxxxxxxxxxxxxxxxx> ]

bc7956c: Use const overloading on BALMLayout::{X|Y}TabAt().

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

0a408e4: Make it possible to have a Variable not belonging to any LinearSpec.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

4ca2a44: Make ownership-taking idempotent during unarchiving.
  
  The previous scheme made it hard to deal with reference-counted objects,
  which may be owned by many objects.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

f9c5874: Fix possible NULL dereference in TabBase::IsInLayout().

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

35bf0b5: Add initial support for archiving a BALMLayout.
  
  What's supported:
  * basic archive/instantiate
  * friend layouts
  coming soon:
  * saving of custom restraints
  * archiving of BadLayoutPolicy

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

015e5f0: Make BALMLayout::BadLayoutPolicy archivable.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

bad1d6b: Make Variable::SetRange() more forgiving.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

0a5e130: Make SharedSolver BArchivable to save extra user constraints.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

df2ad52: Archive more details about areas in BALMLayout.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

4199a81: Add archiving to ALMHelloWorld test.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

bf0b62a: Add archiving to ALMFriendLayout test.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

d10cb21: in BALMLayout::DefaultPolicy, call printf instead of debugger.
  
  This is more user friendly, debugger() was a bit drastic.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

5f4e71b: Replace BALMLayoutBuilder::Snake class with a stack.
  
  The interface to BALMLayoutBuilder is still pretty much the same, but
  this simplifies the class a bit.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

c8b24e3: Fix BALMLayout archiving issues.
  
  SharedSolver was archiving too many constraints, partly because of
  multiple typos, also because it archived some which were just artifacts
  of the layout process. These extra constraints are created when the
  layout calls SetRange() on the left/top/right/bottom tabs during layout.
  
  * LinearSpec/ActiveSetSolver had to be adjusted to get access to the
    constraints added by the SetRange() calls.
  * BALM::TabBase was adjusted to avoid a segfault during unarchiving,
    caused by an unitialized member.
  * ALMFriendLayoutTest was adjusted to include a more obvious custom
    constraint for testing.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

45f28e0: Fix error in height calculation in alm/SharedSolver.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

6457a65: Fix bug from the removal of BALMLayoutBuilder::Snake.
  
  GCC considers the method chain one big function call, so pushes all
  parameters onto the stack before hand (something I discovered after
  quite a bit of debugging). In this case, layout->RightOf() returns NULL
  before the view is added, which caused the layout to become undefined.

                                      [ Alex Wilson <yourpalal2@xxxxxxxxx> ]

----------------------------------------------------------------------------

42 files changed, 3390 insertions(+), 1349 deletions(-)
headers/libs/alm/ALMGroup.h                        |   74 +
headers/libs/alm/ALMLayout.h                       |  190 ++-
headers/libs/alm/ALMLayoutBuilder.h                |  102 ++
headers/libs/alm/Area.h                            |  108 +-
headers/libs/alm/Column.h                          |   37 +-
headers/libs/alm/Row.h                             |   37 +-
headers/libs/alm/Tab.h                             |   42 +-
headers/libs/linprog/LinearSpec.h                  |   16 +-
.../inbound_protocols/imap/IMAPFolderConfig.cpp    |   23 +-
src/apps/musiccollection/Jamfile                   |    2 +-
src/apps/musiccollection/MusicCollectionWindow.cpp |   23 +-
src/kits/support/ArchivingManagers.cpp             |   10 +-
src/libs/alm/ALMGroup.cpp                          |  147 ++
src/libs/alm/ALMLayout.cpp                         | 1225 +++++++++++-----
src/libs/alm/ALMLayoutBuilder.cpp                  |  324 ++++
src/libs/alm/Area.cpp                              |  279 ++--
src/libs/alm/Column.cpp                            |    3 +-
src/libs/alm/Jamfile                               |    5 +-
src/libs/alm/Row.cpp                               |    5 +-
src/libs/alm/RowColumnManager.cpp                  |   30 +-
src/libs/alm/RowColumnManager.h                    |   25 +-
src/libs/alm/SharedSolver.cpp                      |  518 +++++++
src/libs/alm/SharedSolver.h                        |  121 ++
src/libs/alm/Tab.cpp                               |  153 +-
src/libs/linprog/ActiveSetSolver.cpp               |   84 +-
src/libs/linprog/ActiveSetSolver.h                 |   14 +-
src/libs/linprog/Jamfile                           |    1 -
src/libs/linprog/LPSolveInterface.cpp              |  481 ------
src/libs/linprog/LPSolveInterface.h                |   67 -
src/libs/linprog/LinearSpec.cpp                    |   37 +-
src/libs/linprog/Variable.cpp                      |    9 +-
src/tests/libs/alm/BadLayout.cpp                   |   97 ++
src/tests/libs/alm/ComplexButtons.cpp              |   23 +-
src/tests/libs/alm/FriendLayout.cpp                |  173 +++
src/tests/libs/alm/HelloWorld.cpp                  |   41 +-
src/tests/libs/alm/Jamfile                         |   22 +-
src/tests/libs/alm/NestedLayout.cpp                |   70 +
src/tests/libs/alm/OperatorLayout.cpp              |   12 +-
src/tests/libs/alm/Pinwheel.cpp                    |   38 +-
src/tests/libs/alm/TableDemo.cpp                   |    3 +
src/tests/libs/alm/ThreeButtons.cpp                |   15 +-
src/tests/libs/alm/Views.cpp                       |   53 +-

############################################################################

Commit:      b7630c4c985e7b351678608448aa1d61ec7ff6b5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b7630c4
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Tue Jan 10 04:43:58 2012 UTC
Committer:   Alex Wilson <yourpalal2@xxxxxxxxx>
Commit-Date: Wed May  2 20:44:11 2012 UTC

Save and restore layout.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index c542e36..e76ab14 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -67,6 +67,7 @@ public:
 
                        Area*                           AreaFor(const BView* 
view) const;
                        Area*                           AreaFor(const 
BLayoutItem* item) const;
+                       int32                           CountAreas() const;
                        Area*                           AreaAt(int32 index) 
const;
                        Area*                           CurrentArea() const;
                        bool                            SetCurrentArea(const 
Area* area);
@@ -122,6 +123,9 @@ public:
                                                                        YTab* 
bottom = NULL, XTab* left = NULL,
                                                                        XTab* 
right = NULL);
 
+                       bool                            SaveLayout(BMessage* 
archive) const;
+                       bool                            RestoreLayout(const 
BMessage* archive);
+
        virtual BSize                           BaseMinSize();
        virtual BSize                           BaseMaxSize();
        virtual BSize                           BasePreferredSize();
diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp
index cf08519..dd569e2 100644
--- a/src/libs/alm/ALMLayout.cpp
+++ b/src/libs/alm/ALMLayout.cpp
@@ -11,6 +11,7 @@
 #include <math.h>              // for floor
 #include <new>
 #include <iostream>
+#include <vector>
 
 #include "RowColumnManager.h"
 #include "ViewLayoutItem.h"
@@ -129,8 +130,8 @@ BALMLayout::YTabAt(int32 index) const
 }
 
 
-int
-CompareXTabFunc(const XTab* tab1, const XTab* tab2)
+static int
+compare_x_tab_func(const XTab* tab1, const XTab* tab2)
 {
        if (tab1->Value() < tab2->Value())
                return -1;
@@ -140,8 +141,8 @@ CompareXTabFunc(const XTab* tab1, const XTab* tab2)
 }
 
 
-int
-CompareYTabFunc(const YTab* tab1, const YTab* tab2)
+static int
+compare_y_tab_func(const YTab* tab1, const YTab* tab2)
 {
        if (tab1->Value() < tab2->Value())
                return -1;
@@ -151,11 +152,10 @@ CompareYTabFunc(const YTab* tab1, const YTab* tab2)
 }
 
 
-
 const XTabList&
 BALMLayout::OrderedXTabs()
 {
-       fXTabList.SortItems(CompareXTabFunc);
+       fXTabList.SortItems(compare_x_tab_func);
        return fXTabList;
 }
 
@@ -163,7 +163,7 @@ BALMLayout::OrderedXTabs()
 const YTabList&
 BALMLayout::OrderedYTabs()
 {
-       fYTabList.SortItems(CompareYTabFunc);
+       fYTabList.SortItems(compare_y_tab_func);
        return fYTabList;
 }
 
@@ -230,6 +230,13 @@ BALMLayout::AreaFor(const BLayoutItem* item) const
 }
 
 
+int32
+BALMLayout::CountAreas() const
+{
+       return CountItems();
+}
+
+
 Area*
 BALMLayout::AreaAt(int32 index) const
 {
@@ -670,6 +677,134 @@ BALMLayout::AddItemToBottom(BLayoutItem* item, YTab* 
_bottom, XTab* left,
 }
 
 
+enum {
+       kLeftBorderIndex = -2,
+       kTopBorderIndex = -3,
+       kRightBorderIndex = -4,
+       kBottomBorderIndex = -5,
+};
+
+
+bool
+BALMLayout::SaveLayout(BMessage* archive) const
+{
+       archive->MakeEmpty();
+
+       archive->AddInt32("nXTabs", CountXTabs());
+       archive->AddInt32("nYTabs", CountYTabs());
+
+       XTabList xTabs = fXTabList;
+       xTabs.RemoveItem(fLeft);
+       xTabs.RemoveItem(fRight);
+       YTabList yTabs = fYTabList;
+       yTabs.RemoveItem(fTop);
+       yTabs.RemoveItem(fBottom);
+       
+       int32 nAreas = CountAreas();
+       for (int32 i = 0; i < nAreas; i++) {
+               Area* area = AreaAt(i);
+               if (area->Left() == fLeft)
+                       archive->AddInt32("left", kLeftBorderIndex);
+               else
+                       archive->AddInt32("left", xTabs.IndexOf(area->Left()));
+               if (area->Top() == fTop)
+                       archive->AddInt32("top", kTopBorderIndex);
+               else
+                       archive->AddInt32("top", yTabs.IndexOf(area->Top()));
+               if (area->Right() == fRight)
+                       archive->AddInt32("right", kRightBorderIndex);
+               else
+                       archive->AddInt32("right", 
xTabs.IndexOf(area->Right()));
+               if (area->Bottom() == fBottom)
+                       archive->AddInt32("bottom", kBottomBorderIndex);
+               else
+                       archive->AddInt32("bottom", 
yTabs.IndexOf(area->Bottom()));
+       }
+       return true;
+}
+
+
+bool
+BALMLayout::RestoreLayout(const BMessage* archive)
+{
+       int32 neededXTabs;
+       int32 neededYTabs;
+       if (archive->FindInt32("nXTabs", &neededXTabs) != B_OK)
+               return false;
+       if (archive->FindInt32("nYTabs", &neededYTabs) != B_OK)
+               return false;
+       // First store a reference to all needed tabs otherwise they might get 
lost
+       // while editing the layout
+       std::vector<BReference<XTab> > newXTabs;
+       std::vector<BReference<YTab> > newYTabs;
+       int32 existingXTabs = fXTabList.CountItems();
+       for (int32 i = 0; i < neededXTabs; i++) {
+               if (i < existingXTabs)
+                       
newXTabs.push_back(BReference<XTab>(fXTabList.ItemAt(i)));
+               else
+                       newXTabs.push_back(AddXTab());
+       }
+       int32 existingYTabs = fYTabList.CountItems();
+       for (int32 i = 0; i < neededYTabs; i++) {
+               if (i < existingYTabs)
+                       
newYTabs.push_back(BReference<YTab>(fYTabList.ItemAt(i)));
+               else
+                       newYTabs.push_back(AddYTab());
+       }
+
+       XTabList xTabs = fXTabList;
+       xTabs.RemoveItem(fLeft);
+       xTabs.RemoveItem(fRight);
+       YTabList yTabs = fYTabList;
+       yTabs.RemoveItem(fTop);
+       yTabs.RemoveItem(fBottom);
+
+       int32 nAreas = CountAreas();
+       for (int32 i = 0; i < nAreas; i++) {
+               Area* area = AreaAt(i);
+               if (area == NULL)
+                       return false;
+               int32 left = -1;
+               if (archive->FindInt32("left", i, &left) != B_OK)
+                       break;
+               int32 top = archive->FindInt32("top", i);
+               int32 right = archive->FindInt32("right", i);
+               int32 bottom = archive->FindInt32("bottom", i);
+
+               XTab* leftTab = NULL;
+               YTab* topTab = NULL;
+               XTab* rightTab = NULL;
+               YTab* bottomTab = NULL;
+
+               if (left == kLeftBorderIndex)
+                       leftTab = fLeft;
+               else
+                       leftTab = xTabs.ItemAt(left);
+               if (top == kTopBorderIndex)
+                       topTab = fTop;
+               else
+                       topTab = yTabs.ItemAt(top);
+               if (right == kRightBorderIndex)
+                       rightTab = fRight;
+               else
+                       rightTab = xTabs.ItemAt(right);
+               if (bottom == kBottomBorderIndex)
+                       bottomTab = fBottom;
+               else
+                       bottomTab = yTabs.ItemAt(bottom);
+               if (leftTab == NULL || topTab == NULL || rightTab == NULL
+                       || bottomTab == NULL)
+                       return false;
+
+               area->SetLeft(leftTab);
+               area->SetTop(topTab);
+               area->SetRight(rightTab);
+               area->SetBottom(bottomTab);
+       }
+       return true;
+}
+
+
 /**
  * Gets the left variable.
  */

############################################################################

Commit:      c3e57dc36d5d18673ed9c49d9a3790091852fa0a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c3e57dc
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Wed Jan 11 04:19:29 2012 UTC
Committer:   Alex Wilson <yourpalal2@xxxxxxxxx>
Commit-Date: Wed May  2 20:44:13 2012 UTC

Give the area an id.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index e76ab14..540f932 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -65,6 +65,7 @@ public:
                        void                            SetSpacing(float 
spacing);
                        float                           Spacing() const;
 
+                       Area*                           AreaFor(int32 id) const;
                        Area*                           AreaFor(const BView* 
view) const;
                        Area*                           AreaFor(const 
BLayoutItem* item) const;
                        int32                           CountAreas() const;
diff --git a/headers/libs/alm/Area.h b/headers/libs/alm/Area.h
index fc49fc6..1022771 100644
--- a/headers/libs/alm/Area.h
+++ b/headers/libs/alm/Area.h
@@ -65,6 +65,9 @@ class Area {
 public:
                                                                ~Area();
 
+                       int32                           ID() const;
+                       void                            SetID(int32 id);
+
                        BLayoutItem*            Item();
 
                        XTab*                           Left() const;
@@ -121,6 +124,7 @@ private:
                        void                            
_UpdateMaxSizeConstraint(BSize max);
 private:
                        BLayoutItem*            fLayoutItem;
+                       int32                           fID;
 
                        LinearSpec*                     fLS;
 
diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp
index dd569e2..d900ced 100644
--- a/src/libs/alm/ALMLayout.cpp
+++ b/src/libs/alm/ALMLayout.cpp
@@ -208,6 +208,19 @@ BALMLayout::AddColumn(XTab* _left, XTab* _right)
 }
 
 
+Area*
+BALMLayout::AreaFor(int32 id) const
+{
+       int32 areaCount = CountAreas();
+       for (int32 i = 0; i < areaCount; i++) {
+               Area* area = AreaAt(i);
+               if (area->ID() == id)
+                       return area;
+       }
+       return NULL;
+}
+
+
 /**
  * Finds the area that contains the given control.
  *
diff --git a/src/libs/alm/Area.cpp b/src/libs/alm/Area.cpp
index a255a7d..65c0040 100644
--- a/src/libs/alm/Area.cpp
+++ b/src/libs/alm/Area.cpp
@@ -522,6 +522,15 @@ Area::~Area()
 }
 
 
+static int32 sAreaID = 0;
+
+static int32
+new_area_id()
+{
+       return sAreaID++;
+}
+
+
 /**
  * Constructor.
  * Uses XTabs and YTabs.
@@ -550,7 +559,21 @@ Area::Area(BLayoutItem* item)
        fContentAspectRatio(-1),
        fContentAspectRatioC(NULL)
 {
+       fID = new_area_id();
+}
+
 
+int32
+Area::ID() const
+{
+       return fID;
+}
+
+
+void
+Area::SetID(int32 id)
+{
+       fID = id;
 }
 
 

############################################################################

Commit:      fefa17f47eaee07bf273786495d7a7b7e9ee85b1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fefa17f
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 12 02:45:53 2012 UTC

Remove unused 'PerformancePath' stuff.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index 540f932..0de7c01 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -54,9 +54,6 @@ public:
                        YTab*                           Top() const;
                        YTab*                           Bottom() const;
 
-                       char*                           PerformancePath() const;
-                       void                            
SetPerformancePath(char* path);
-
                        LinearSpec*                     Solver() const;
 
                        void                            SetInset(float inset);
@@ -167,7 +164,6 @@ private:
                        BSize                           fMinSize;
                        BSize                           fMaxSize;
                        BSize                           fPreferredSize;
-                       char*                           fPerformancePath;
 
                        float                           fInset;
                        float                           fSpacing;
diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp
index d900ced..d571136 100644
--- a/src/libs/alm/ALMLayout.cpp
+++ b/src/libs/alm/ALMLayout.cpp
@@ -53,8 +53,6 @@ BALMLayout::BALMLayout(float spacing, BALMLayout* 
friendLayout)
        fMinSize = kUnsetSize;
        fMaxSize = kUnsetSize;
        fPreferredSize = kUnsetSize;
-
-       fPerformancePath = NULL;
 }
 
 
@@ -971,30 +969,6 @@ BALMLayout::DoLayout()
 }
 
 
-/**
- * Gets the path of the performance log file.
- *
- * @return the path of the performance log file
- */
-char*
-BALMLayout::PerformancePath() const
-{
-       return fPerformancePath;
-}
-
-
-/**
- * Sets the path of the performance log file.
- *
- * @param path the path of the performance log file
- */
-void
-BALMLayout::SetPerformancePath(char* path)
-{
-       fPerformancePath = path;
-}
-
-
 LinearSpec*
 BALMLayout::Solver() const
 {

############################################################################

Commit:      1be46cf584d9c77a8d47c3ef29a3a767a955fe84
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1be46cf
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 12 20:45:36 2012 UTC

In ALM Views test, use explicit AddViews() method.

----------------------------------------------------------------------------

diff --git a/src/tests/libs/alm/Views.cpp b/src/tests/libs/alm/Views.cpp
index 00c0ded..0463ee7 100644
--- a/src/tests/libs/alm/Views.cpp
+++ b/src/tests/libs/alm/Views.cpp
@@ -58,7 +58,7 @@ public:
                SetLayout(layout);
                layout->SetInset(10.);
 
-               layout->AddView(button1);
+               layout->AddView(button1, layout->Left(), layout->Top());
                layout->AddViewToRight(radioButton);
                layout->AddItemToRight(BSpaceLayoutItem::CreateGlue());
                Area* a3 = layout->AddViewToRight(button3);

############################################################################

Commit:      75e2dcf8fe478ac43fecff5b72049fe500c804dc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=75e2dcf
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Sun Jan 15 22:54:25 2012 UTC

In BALMLayout, allow for more flexibility in spacing and insets.

* allow for independent left, top, right and bottom insets
* allow for independent vertical and horizontal spacing between tabs
* allow for the usage of Haiku's spacing constants such as B_USE_WINDOW_INSETS

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index 0de7c01..b8931c7 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -31,7 +31,8 @@ class RowColumnManager;
  */
 class BALMLayout : public BAbstractLayout {
 public:
-                                                               
BALMLayout(float spacing = 0.0f,
+                                                               
BALMLayout(float hSpacing = 0.0f,
+                                                                       float 
vSpacing = 0.0f,
                                                                        
BALMLayout* friendLayout = NULL);
        virtual                                         ~BALMLayout();
 
@@ -56,11 +57,16 @@ public:
 
                        LinearSpec*                     Solver() const;
 
-                       void                            SetInset(float inset);
-                       float                           Inset() const;
+                       void                            SetInsets(float insets);
+                       void                            SetInsets(float x, 
float y);
+                       void                            SetInsets(float left, 
float top, float right,
+                                                                       float 
bottom);
+                       void                            GetInsets(float* left, 
float* top, float* right,
+                                                                       float* 
bottom) const;
 
-                       void                            SetSpacing(float 
spacing);
-                       float                           Spacing() const;
+                       void                            SetSpacing(float 
hSpacing, float vSpacing);
+                       void                            GetSpacing(float* 
_hSpacing,
+                                                                       float* 
_vSpacing) const;
 
                        Area*                           AreaFor(int32 id) const;
                        Area*                           AreaFor(const BView* 
view) const;
@@ -139,6 +145,10 @@ protected:
 private:
        friend class XTab;
        friend class YTab;
+       friend class Area;
+
+                       float                           InsetForTab(XTab* tab);
+                       float                           InsetForTab(YTab* tab);
 
                        /*! Add a view without initialize the Area. */
                        BLayoutItem*            _CreateLayoutItem(BView* view);
@@ -165,8 +175,13 @@ private:
                        BSize                           fMaxSize;
                        BSize                           fPreferredSize;
 
-                       float                           fInset;
-                       float                           fSpacing;
+                       float                           fLeftInset;
+                       float                           fRightInset;
+                       float                           fTopInset;
+                       float                           fBottomInset;
+
+                       float                           fHSpacing;
+                       float                           fVSpacing;
 
                        Area*                           fCurrentArea;
 
diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp
index d571136..31381dd 100644
--- a/src/libs/alm/ALMLayout.cpp
+++ b/src/libs/alm/ALMLayout.cpp
@@ -4,8 +4,6 @@
  * Copyright 2010, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx>
  * Distributed under the terms of the MIT License.
  */
-
-
 #include "ALMLayout.h"
 
 #include <math.h>              // for floor
@@ -13,6 +11,8 @@
 #include <iostream>
 #include <vector>
 
+#include <ControlLook.h>
+
 #include "RowColumnManager.h"
 #include "ViewLayoutItem.h"
 
@@ -29,10 +29,14 @@ const BSize kUnsetSize(B_SIZE_UNSET, B_SIZE_UNSET);
  *
  * If friendLayout is not NULL the solver of the friend layout is used.
  */
-BALMLayout::BALMLayout(float spacing, BALMLayout* friendLayout)
+BALMLayout::BALMLayout(float hSpacing, float vSpacing, BALMLayout* 
friendLayout)
        :
-       fInset(0.0f),
-       fSpacing(spacing / 2),
+       fLeftInset(0),
+       fRightInset(0),
+       fTopInset(0),
+       fBottomInset(0),
+       fHSpacing(hSpacing),
+       fVSpacing(vSpacing),
        fCurrentArea(NULL)
 {
        fSolver = friendLayout ? friendLayout->Solver() : &fOwnSolver;
@@ -977,30 +981,95 @@ BALMLayout::Solver() const
 
 
 void
-BALMLayout::SetInset(float inset)
+BALMLayout::SetInsets(float left, float top, float right,
+       float bottom)
 {
-       fInset = inset;
+       fLeftInset = BControlLook::ComposeSpacing(left);
+       fTopInset = BControlLook::ComposeSpacing(top);
+       fRightInset = BControlLook::ComposeSpacing(right);
+       fBottomInset = BControlLook::ComposeSpacing(bottom);
+
+       InvalidateLayout();
 }
 
 
-float
-BALMLayout::Inset() const
+void
+BALMLayout::SetInsets(float horizontal, float vertical)
 {
-       return fInset;
+       fLeftInset = BControlLook::ComposeSpacing(horizontal);
+       fRightInset = fLeftInset;
+
+       fTopInset = BControlLook::ComposeSpacing(vertical);
+       fBottomInset = fTopInset;
+
+       InvalidateLayout();
 }
 
 
 void
-BALMLayout::SetSpacing(float spacing)
+BALMLayout::SetInsets(float insets)
+{
+       fLeftInset = BControlLook::ComposeSpacing(insets);
+       fRightInset = fLeftInset;
+       fTopInset = fLeftInset;
+       fBottomInset = fLeftInset;
+
+       InvalidateLayout();
+}
+
+
+void
+BALMLayout::GetInsets(float* left, float* top, float* right,
+       float* bottom) const
+{
+       if (left)
+               *left = fLeftInset;
+       if (top)
+               *top = fTopInset;
+       if (right)
+               *right = fRightInset;
+       if (bottom)
+               *bottom = fBottomInset;
+}
+
+
+void
+BALMLayout::SetSpacing(float hSpacing, float vSpacing)
+{
+       fHSpacing = BControlLook::ComposeSpacing(hSpacing);
+       fVSpacing = BControlLook::ComposeSpacing(vSpacing);
+}
+
+
+void
+BALMLayout::GetSpacing(float *_hSpacing, float *_vSpacing) const
+{
+       if (_hSpacing)
+               *_hSpacing = fHSpacing;
+       if (_vSpacing)
+               *_vSpacing = fVSpacing;
+}
+
+
+float
+BALMLayout::InsetForTab(XTab* tab)
 {
-       fSpacing = spacing / 2;
+       if (tab == fLeft.Get())
+               return fLeftInset;
+       if (tab == fRight.Get())
+               return fRightInset;
+       return fHSpacing / 2;
 }
 
 
 float
-BALMLayout::Spacing() const
+BALMLayout::InsetForTab(YTab* tab)
 {
-       return fSpacing * 2;
+       if (tab == fTop.Get())
+               return fTopInset;
+       if (tab == fBottom.Get())
+               return fBottomInset;
+       return fVSpacing / 2;
 }
 
 
diff --git a/src/libs/alm/Area.cpp b/src/libs/alm/Area.cpp
index 65c0040..664ddfe 100644
--- a/src/libs/alm/Area.cpp
+++ b/src/libs/alm/Area.cpp
@@ -337,9 +337,7 @@ Area::LeftInset() const
                return fTopLeftInset.Width();
 
        BALMLayout* layout = static_cast<BALMLayout*>(fLayoutItem->Layout());
-       if (fLeft.Get() == layout->Left())
-               return layout->Inset();
-       return layout->Spacing() / 2;
+       return layout->InsetForTab(fLeft.Get());
 }
 
 
@@ -353,9 +351,7 @@ Area::TopInset() const
                return fTopLeftInset.Height();
 
        BALMLayout* layout = static_cast<BALMLayout*>(fLayoutItem->Layout());
-       if (fTop.Get() == layout->Top())
-               return layout->Inset();
-       return layout->Spacing() / 2;
+       return layout->InsetForTab(fTop.Get());
 }
 
 
@@ -369,9 +365,7 @@ Area::RightInset() const
                return fRightBottomInset.Width();
 
        BALMLayout* layout = static_cast<BALMLayout*>(fLayoutItem->Layout());
-       if (fRight.Get() == layout->Right())
-               return layout->Inset();
-       return layout->Spacing() / 2;
+       return layout->InsetForTab(fRight.Get());
 }
 
 
@@ -385,9 +379,7 @@ Area::BottomInset() const
                return fRightBottomInset.Height();
 
        BALMLayout* layout = static_cast<BALMLayout*>(fLayoutItem->Layout());
-       if (fBottom.Get() == layout->Bottom())
-               return layout->Inset();
-       return layout->Spacing() / 2;
+       return layout->InsetForTab(fBottom.Get());
 }
 
 

############################################################################

Commit:      9b0221fd43d3683f6ec1e0358cbd65df7c813403
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9b0221f
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Sun Jan 15 23:05:06 2012 UTC

In alm tests, replace calls to SetInset() with SetInsets().

----------------------------------------------------------------------------

diff --git a/src/tests/libs/alm/OperatorLayout.cpp 
b/src/tests/libs/alm/OperatorLayout.cpp
index c6783fc..a31adff 100644
--- a/src/tests/libs/alm/OperatorLayout.cpp
+++ b/src/tests/libs/alm/OperatorLayout.cpp
@@ -35,7 +35,7 @@ public:
                float spacing = be_control_look->DefaultItemSpacing();
                BALMLayout* layout = new BALMLayout(spacing);
                SetLayout(layout);
-               layout->SetInset(spacing);
+               layout->SetInsets(spacing);
 
                GroupItem item = GroupItem(button1) | (GroupItem(button2)
                        / (GroupItem(button3) | 
GroupItem(BSpaceLayoutItem::CreateGlue())
diff --git a/src/tests/libs/alm/Pinwheel.cpp b/src/tests/libs/alm/Pinwheel.cpp
index 2025882..24a3401 100644
--- a/src/tests/libs/alm/Pinwheel.cpp
+++ b/src/tests/libs/alm/Pinwheel.cpp
@@ -37,7 +37,7 @@ public:
                BALMLayout* layout = new BALMLayout(10.);
                SetLayout(layout);
 
-               layout->SetInset(5.);
+               layout->SetInsets(5.);
 
                // create extra tabs
                BReference<XTab> x1 = layout->AddXTab();
diff --git a/src/tests/libs/alm/Views.cpp b/src/tests/libs/alm/Views.cpp
index 0463ee7..5de238a 100644
--- a/src/tests/libs/alm/Views.cpp
+++ b/src/tests/libs/alm/Views.cpp
@@ -56,7 +56,7 @@ public:
                // create a new BALMLayout and use  it for this window
                BALMLayout* layout = new BALMLayout(10);
                SetLayout(layout);
-               layout->SetInset(10.);
+               layout->SetInsets(10.);
 
                layout->AddView(button1, layout->Left(), layout->Top());
                layout->AddViewToRight(radioButton);

############################################################################

Commit:      574533ef124f30d7710ce46ade1ca5f05935e083
URL:         http://cgit.haiku-os.org/haiku/commit/?id=574533e
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Sun Jan 15 23:36:51 2012 UTC

In BALMLayout, make AddView(...) consistent with other layouts.

If a BView is added which has a BLayout, use the layout as a BLayoutItem
to represent that view, as other layouts do.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index b8931c7..c7ba027 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -150,8 +150,7 @@ private:
                        float                           InsetForTab(XTab* tab);
                        float                           InsetForTab(YTab* tab);
 
-                       /*! Add a view without initialize the Area. */
-                       BLayoutItem*            _CreateLayoutItem(BView* view);
+                       BLayoutItem*            _LayoutItemToAdd(BView* view);
 
                        void                            
_UpdateAreaConstraints();
 
diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp
index 31381dd..d1e878a 100644
--- a/src/libs/alm/ALMLayout.cpp
+++ b/src/libs/alm/ALMLayout.cpp
@@ -451,10 +451,11 @@ Area*
 BALMLayout::AddView(BView* view, XTab* left, YTab* top, XTab* right,
        YTab* bottom)
 {
-       BLayoutItem* item = _CreateLayoutItem(view);
+       BLayoutItem* item = _LayoutItemToAdd(view);
        Area* area = AddItem(item, left, top, right, bottom);
        if (!area) {
-               delete item;
+               if (item != view->GetLayout())
+                       delete item;
                return NULL;
        }
        return area;
@@ -472,10 +473,11 @@ BALMLayout::AddView(BView* view, XTab* left, YTab* top, 
XTab* right,
 Area*
 BALMLayout::AddView(BView* view, Row* row, Column* column)
 {
-       BLayoutItem* item = _CreateLayoutItem(view);
+       BLayoutItem* item = _LayoutItemToAdd(view);
        Area* area = AddItem(item, row, column);
        if (!area) {
-               delete item;
+               if (item != view->GetLayout())
+                       delete item;
                return NULL;
        }
        return area;
@@ -485,10 +487,11 @@ BALMLayout::AddView(BView* view, Row* row, Column* column)
 Area*
 BALMLayout::AddViewToRight(BView* view, XTab* right, YTab* top, YTab* bottom)
 {
-       BLayoutItem* item = _CreateLayoutItem(view);
+       BLayoutItem* item = _LayoutItemToAdd(view);
        Area* area = AddItemToRight(item, right, top, bottom);
        if (!area) {
-               delete item;
+               if (item != view->GetLayout())
+                       delete item;
                return NULL;
        }
        return area;
@@ -498,10 +501,11 @@ BALMLayout::AddViewToRight(BView* view, XTab* right, 
YTab* top, YTab* bottom)
 Area*
 BALMLayout::AddViewToLeft(BView* view, XTab* left, YTab* top, YTab* bottom)
 {
-       BLayoutItem* item = _CreateLayoutItem(view);
+       BLayoutItem* item = _LayoutItemToAdd(view);
        Area* area = AddItemToLeft(item, left, top, bottom);
        if (!area) {
-               delete item;
+               if (item != view->GetLayout())
+                       delete item;
                return NULL;
        }
        return area;
@@ -511,10 +515,11 @@ BALMLayout::AddViewToLeft(BView* view, XTab* left, YTab* 
top, YTab* bottom)
 Area*
 BALMLayout::AddViewToTop(BView* view, YTab* top, XTab* left, XTab* right)
 {
-       BLayoutItem* item = _CreateLayoutItem(view);
+       BLayoutItem* item = _LayoutItemToAdd(view);
        Area* area = AddItemToTop(item, top, left, right);
        if (!area) {
-               delete item;
+               if (item != view->GetLayout())
+                       delete item;
                return NULL;
        }
        return area;
@@ -524,10 +529,11 @@ BALMLayout::AddViewToTop(BView* view, YTab* top, XTab* 
left, XTab* right)
 Area*
 BALMLayout::AddViewToBottom(BView* view, YTab* bottom, XTab* left, XTab* right)
 {
-       BLayoutItem* item = _CreateLayoutItem(view);
+       BLayoutItem* item = _LayoutItemToAdd(view);
        Area* area = AddItemToBottom(item, bottom, left, right);
        if (!area) {
-               delete item;
+               if (item != view->GetLayout())
+                       delete item;
                return NULL;
        }
        return area;
@@ -1074,8 +1080,10 @@ BALMLayout::InsetForTab(YTab* tab)
 
 
 BLayoutItem*
-BALMLayout::_CreateLayoutItem(BView* view)
+BALMLayout::_LayoutItemToAdd(BView* view)
 {
+       if (view->GetLayout())
+               return view->GetLayout();
        return new(std::nothrow) BViewLayoutItem(view);
 }
 

############################################################################

Commit:      8b52747974b85d4377376fe51ef925ebedbf51d9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8b52747
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 16 01:13:05 2012 UTC

In Area, remove unused ItemFrame() method.

Also modify Frame() method to return a rect with rounded coordinates.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/Area.h b/headers/libs/alm/Area.h
index 1022771..88c331c 100644
--- a/headers/libs/alm/Area.h
+++ b/headers/libs/alm/Area.h
@@ -107,7 +107,6 @@ public:
                        void                            
InvalidateSizeConstraints();
 
                        BRect                           Frame() const;
-                       BRect                           ItemFrame() const;
 
 private:
                                                                
Area(BLayoutItem* item);
diff --git a/src/libs/alm/Area.cpp b/src/libs/alm/Area.cpp
index 664ddfe..5233371 100644
--- a/src/libs/alm/Area.cpp
+++ b/src/libs/alm/Area.cpp
@@ -491,15 +491,8 @@ Area::InvalidateSizeConstraints()
 BRect
 Area::Frame() const
 {
-       return BRect(fLeft->Value(), fTop->Value(), fRight->Value(),
-               fBottom->Value());
-}
-
-
-BRect
-Area::ItemFrame() const
-{
-       return fLayoutItem->Frame();
+       return BRect(round(fLeft->Value()), round(fTop->Value()),
+               round(fRight->Value()), round(fBottom->Value()));
 }
 
 
@@ -615,8 +608,7 @@ Area::_DoLayout()
        if (!fLeft)
                return;
 
-       BRect areaFrame(round(fLeft->Value()), round(fTop->Value()),
-               round(fRight->Value()), round(fBottom->Value()));
+       BRect areaFrame(Frame());
        areaFrame.left += LeftInset();
        areaFrame.right -= RightInset();
        areaFrame.top += TopInset();

############################################################################

Commit:      b50d4ed8bd6368b5b72169c5ab92101d62a593d0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b50d4ed
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 16 21:37:12 2012 UTC

Add new methods to BALMLayout for adding multiple x/y tabs at once.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index c7ba027..ccb5bb8 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -37,7 +37,9 @@ public:
        virtual                                         ~BALMLayout();
 
                        BReference<XTab>        AddXTab();
+                       void                            
AddXTabs(BReference<XTab>* tabs, uint32 count);
                        BReference<YTab>        AddYTab();
+                       void                            
AddYTabs(BReference<YTab>* tabs, uint32 count);
 
                        int32                           CountXTabs() const;
                        int32                           CountYTabs() const;
@@ -192,6 +194,8 @@ private:
 
 }      // namespace BALM
 
+
 using BALM::BALMLayout;
 
+
 #endif // ALM_LAYOUT_H
diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp
index d1e878a..d76cb9d 100644
--- a/src/libs/alm/ALMLayout.cpp
+++ b/src/libs/alm/ALMLayout.cpp
@@ -85,6 +85,22 @@ BALMLayout::AddXTab()
 }
 
 
+void
+BALMLayout::AddXTabs(BReference<XTab>* tabs, uint32 count)
+{
+       for (uint32 i = 0; i < count; i++)
+               tabs[i] = AddXTab();
+}
+
+
+void
+BALMLayout::AddYTabs(BReference<YTab>* tabs, uint32 count)
+{
+       for (uint32 i = 0; i < count; i++)
+               tabs[i] = AddYTab();
+}
+
+
 /**
  * Adds a new y-tab to the specification.
  *

############################################################################

Commit:      50cc24b3f93fecca228ab5040f5d92951b55964d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=50cc24b
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 16 21:38:20 2012 UTC

Add a Builder for BALMLayout.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayoutBuilder.h 
b/headers/libs/alm/ALMLayoutBuilder.h
new file mode 100644
index 0000000..3b3f92d
--- /dev/null
+++ b/headers/libs/alm/ALMLayoutBuilder.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2012, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef        ALM_LAYOUT_BUILDER_H
+#define        ALM_LAYOUT_BUILDER_H
+
+
+#include "ALMLayout.h"
+
+
+class BWindow;
+
+
+namespace BALM {
+
+
+class BALMLayoutBuilder {
+public:
+                                                               
BALMLayoutBuilder(BView* view, float hSpacing,
+                                                                       float 
vSpacing,
+                                                                       
BALMLayout* friendLayout = NULL);
+                                                               
BALMLayoutBuilder(BView* view,
+                                                                       
BALMLayout* layout);
+                                                               
BALMLayoutBuilder(BWindow* window,
+                                                                       float 
hSpacing, float vSpacing,
+                                                                       
BALMLayout* friendLayout = NULL);
+                                                               
BALMLayoutBuilder(BWindow* window,
+                                                                       
BALMLayout* layout);
+                                                               
BALMLayoutBuilder(BALMLayout* layout);
+
+       BALMLayoutBuilder&                      Add(BView* view, XTab* left, 
YTab* top,
+                                                                       XTab* 
right = NULL, YTab* bottom = NULL);
+       BALMLayoutBuilder&                      Add(BView* view, Row* row, 
Column* column);
+
+       BALMLayoutBuilder&                      Add(BLayoutItem* item, XTab* 
left,
+                                                                       YTab* 
top, XTab* right = NULL,
+                                                                       YTab* 
bottom = NULL);
+       BALMLayoutBuilder&                      Add(BLayoutItem* item, Row* row,
+                                                                       Column* 
column);
+
+       BALMLayoutBuilder&                      SetInsets(float insets);
+       BALMLayoutBuilder&                      SetInsets(float horizontal, 
float vertical);
+       BALMLayoutBuilder&                      SetInsets(float left, float 
top, float right,
+                                                                       float 
bottom);
+
+       BALMLayoutBuilder&                      SetSpacing(float horizontal, 
float vertical);
+                                                                       
+       struct Snake;
+
+       // context setters
+       Snake   StartingAt(BView* view);
+       Snake   StartingAt(BLayoutItem* item);
+
+       struct Snake {
+               BALMLayoutBuilder::Snake& AddToLeft(BView* view,
+                                                                       XTab* 
left = NULL, YTab* top = NULL,
+                                                                       YTab* 
bottom = NULL);
+               BALMLayoutBuilder::Snake& AddToRight(BView* view,
+                                                                       XTab* 
right = NULL, YTab* top = NULL,
+                                                                       YTab* 
bottom = NULL);
+               BALMLayoutBuilder::Snake& AddAbove(BView* view,
+                                                                       YTab* 
top = NULL, XTab* left = NULL,
+                                                                       XTab* 
right = NULL);
+               BALMLayoutBuilder::Snake& AddBelow(BView* view, YTab* bottom = 
NULL,
+                                                                       XTab* 
left = NULL, XTab* right = NULL);
+
+               BALMLayoutBuilder::Snake& AddToLeft(BLayoutItem* item,
+                                                                       XTab* 
left = NULL, YTab* top = NULL,
+                                                                       YTab* 
bottom = NULL);
+               BALMLayoutBuilder::Snake& AddToRight(BLayoutItem* item,
+                                                                       XTab* 
right = NULL, YTab* top = NULL,
+                                                                       YTab* 
bottom = NULL);
+               BALMLayoutBuilder::Snake& AddAbove(BLayoutItem* item,
+                                                                       YTab* 
top = NULL, XTab* left = NULL,
+                                                                       XTab* 
right = NULL);
+               BALMLayoutBuilder::Snake& AddBelow(BLayoutItem* item,
+                                                                       YTab* 
bottom = NULL, XTab* left = NULL,
+                                                                       XTab* 
right = NULL);
+
+
+               // these methods throw away the stack
+               Snake                                           
StartingAt(BView* view);
+               Snake                                           
StartingAt(BLayoutItem* item);
+
+               Snake                                   Push();
+               Snake&                                  Pop();
+
+               BALMLayoutBuilder&              End();
+
+       private:
+               friend class BALMLayoutBuilder;
+
+                                                               Snake(Area* 
area, BALMLayoutBuilder* root);
+                                                               Snake(Area* 
area, Snake* previous);
+
+               BALMLayout*                             _Layout();
+               Area*                                   _AddToLayout(BView* 
view, XTab* left, YTab* top,
+                                                                       XTab* 
right, YTab* bottom);
+               Area*                                   
_AddToLayout(BLayoutItem* item, XTab* left,
+                                                                       YTab* 
top, XTab* right, YTab* bottom);
+
+               BALMLayoutBuilder*              fRootBuilder;
+               Snake*                                  fPreviousSnake;
+               Area*                                   fCurrentArea;
+       };
+
+
+private:
+       friend struct Snake;
+
+               BALMLayout*                             fLayout;
+};
+
+
+};
+
+
+#endif
diff --git a/src/libs/alm/ALMLayoutBuilder.cpp 
b/src/libs/alm/ALMLayoutBuilder.cpp
new file mode 100644
index 0000000..62dc5a9
--- /dev/null
+++ b/src/libs/alm/ALMLayoutBuilder.cpp
@@ -0,0 +1,356 @@
+/*
+ * Copyright 2012, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#include "ALMLayoutBuilder.h"
+
+
+#include <Window.h>
+
+
+namespace BALM {
+
+
+BALMLayoutBuilder::BALMLayoutBuilder(BView* view, float hSpacing,
+       float vSpacing, BALMLayout* friendLayout)
+{
+       fLayout = new BALMLayout(hSpacing, vSpacing, friendLayout);
+       view->SetLayout(fLayout);
+}
+
+
+BALMLayoutBuilder::BALMLayoutBuilder(BView* view, BALMLayout* layout)
+{
+       fLayout = layout;
+       view->SetLayout(layout);
+}
+
+
+BALMLayoutBuilder::BALMLayoutBuilder(BWindow* window, float hSpacing,
+       float vSpacing, BALMLayout* friendLayout)
+{
+       fLayout = new BALMLayout(hSpacing, vSpacing, friendLayout);
+       window->SetLayout(fLayout);
+
+       fLayout->Owner()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+               // TODO: we get a white background if we don't do this
+}
+
+
+BALMLayoutBuilder::BALMLayoutBuilder(BWindow* window, BALMLayout* layout)
+{
+       fLayout = layout;
+       window->SetLayout(fLayout);
+
+       fLayout->Owner()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+               // TODO: we get a white background if we don't do this
+}
+
+
+BALMLayoutBuilder::BALMLayoutBuilder(BALMLayout* layout)
+{
+       fLayout = layout;
+}
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::Add(BView* view, XTab* left, YTab* top,
+       XTab* right, YTab* bottom)
+{
+       fLayout->AddView(view, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::Add(BView* view, Row* row, Column* column)
+{
+       fLayout->AddView(view, row, column);
+       return *this;
+}
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::Add(BLayoutItem* item, XTab* left, YTab* top,
+       XTab* right, YTab* bottom)
+{
+       fLayout->AddItem(item, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::Add(BLayoutItem* item, Row* row, Column* column)
+{
+       fLayout->AddItem(item, row, column);
+       return *this;
+}
+
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::SetInsets(float insets)
+{
+       fLayout->SetInsets(insets);
+       return *this;
+}
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::SetInsets(float horizontal, float vertical)
+{
+       fLayout->SetInsets(horizontal, vertical);
+       return *this;
+}
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::SetInsets(float left, float top, float right,
+                                                                       float 
bottom)
+{
+       fLayout->SetInsets(left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::SetSpacing(float horizontal, float vertical)
+{
+       fLayout->SetSpacing(horizontal, vertical);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake
+BALMLayoutBuilder::StartingAt(BView* view)
+{
+       return Snake(fLayout->AreaFor(view), this);
+}
+
+
+BALMLayoutBuilder::Snake
+BALMLayoutBuilder::StartingAt(BLayoutItem* item)
+{
+       return Snake(fLayout->AreaFor(item), this);
+}
+
+
+BALMLayoutBuilder::Snake::Snake(Area* area, BALMLayoutBuilder* root)
+{
+       fCurrentArea = area;
+       fRootBuilder = root;
+       fPreviousSnake = NULL;
+}
+
+
+BALMLayoutBuilder::Snake::Snake(Area* area, Snake* previous)
+{
+       fCurrentArea = area;
+       fRootBuilder = previous->fRootBuilder;
+       fPreviousSnake = previous;
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::AddToLeft(BView* view, XTab* _left, YTab* top,
+       YTab* bottom)
+{
+       BReference<XTab> left = _left;
+       if (_left == NULL)
+               left = _Layout()->AddXTab();
+       XTab* right = fCurrentArea->Left();
+       if (!top)
+               top = fCurrentArea->Top();
+       if (!bottom)
+               bottom = fCurrentArea->Bottom();
+
+       fCurrentArea = _AddToLayout(view, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::AddToRight(BView* view, XTab* _right, YTab* top,
+       YTab* bottom)
+{
+       XTab* left = fCurrentArea->Right();
+       BReference<XTab> right = _right;
+       if (_right == NULL)
+               right = _Layout()->AddXTab();
+       if (!top)
+               top = fCurrentArea->Top();
+       if (!bottom)
+               bottom = fCurrentArea->Bottom();
+
+       fCurrentArea = _AddToLayout(view, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::AddAbove(BView* view, YTab* _top, XTab* left,
+       XTab* right)
+{
+       if (!left)
+               left = fCurrentArea->Left();
+       if (!right)
+               right = fCurrentArea->Right();
+       BReference<YTab> top = _top;
+       if (_top == NULL)
+               top = _Layout()->AddYTab();
+       YTab* bottom = fCurrentArea->Top();
+
+       fCurrentArea = _AddToLayout(view, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::AddBelow(BView* view, YTab* _bottom, XTab* left,
+       XTab* right)
+{
+       if (!left)
+               left = fCurrentArea->Left();
+       if (!right)
+               right = fCurrentArea->Right();
+       YTab* top = fCurrentArea->Bottom();
+       BReference<YTab> bottom = _bottom;
+       if (_bottom == NULL)
+               bottom = _Layout()->AddYTab();
+
+       fCurrentArea = _AddToLayout(view, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::AddToLeft(BLayoutItem* item, XTab* _left, YTab* top,
+       YTab* bottom)
+{
+       BReference<XTab> left = _left;
+       if (_left == NULL)
+               left = _Layout()->AddXTab();
+       XTab* right = fCurrentArea->Left();
+       if (!top)
+               top = fCurrentArea->Top();
+       if (!bottom)
+               bottom = fCurrentArea->Bottom();
+
+       fCurrentArea = _AddToLayout(item, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::AddToRight(BLayoutItem* item, XTab* _right, YTab* 
top,
+       YTab* bottom)
+{
+       XTab* left = fCurrentArea->Right();
+       BReference<XTab> right = _right;
+       if (_right == NULL)
+               right = _Layout()->AddXTab();
+       if (!top)
+               top = fCurrentArea->Top();
+       if (!bottom)
+               bottom = fCurrentArea->Bottom();
+
+       fCurrentArea = _AddToLayout(item, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::AddAbove(BLayoutItem* item, YTab* _top, XTab* left,
+       XTab* right)
+{
+       if (!left)
+               left = fCurrentArea->Left();
+       if (!right)
+               right = fCurrentArea->Right();
+       BReference<YTab> top = _top;
+       if (_top == NULL)
+               top = _Layout()->AddYTab();
+       YTab* bottom = fCurrentArea->Top();
+
+       fCurrentArea = _AddToLayout(item, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::AddBelow(BLayoutItem* item, YTab* _bottom, XTab* 
left,
+       XTab* right)
+{
+       if (!left)
+               left = fCurrentArea->Left();
+       if (!right)
+               right = fCurrentArea->Right();
+       YTab* top = fCurrentArea->Bottom();
+       BReference<YTab> bottom = _bottom;
+       if (_bottom == NULL)
+               bottom = _Layout()->AddYTab();
+
+       fCurrentArea = _AddToLayout(item, left, top, right, bottom);
+       return *this;
+}
+
+
+BALMLayoutBuilder::Snake
+BALMLayoutBuilder::Snake::StartingAt(BView* view)
+{
+       return fRootBuilder->StartingAt(view);
+}
+
+
+BALMLayoutBuilder::Snake
+BALMLayoutBuilder::Snake::StartingAt(BLayoutItem* item)
+{
+       return fRootBuilder->StartingAt(item);
+}
+
+
+BALMLayoutBuilder::Snake
+BALMLayoutBuilder::Snake::Push()
+{
+       return Snake(fCurrentArea, this);
+}
+
+
+BALMLayoutBuilder::Snake&
+BALMLayoutBuilder::Snake::Pop()
+{
+       return *fPreviousSnake;
+}
+
+
+BALMLayoutBuilder&
+BALMLayoutBuilder::Snake::End()
+{
+       return *fRootBuilder;
+}
+
+
+BALMLayout*
+BALMLayoutBuilder::Snake::_Layout()
+{
+       return fRootBuilder->fLayout;
+}
+
+
+Area*
+BALMLayoutBuilder::Snake::_AddToLayout(BView* view, XTab* left, YTab* top,
+       XTab* right, YTab* bottom)
+{
+       return _Layout()->AddView(view, left, top, right, bottom);
+}
+
+
+Area*
+BALMLayoutBuilder::Snake::_AddToLayout(BLayoutItem* item, XTab* left,
+       YTab* top, XTab* right, YTab* bottom)
+{
+       return _Layout()->AddItem(item, left, top, right, bottom);
+}
+
+
+};
diff --git a/src/libs/alm/Jamfile b/src/libs/alm/Jamfile
index 7726b18..32179c2 100644
--- a/src/libs/alm/Jamfile
+++ b/src/libs/alm/Jamfile
@@ -8,6 +8,7 @@ UseHeaders [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) kits 
interface ] ;
 
 SharedLibrary libalm.so :
        ALMLayout.cpp
+       ALMLayoutBuilder.cpp
        Area.cpp
        Column.cpp
        Row.cpp

############################################################################

Commit:      2bf5ded1ed0a650fd1a36799f660624a7068dbc9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2bf5ded
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 16 22:01:16 2012 UTC

Add BALMLayoutBuilder implementations to ALM tests.

----------------------------------------------------------------------------

diff --git a/src/tests/libs/alm/ComplexButtons.cpp 
b/src/tests/libs/alm/ComplexButtons.cpp
index fcd0977..4fe7393 100644
--- a/src/tests/libs/alm/ComplexButtons.cpp
+++ b/src/tests/libs/alm/ComplexButtons.cpp
@@ -12,6 +12,7 @@
 
 // include this for ALM
 #include "ALMLayout.h"
+#include "ALMLayoutBuilder.h"
 
 
 class ComplexButtonsWindow : public BWindow {
@@ -55,6 +56,17 @@ public:
                button5->SetExplicitMaxSize(BSize(500, 500));
                button5->SetExplicitPreferredSize(BSize(30 + kOffset, 
B_SIZE_UNSET));
 
+               BALMLayout* fLayout = new BALMLayout(10, 10);
+               BALM::BALMLayoutBuilder(this, fLayout)
+                       .Add(button1, fLayout->Left(), fLayout->Top())
+                       .StartingAt(button1)
+                               .AddToRight(button2)
+                               .AddToRight(button3, fLayout->Right())
+                       .AddBelow(button4, fLayout->Bottom(), fLayout->Left(),
+                               fLayout->AddXTab())
+                       .AddToRight(button5, fLayout->Right());
+                               
+               /*
                // create a new BALMLayout and use  it for this window
                fLayout = new BALMLayout();
                SetLayout(fLayout);
@@ -66,6 +78,7 @@ public:
                fLayout->AddView(button4, fLayout->Left(), 
fLayout->BottomOf(button1),
                        NULL, fLayout->Bottom());
                fLayout->AddViewToRight(button5, fLayout->Right());
+               */
 
                // test size limits
                BSize min = fLayout->MinSize();
diff --git a/src/tests/libs/alm/Pinwheel.cpp b/src/tests/libs/alm/Pinwheel.cpp
index 24a3401..cdea90a 100644
--- a/src/tests/libs/alm/Pinwheel.cpp
+++ b/src/tests/libs/alm/Pinwheel.cpp
@@ -13,6 +13,7 @@
 
 // include this for ALM
 #include "ALMLayout.h"
+#include "ALMLayoutBuilder.h"
 
 
 class PinwheelWindow : public BWindow {
@@ -34,7 +35,24 @@ public:
                button4->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 
B_SIZE_UNLIMITED));
 
                // create a new BALMLayout and use  it for this window
-               BALMLayout* layout = new BALMLayout(10.);
+               BALMLayout* layout = new BALMLayout(10, 10);
+
+               BReference<XTab> xTabs[2];
+               BReference<YTab> yTabs[2];
+               layout->AddXTabs(xTabs, 2);
+               layout->AddYTabs(yTabs, 2);
+
+               BALM::BALMLayoutBuilder(this, layout)
+                       .SetInsets(5)
+                       .Add(textView1, xTabs[0], yTabs[0], xTabs[1], yTabs[1])
+                       .StartingAt(textView1)
+                               .AddAbove(button1, layout->Top(), 
layout->Left())
+                               .AddToRight(button2, layout->Right(), NULL, 
yTabs[1])
+                               .AddBelow(button3, layout->Bottom(), xTabs[0])
+                               .AddToLeft(button4, layout->Left(),  yTabs[0]);
+
+               // alternative setup
+               /*
                SetLayout(layout);
 
                layout->SetInsets(5.);
@@ -52,6 +70,7 @@ public:
                        layout->Bottom());
                layout->AddView(button4, layout->Left(), y1, x1, 
layout->Bottom());
                layout->AddView(textView1, x1, y1, x2, y2);
+               */
 
                // alternative setup
                /* 
diff --git a/src/tests/libs/alm/ThreeButtons.cpp 
b/src/tests/libs/alm/ThreeButtons.cpp
index 834e724..f119ae1 100644
--- a/src/tests/libs/alm/ThreeButtons.cpp
+++ b/src/tests/libs/alm/ThreeButtons.cpp
@@ -12,6 +12,7 @@
 
 // include this for ALM
 #include "ALMLayout.h"
+#include "ALMLayoutBuilder.h"
 
 
 class ThreeButtonsWindow : public BWindow {
@@ -37,6 +38,14 @@ public:
                        B_ALIGN_USE_FULL_HEIGHT));
                button3->SetExplicitMaxSize(BSize(500, 500));
 
+               fLayout = new BALMLayout(0, 0);
+               BALM::BALMLayoutBuilder(this, fLayout)
+                       .Add(button1, fLayout->Left(), fLayout->Top(), 
fLayout->Right())
+                       .StartingAt(button1)
+                               .AddBelow(button2)
+                               .AddBelow(button3, fLayout->Bottom());
+
+               /*
                // create a new BALMLayout and use  it for this window
                fLayout = new BALMLayout();
                SetLayout(fLayout);
@@ -45,6 +54,7 @@ public:
                        fLayout->Right(), NULL);
                fLayout->AddViewToBottom(button2);
                fLayout->AddViewToBottom(button3, fLayout->Bottom());
+               */
 
                // test size limits
                BSize min = fLayout->MinSize();
diff --git a/src/tests/libs/alm/Views.cpp b/src/tests/libs/alm/Views.cpp
index 5de238a..97ffe49 100644
--- a/src/tests/libs/alm/Views.cpp
+++ b/src/tests/libs/alm/Views.cpp
@@ -18,6 +18,7 @@
 #include <Window.h>
 
 #include "ALMLayout.h"
+#include "ALMLayoutBuilder.h"
 
 
 using namespace LinearProgramming;
@@ -53,6 +54,31 @@ public:
                menu->AddItem(new BPopUpMenu("Menu 2"));
                BStringView* stringView2 = new BStringView("string 2", "string 
2");
 
+               BALM::BALMLayout* layout = new BALMLayout(10, 10);
+               BALM::BALMLayoutBuilder(this, layout)
+                       .SetInsets(10)
+                       .Add(button1, layout->Left(), layout->Top())
+                       .StartingAt(button1)
+                               .AddToRight(radioButton)
+                               .AddToRight(BSpaceLayoutItem::CreateGlue())
+                               .AddToRight(button3)
+                       .StartingAt(radioButton)
+                               .AddBelow(textView1, NULL, NULL, 
layout->RightOf(button3))
+                               .AddBelow(button4)
+                               .AddToRight(button5, layout->Right())
+                               .AddBelow(button6)
+                               .AddBelow(menu1, layout->AddYTab(), 
layout->Left(),
+                                       layout->AddXTab())
+                               .AddToRight(stringView1)
+                               .AddToRight(BSpaceLayoutItem::CreateGlue(), 
layout->Right())
+                               .AddBelow(statusBar, NULL, layout->Left(), 
layout->Right())
+                       .StartingAt(statusBar)
+                               .AddBelow(menu2, layout->Bottom(), 
layout->Left(),
+                                       layout->RightOf(menu1))
+                               .AddToRight(stringView2)
+                               .AddToRight(BSpaceLayoutItem::CreateGlue(), 
layout->Right());
+
+               /*
                // create a new BALMLayout and use  it for this window
                BALMLayout* layout = new BALMLayout(10);
                SetLayout(layout);
@@ -79,6 +105,7 @@ public:
                        layout->RightOf(menu1), layout->Bottom());
                layout->AddViewToRight(stringView2);
                layout->AddItemToRight(BSpaceLayoutItem::CreateGlue(), 
layout->Right());
+               */
 
                layout->Solver()->AddConstraint(2, layout->TopOf(menu1), -1,
                        layout->Bottom(), OperatorType(kEQ), 0);

############################################################################

Commit:      d814593064e55136518eb8d7749682ffb67f05cd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d814593
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 16 22:07:58 2012 UTC

Remove BALMLayout::Add*To* methods, which are availabe in the builder.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index ccb5bb8..b56ddf6 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -75,10 +75,6 @@ public:
                        Area*                           AreaFor(const 
BLayoutItem* item) const;
                        int32                           CountAreas() const;
                        Area*                           AreaAt(int32 index) 
const;
-                       Area*                           CurrentArea() const;
-                       bool                            SetCurrentArea(const 
Area* area);
-                       bool                            SetCurrentArea(const 
BView* view);
-                       bool                            SetCurrentArea(const 
BLayoutItem* item);
        
                        XTab*                           LeftOf(const BView* 
view) const;
                        XTab*                           LeftOf(const 
BLayoutItem* item) const;
@@ -98,15 +94,6 @@ public:
        virtual Area*                           AddView(BView* view, XTab* 
left, YTab* top,
                                                                        XTab* 
right = NULL, YTab* bottom = NULL);
        virtual Area*                           AddView(BView* view, Row* row, 
Column* column);
-       virtual Area*                           AddViewToRight(BView* view, 
XTab* right = NULL,
-                                                                       YTab* 
top = NULL, YTab* bottom = NULL);
-       virtual Area*                           AddViewToLeft(BView* view, 
XTab* left = NULL,
-                                                                       YTab* 
top = NULL, YTab* bottom = NULL);
-       virtual Area*                           AddViewToTop(BView* view, YTab* 
top = NULL,
-                                                                       XTab* 
left = NULL, XTab* right = NULL);
-       virtual Area*                           AddViewToBottom(BView* view,
-                                                                       YTab* 
bottom = NULL, XTab* left = NULL,
-                                                                       XTab* 
right = NULL);
 
        virtual bool                            AddItem(BLayoutItem* item);
        virtual bool                            AddItem(int32 index, 
BLayoutItem* item);
@@ -116,19 +103,6 @@ public:
        virtual Area*                           AddItem(BLayoutItem* item, Row* 
row,
                                                                        Column* 
column);
                                                                        
-       virtual Area*                           AddItemToRight(BLayoutItem* 
item,
-                                                                       XTab* 
right = NULL, YTab* top = NULL,
-                                                                       YTab* 
bottom = NULL);
-       virtual Area*                           AddItemToLeft(BLayoutItem* item,
-                                                                       XTab* 
left = NULL, YTab* top = NULL,
-                                                                       YTab* 
bottom = NULL);
-       virtual Area*                           AddItemToTop(BLayoutItem* item,
-                                                                       YTab* 
top = NULL, XTab* left = NULL,
-                                                                       XTab* 
right = NULL);
-       virtual Area*                           AddItemToBottom(BLayoutItem* 
item,
-                                                                       YTab* 
bottom = NULL, XTab* left = NULL,
-                                                                       XTab* 
right = NULL);
-
                        bool                            SaveLayout(BMessage* 
archive) const;
                        bool                            RestoreLayout(const 
BMessage* archive);
 
@@ -184,8 +158,6 @@ private:
                        float                           fHSpacing;
                        float                           fVSpacing;
 
-                       Area*                           fCurrentArea;
-
                        XTabList                        fXTabList;
                        YTabList                        fYTabList;
 
diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp
index d76cb9d..0261deb 100644
--- a/src/libs/alm/ALMLayout.cpp
+++ b/src/libs/alm/ALMLayout.cpp
@@ -36,8 +36,7 @@ BALMLayout::BALMLayout(float hSpacing, float vSpacing, 
BALMLayout* friendLayout)
        fTopInset(0),
        fBottomInset(0),
        fHSpacing(hSpacing),
-       fVSpacing(vSpacing),
-       fCurrentArea(NULL)
+       fVSpacing(vSpacing)
 {
        fSolver = friendLayout ? friendLayout->Solver() : &fOwnSolver;
        fRowColumnManager = new RowColumnManager(fSolver);
@@ -275,43 +274,6 @@ BALMLayout::AreaAt(int32 index) const
 }
 
 
-Area*
-BALMLayout::CurrentArea() const
-{
-       return fCurrentArea;
-}
-
-
-bool
-BALMLayout::SetCurrentArea(const Area* area)
-{
-       fCurrentArea = const_cast<Area*>(area);
-       return true;
-}
-
-
-bool
-BALMLayout::SetCurrentArea(const BView* view)
-{
-       Area* area = AreaFor(view);
-       if (!area)
-               return false;
-       fCurrentArea = area;
-       return true;
-}
-
-
-bool
-BALMLayout::SetCurrentArea(const BLayoutItem* item)
-{
-       Area* area = AreaFor(item);
-       if (!area)
-               return false;
-       fCurrentArea = area;
-       return true;
-}
-
-
 XTab*
 BALMLayout::LeftOf(const BView* view) const
 {
@@ -500,62 +462,6 @@ BALMLayout::AddView(BView* view, Row* row, Column* column)
 }
 
 
-Area*
-BALMLayout::AddViewToRight(BView* view, XTab* right, YTab* top, YTab* bottom)
-{
-       BLayoutItem* item = _LayoutItemToAdd(view);
-       Area* area = AddItemToRight(item, right, top, bottom);
-       if (!area) {
-               if (item != view->GetLayout())
-                       delete item;
-               return NULL;
-       }
-       return area;
-}
-
-
-Area*
-BALMLayout::AddViewToLeft(BView* view, XTab* left, YTab* top, YTab* bottom)
-{
-       BLayoutItem* item = _LayoutItemToAdd(view);
-       Area* area = AddItemToLeft(item, left, top, bottom);
-       if (!area) {
-               if (item != view->GetLayout())
-                       delete item;
-               return NULL;
-       }
-       return area;
-}
-
-
-Area*
-BALMLayout::AddViewToTop(BView* view, YTab* top, XTab* left, XTab* right)
-{
-       BLayoutItem* item = _LayoutItemToAdd(view);
-       Area* area = AddItemToTop(item, top, left, right);
-       if (!area) {
-               if (item != view->GetLayout())
-                       delete item;
-               return NULL;
-       }
-       return area;
-}
-
-
-Area*
-BALMLayout::AddViewToBottom(BView* view, YTab* bottom, XTab* left, XTab* right)
-{
-       BLayoutItem* item = _LayoutItemToAdd(view);
-       Area* area = AddItemToBottom(item, bottom, left, right);
-       if (!area) {
-               if (item != view->GetLayout())
-                       delete item;
-               return NULL;
-       }
-       return area;
-}
-
-
 bool
 BALMLayout::AddItem(BLayoutItem* item)
 {
@@ -609,7 +515,6 @@ BALMLayout::AddItem(BLayoutItem* item, XTab* left, YTab* 
top, XTab* _right,
        Area* area = AreaFor(item);
        if (!area)
                return NULL;
-       fCurrentArea = area;
 
        area->_Init(fSolver, left, top, right, bottom, fRowColumnManager);
 
@@ -626,7 +531,6 @@ BALMLayout::AddItem(BLayoutItem* item, Row* row, Column* 
column)
        Area* area = AreaFor(item);
        if (!area)
                return NULL;
-       fCurrentArea = area;
 
        area->_Init(fSolver, row, column, fRowColumnManager);
 
@@ -635,85 +539,6 @@ BALMLayout::AddItem(BLayoutItem* item, Row* row, Column* 
column)
 }
 
 
-Area*
-BALMLayout::AddItemToRight(BLayoutItem* item, XTab* _right, YTab* top,
-       YTab* bottom)
-{
-       if (fCurrentArea == NULL)
-               return NULL;
-
-       XTab* left = fCurrentArea->Right();
-       BReference<XTab> right = _right;
-       if (_right == NULL)
-               right = AddXTab();
-       if (!top)
-               top = fCurrentArea->Top();
-       if (!bottom)
-               bottom = fCurrentArea->Bottom();
-
-       return AddItem(item, left, top, right, bottom);
-}
-
-
-Area*
-BALMLayout::AddItemToLeft(BLayoutItem* item, XTab* _left, YTab* top,
-       YTab* bottom)
-{
-       if (fCurrentArea == NULL)
-               return NULL;
-
-       BReference<XTab> left = _left;
-       if (_left == NULL)
-               left = AddXTab();
-       XTab* right = fCurrentArea->Left();
-       if (!top)
-               top = fCurrentArea->Top();
-       if (!bottom)
-               bottom = fCurrentArea->Bottom();
-
-       return AddItem(item, left, top, right, bottom);
-}
-
-
-Area*
-BALMLayout::AddItemToTop(BLayoutItem* item, YTab* _top, XTab* left, XTab* 
right)
-{
-       if (fCurrentArea == NULL)
-               return NULL;
-
-       if (!left)
-               left = fCurrentArea->Left();
-       if (!right)
-               right = fCurrentArea->Right();
-       BReference<YTab> top = _top;
-       if (_top == NULL)
-               top = AddYTab();
-       YTab* bottom = fCurrentArea->Top();
-
-       return AddItem(item, left, top, right, bottom);
-}
-
-
-Area*
-BALMLayout::AddItemToBottom(BLayoutItem* item, YTab* _bottom, XTab* left,
-       XTab* right)
-{
-       if (fCurrentArea == NULL)
-               return NULL;
-
-       if (!left)
-               left = fCurrentArea->Left();
-       if (!right)
-               right = fCurrentArea->Right();
-       YTab* top = fCurrentArea->Bottom();
-       BReference<YTab> bottom = _bottom;
-       if (_bottom == NULL)
-               bottom = AddYTab();
-
-       return AddItem(item, left, top, right, bottom);
-}
-
-
 enum {
        kLeftBorderIndex = -2,
        kTopBorderIndex = -3,

############################################################################

Commit:      b99cf18c18ca3c9a7fcd2df4074569bcf0a0e64c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b99cf18
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 16 22:12:51 2012 UTC

Remove old implementatoins of ALM tests that used the Add*To* methods.

----------------------------------------------------------------------------

diff --git a/src/tests/libs/alm/ComplexButtons.cpp 
b/src/tests/libs/alm/ComplexButtons.cpp
index 4fe7393..e49cd3c 100644
--- a/src/tests/libs/alm/ComplexButtons.cpp
+++ b/src/tests/libs/alm/ComplexButtons.cpp
@@ -66,20 +66,6 @@ public:
                                fLayout->AddXTab())
                        .AddToRight(button5, fLayout->Right());
                                
-               /*
-               // create a new BALMLayout and use  it for this window
-               fLayout = new BALMLayout();
-               SetLayout(fLayout);
-
-               fLayout->AddView(button1, fLayout->Left(), fLayout->Top(), NULL,
-                       NULL);
-               fLayout->AddViewToRight(button2);
-               fLayout->AddViewToRight(button3, fLayout->Right());
-               fLayout->AddView(button4, fLayout->Left(), 
fLayout->BottomOf(button1),
-                       NULL, fLayout->Bottom());
-               fLayout->AddViewToRight(button5, fLayout->Right());
-               */
-
                // test size limits
                BSize min = fLayout->MinSize();
                BSize max = fLayout->MaxSize();
diff --git a/src/tests/libs/alm/Pinwheel.cpp b/src/tests/libs/alm/Pinwheel.cpp
index cdea90a..fcdb6e6 100644
--- a/src/tests/libs/alm/Pinwheel.cpp
+++ b/src/tests/libs/alm/Pinwheel.cpp
@@ -72,23 +72,6 @@ public:
                layout->AddView(textView1, x1, y1, x2, y2);
                */
 
-               // alternative setup
-               /* 
-               layout->AddView(button1);
-               Area* a1 = layout->AreaOf(button1);
-               Area* a2 = layout->AddViewToRight(button2, a1, layout->Right(), 
NULL,
-                       layout->AddYTab());
-               Area* a3 = layout->AddViewToBottom(button3, a2, 
layout->Bottom(),
-                       layout->AddXTab(), NULL);
-               Area* a4 = layout->AddViewToLeft(button4, a3, layout->Left(),
-                       a1->Bottom());
-
-               layout->AddView(textView1, a4->Right(), a1->Bottom(), 
a2->Left(),
-                       a3->Top());
-               a1->SetWidthAs(a3);
-               a1->SetHeightAs(a3);
-               */
-
                // test size limits
                BSize min = layout->MinSize();
                BSize max = layout->MaxSize();
diff --git a/src/tests/libs/alm/ThreeButtons.cpp 
b/src/tests/libs/alm/ThreeButtons.cpp
index f119ae1..582a82a 100644
--- a/src/tests/libs/alm/ThreeButtons.cpp
+++ b/src/tests/libs/alm/ThreeButtons.cpp
@@ -45,17 +45,6 @@ public:
                                .AddBelow(button2)
                                .AddBelow(button3, fLayout->Bottom());
 
-               /*
-               // create a new BALMLayout and use  it for this window
-               fLayout = new BALMLayout();
-               SetLayout(fLayout);
-               
-               fLayout->AddView(button1, fLayout->Left(), fLayout->Top(),
-                       fLayout->Right(), NULL);
-               fLayout->AddViewToBottom(button2);
-               fLayout->AddViewToBottom(button3, fLayout->Bottom());
-               */
-
                // test size limits
                BSize min = fLayout->MinSize();
                BSize max = fLayout->MaxSize();
diff --git a/src/tests/libs/alm/Views.cpp b/src/tests/libs/alm/Views.cpp
index 97ffe49..fc7d88a 100644
--- a/src/tests/libs/alm/Views.cpp
+++ b/src/tests/libs/alm/Views.cpp
@@ -78,35 +78,6 @@ public:
                                .AddToRight(stringView2)
                                .AddToRight(BSpaceLayoutItem::CreateGlue(), 
layout->Right());
 
-               /*
-               // create a new BALMLayout and use  it for this window
-               BALMLayout* layout = new BALMLayout(10);
-               SetLayout(layout);
-               layout->SetInsets(10.);
-
-               layout->AddView(button1, layout->Left(), layout->Top());
-               layout->AddViewToRight(radioButton);
-               layout->AddItemToRight(BSpaceLayoutItem::CreateGlue());
-               Area* a3 = layout->AddViewToRight(button3);
-               layout->SetCurrentArea(radioButton);
-               layout->AddViewToBottom(textView1, NULL, NULL, a3->Right());
-               layout->AddViewToBottom(button4);
-               layout->AddViewToRight(button5, layout->Right());
-               layout->AddViewToBottom(button6);
-
-               layout->AddView(menu1, layout->Left(), 
layout->BottomOf(button6));
-               layout->AddViewToRight(stringView1);
-               layout->AddItemToRight(BSpaceLayoutItem::CreateGlue(), 
layout->Right());
-
-               layout->AddViewToBottom(statusBar, NULL, layout->Left(),
-                       layout->Right());
-
-               layout->AddView(menu2, layout->Left(), 
layout->BottomOf(statusBar),
-                       layout->RightOf(menu1), layout->Bottom());
-               layout->AddViewToRight(stringView2);
-               layout->AddItemToRight(BSpaceLayoutItem::CreateGlue(), 
layout->Right());
-               */
-
                layout->Solver()->AddConstraint(2, layout->TopOf(menu1), -1,
                        layout->Bottom(), OperatorType(kEQ), 0);
 

############################################################################

Commit:      7dd17203c872a017368509c4891b074409c388e0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7dd1720
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 16 22:41:57 2012 UTC

Make Area insets more consistent with other HAIKU inset APIs.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/Area.h b/headers/libs/alm/Area.h
index 88c331c..c5be1aa 100644
--- a/headers/libs/alm/Area.h
+++ b/headers/libs/alm/Area.h
@@ -90,10 +90,17 @@ public:
                        void                            
SetShrinkPenalties(BSize shrink);
                        void                            SetGrowPenalties(BSize 
grow);
 
+                       void                            GetInsets(float* left, 
float* top, float* right,
+                                                                       float* 
bottom) const;
                        float                           LeftInset() const;
                        float                           TopInset() const;
                        float                           RightInset() const;
                        float                           BottomInset() const;
+
+                       void                            SetInsets(float insets);
+                       void                            SetInsets(float 
horizontal, float vertical);
+                       void                            SetInsets(float left, 
float top, float right,
+                                                                       float 
bottom);
                        void                            SetLeftInset(float 
left);
                        void                            SetTopInset(float top);
                        void                            SetRightInset(float 
right);
diff --git a/src/libs/alm/Area.cpp b/src/libs/alm/Area.cpp
index 5233371..fb0d8ed 100644
--- a/src/libs/alm/Area.cpp
+++ b/src/libs/alm/Area.cpp
@@ -12,6 +12,7 @@
 
 #include <Button.h>
 #include <CheckBox.h>
+#include <ControlLook.h>
 #include <PictureButton.h>
 #include <RadioButton.h>
 #include <StatusBar.h>
@@ -327,6 +328,20 @@ Area::SetContentAspectRatio(double ratio)
 }
 
 
+void
+Area::GetInsets(float* left, float* top, float* right, float* bottom) const
+{
+       if (left)
+               *left = fTopLeftInset.Width();
+       if (top)
+               *top = fTopLeftInset.Height();
+       if (right)
+               *right = fRightBottomInset.Width();
+       if (bottom)
+               *bottom = fRightBottomInset.Height();
+}
+
+
 /**
  * Gets left inset between area and its content.
  */
@@ -383,6 +398,50 @@ Area::BottomInset() const
 }
 
 
+void
+Area::SetInsets(float insets)
+{
+       if (insets != B_SIZE_UNSET)
+               insets = BControlLook::ComposeSpacing(insets);
+
+       fTopLeftInset.Set(insets, insets);
+       fRightBottomInset.Set(insets, insets);
+       fLayoutItem->Layout()->InvalidateLayout();
+}
+
+
+void
+Area::SetInsets(float horizontal, float vertical)
+{
+       if (horizontal != B_SIZE_UNSET)
+               horizontal = BControlLook::ComposeSpacing(horizontal);
+       if (vertical != B_SIZE_UNSET)
+               vertical = BControlLook::ComposeSpacing(vertical);
+
+       fTopLeftInset.Set(horizontal, horizontal);
+       fRightBottomInset.Set(vertical, vertical);
+       fLayoutItem->Layout()->InvalidateLayout();
+}
+
+
+void
+Area::SetInsets(float left, float top, float right, float bottom)
+{
+       if (left != B_SIZE_UNSET)
+               left = BControlLook::ComposeSpacing(left);
+       if (right != B_SIZE_UNSET)
+               right = BControlLook::ComposeSpacing(right);
+       if (top != B_SIZE_UNSET)
+               top = BControlLook::ComposeSpacing(top);
+       if (bottom != B_SIZE_UNSET)
+               bottom = BControlLook::ComposeSpacing(bottom);
+
+       fTopLeftInset.Set(left, top);
+       fRightBottomInset.Set(right, bottom);
+       fLayoutItem->Layout()->InvalidateLayout();
+}
+
+
 /**
  * Sets left inset between area and its content.
  */

############################################################################

Commit:      ddb65125f91b84129b4aa70102c005c05e02257b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ddb6512
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 01:26:56 2012 UTC

In alm test TableDemo: include Row.h and Column.h directly.

----------------------------------------------------------------------------

diff --git a/src/tests/libs/alm/TableDemo.cpp b/src/tests/libs/alm/TableDemo.cpp
index 9f42849..ffecbbc 100644
--- a/src/tests/libs/alm/TableDemo.cpp
+++ b/src/tests/libs/alm/TableDemo.cpp
@@ -13,6 +13,9 @@
 
 #include "ALMLayout.h"
 
+#include "Row.h"
+#include "Column.h"
+
 
 class TableDemoWindow : public BWindow {
 public:

############################################################################

Commit:      a25ffa4f046fb495c316d29f0645bd00c82751c8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a25ffa4
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 01:28:01 2012 UTC

Style cleanup in alm: mostly clean includes.

----------------------------------------------------------------------------

diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index b56ddf6..728be32 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -7,22 +7,23 @@
 
 
 #include <AbstractLayout.h>
-#include <File.h>
-#include <List.h>
 #include <Size.h>
-#include <SupportDefs.h>
-#include <View.h>
 
 #include "Area.h"
-#include "Column.h"
 #include "LinearSpec.h"
-#include "Row.h"
 #include "Tab.h"
 
 
+class BView;
+class BLayoutItem;
+
+
 namespace BALM {
 
 
+class Column;
+class GroupItem;
+class Row;
 class RowColumnManager;
 
 
@@ -57,7 +58,7 @@ public:
                        YTab*                           Top() const;
                        YTab*                           Bottom() const;
 
-                       LinearSpec*                     Solver() const;
+                       LinearProgramming::LinearSpec* Solver() const;
 
                        void                            SetInsets(float insets);
                        void                            SetInsets(float x, 
float y);
@@ -139,8 +140,8 @@ private:
                                                                        
BReference<XTab> right,
                                                                        
BReference<YTab> bottom);
 
-                       LinearSpec*                     fSolver;
-                       LinearSpec                      fOwnSolver;
+                       LinearProgramming::LinearSpec*  fSolver;
+                       LinearProgramming::LinearSpec   fOwnSolver;
 
                        BReference<XTab>        fLeft;
                        BReference<XTab>        fRight;
diff --git a/headers/libs/alm/ALMLayoutBuilder.h 
b/headers/libs/alm/ALMLayoutBuilder.h
index 3b3f92d..c81bb51 100644
--- a/headers/libs/alm/ALMLayoutBuilder.h
+++ b/headers/libs/alm/ALMLayoutBuilder.h
@@ -9,6 +9,8 @@
 #include "ALMLayout.h"
 
 
+class BLayoutItem;
+class BView;
 class BWindow;
 
 
diff --git a/headers/libs/alm/Area.h b/headers/libs/alm/Area.h
index c5be1aa..2932ba3 100644
--- a/headers/libs/alm/Area.h
+++ b/headers/libs/alm/Area.h
@@ -8,24 +8,32 @@
 
 #include <vector>
 
-#include <Alignment.h>
-#include <List.h>
+#include <InterfaceDefs.h> // for enum orientation
+#include <ObjectList.h>
+#include <Referenceable.h>
 #include <Size.h>
-#include <SupportDefs.h>
-#include <View.h>
+#include <String.h>
 
-#include "Column.h"
-#include "LinearSpec.h"
-#include "Row.h"
-#include "Tab.h"
 
+class BLayoutItem;
+class BView;
 
-class Constraint;
+
+namespace LinearProgramming {
+       class LinearSpec;
+       class Constraint;
+};
 
 
 namespace BALM {
 
 
+class Column;
+class Row;
+class XTab;
+class YTab;
+
+
 class GroupItem {
 public:
                                                                
GroupItem(BLayoutItem* item);
@@ -108,8 +116,11 @@ public:
 
                        BString                         ToString() const;
 
-                       Constraint*                     SetWidthAs(Area* area, 
float factor = 1.0f);
-                       Constraint*                     SetHeightAs(Area* area, 
float factor = 1.0f);
+                       LinearProgramming::Constraint*
+                                                               
SetWidthAs(Area* area, float factor = 1.0f);
+
+                       LinearProgramming::Constraint*
+                                                               
SetHeightAs(Area* area, float factor = 1.0f);
 
                        void                            
InvalidateSizeConstraints();
 
@@ -118,10 +129,11 @@ public:
 private:
                                                                
Area(BLayoutItem* item);
 
-                       void                            _Init(LinearSpec* ls, 
XTab* left, YTab* top,
-                                                                       XTab* 
right, YTab* bottom,
-                                                                       
RowColumnManager* manager);
-                       void                            _Init(LinearSpec* ls, 
Row* row, Column* column,
+                       void                            
_Init(LinearProgramming::LinearSpec* ls,
+                                                                       XTab* 
left, YTab* top, XTab* right,
+                                                                       YTab* 
bottom, RowColumnManager* manager);
+                       void                            
_Init(LinearProgramming::LinearSpec* ls,
+                                                                       Row* 
row, Column* column,
                                                                        
RowColumnManager* manager);
 
                        void                            _DoLayout();
@@ -132,7 +144,7 @@ private:
                        BLayoutItem*            fLayoutItem;
                        int32                           fID;
 
-                       LinearSpec*                     fLS;
+                       LinearProgramming::LinearSpec* fLS;
 
                        BReference<XTab>        fLeft;
                        BReference<XTab>        fRight;
@@ -148,15 +160,16 @@ private:
                        BSize                           fTopLeftInset;
                        BSize                           fRightBottomInset;
 
-                       BObjectList<Constraint> fConstraints;
-                       Constraint*                     fMinContentWidth;
-                       Constraint*                     fMaxContentWidth;
-                       Constraint*                     fMinContentHeight;
-                       Constraint*                     fMaxContentHeight;
                        double                          fContentAspectRatio;
-                       Constraint*                     fContentAspectRatioC;
-
                        RowColumnManager*       fRowColumnManager;
+
+                       BObjectList<LinearProgramming::Constraint>      
fConstraints;
+                       LinearProgramming::Constraint* fMinContentWidth;
+                       LinearProgramming::Constraint* fMaxContentWidth;
+                       LinearProgramming::Constraint* fMinContentHeight;
+                       LinearProgramming::Constraint* fMaxContentHeight;
+                       LinearProgramming::Constraint* fContentAspectRatioC;
+
 public:
        friend class BALMLayout;
        friend class RowColumnManager;
diff --git a/headers/libs/alm/Column.h b/headers/libs/alm/Column.h
index 99a8a40..50cc05b 100644
--- a/headers/libs/alm/Column.h
+++ b/headers/libs/alm/Column.h
@@ -6,9 +6,14 @@
 #define        COLUMN_H
 
 
-#include "Constraint.h"
-#include "LinearSpec.h"
-#include "Tab.h"
+#include <ObjectList.h>
+#include <Referenceable.h>
+
+
+namespace LinearProgramming {
+       class Constraint;
+       class LinearSpec;
+};
 
 
 namespace BALM {
@@ -17,6 +22,8 @@ namespace BALM {
 class Area;
 class BALMLayout;
 class RowColumnManager;
+class XTab;
+class YTab;
 
 
 /**
@@ -30,14 +37,16 @@ public:
                        XTab*                           Right() const;
 
 private:
-                                                               
Column(LinearSpec* ls, XTab* left, XTab* right);
+                                                               
Column(LinearProgramming::LinearSpec* ls,
+                                                                       XTab* 
left, XTab* right);
 
-                       LinearSpec*                     fLS;
                        BReference<XTab>        fLeft;
                        BReference<XTab>        fRight;
 
-                       //! managed by RowColumnManager
-                       Constraint*                     fPrefSizeConstraint;
+                       LinearProgramming::LinearSpec* fLS;
+                       LinearProgramming::Constraint* fPrefSizeConstraint;
+                               // managed by RowColumnManager
+
                        BObjectList<Area>       fAreas;
 
 public:
diff --git a/headers/libs/alm/Row.h b/headers/libs/alm/Row.h
index 09e9728..b5af7c7 100644
--- a/headers/libs/alm/Row.h
+++ b/headers/libs/alm/Row.h
@@ -6,9 +6,14 @@
 #define        ROW_H
 
 
-#include "Constraint.h"
-#include "LinearSpec.h"
-#include "Tab.h"
+#include <ObjectList.h>
+#include <Referenceable.h>
+
+
+namespace LinearProgramming {
+       class Constraint;
+       class LinearSpec;
+};
 
 
 namespace BALM {
@@ -17,6 +22,8 @@ namespace BALM {
 class Area;
 class BALMLayout;
 class RowColumnManager;
+class XTab;
+class YTab;
 
 
 /**
@@ -30,14 +37,16 @@ public:
                        YTab*                           Bottom() const;
 
 private:
-                                                               Row(LinearSpec* 
ls, YTab* top, YTab* bottom);
+                                                               
Row(LinearProgramming::LinearSpec* ls,
+                                                                               
YTab* top, YTab* bottom);
 
-                       LinearSpec*                     fLS;
                        BReference<YTab>        fTop;
                        BReference<YTab>        fBottom;
 
-                       //! managed by RowColumnManager
-                       Constraint*                     fPrefSizeConstraint;
+                       LinearProgramming::LinearSpec* fLS;
+                       LinearProgramming::Constraint* fPrefSizeConstraint;
+                               // managed by RowColumnManager
+
                        BObjectList<Area>       fAreas;
 
 public:
diff --git a/headers/libs/alm/Tab.h b/headers/libs/alm/Tab.h
index 3110451..a1b4daa 100644
--- a/headers/libs/alm/Tab.h
+++ b/headers/libs/alm/Tab.h
@@ -7,7 +7,7 @@
 
 
 #include <Referenceable.h>
-#include "LinearSpec.h"
+
 #include "Variable.h"
 
 
@@ -24,9 +24,8 @@ class XTab : public Variable, public BReferenceable {
 public:
        virtual                                         ~XTab();
 
-       friend  class                           BALMLayout;
-
 protected:
+       friend  class                           BALMLayout;
                                                                
XTab(BALMLayout* layout);
 
 private:
@@ -38,9 +37,8 @@ class YTab : public Variable, public BReferenceable {
 public:
        virtual                                         ~YTab();
 
-       friend  class                           BALMLayout;
-
 protected:
+       friend  class                           BALMLayout;
                                                                
YTab(BALMLayout* layout);
 
 private:
diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp
index 0261deb..49ff892 100644
--- a/src/libs/alm/ALMLayout.cpp
+++ b/src/libs/alm/ALMLayout.cpp
@@ -6,9 +6,7 @@
  */
 #include "ALMLayout.h"
 
-#include <math.h>              // for floor
-#include <new>
-#include <iostream>
+
 #include <vector>
 
 #include <ControlLook.h>
diff --git a/src/libs/alm/ALMLayoutBuilder.cpp 
b/src/libs/alm/ALMLayoutBuilder.cpp
index 62dc5a9..ea37b12 100644
--- a/src/libs/alm/ALMLayoutBuilder.cpp
+++ b/src/libs/alm/ALMLayoutBuilder.cpp
@@ -7,6 +7,8 @@
 
 #include <Window.h>
 
+#include "Area.h"
+
 
 namespace BALM {
 
diff --git a/src/libs/alm/Area.cpp b/src/libs/alm/Area.cpp
index fb0d8ed..8b3bf9f 100644
--- a/src/libs/alm/Area.cpp
+++ b/src/libs/alm/Area.cpp
@@ -4,22 +4,16 @@
  * Copyright 2010, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx>
  * Distributed under the terms of the MIT License.
  */
-
-
 #include "Area.h"
 
-#include <algorithm>   // for max
-
-#include <Button.h>
-#include <CheckBox.h>
+#include <Alignment.h>
 #include <ControlLook.h>
-#include <PictureButton.h>
-#include <RadioButton.h>
-#include <StatusBar.h>
-#include <StringView.h>
+#include <View.h>
 
 #include "ALMLayout.h"
 #include "RowColumnManager.h"
+#include "Row.h"
+#include "Column.h"
 
 
 using namespace LinearProgramming;
@@ -595,12 +589,14 @@ Area::Area(BLayoutItem* item)
        fShrinkPenalties(5, 5),
        fGrowPenalties(5, 5),
 
+       fContentAspectRatio(-1),
+       fRowColumnManager(NULL),
+
        fMinContentWidth(NULL),
        fMaxContentWidth(NULL),
        fMinContentHeight(NULL),
        fMaxContentHeight(NULL),
 
-       fContentAspectRatio(-1),
        fContentAspectRatioC(NULL)
 {
        fID = new_area_id();
diff --git a/src/libs/alm/Column.cpp b/src/libs/alm/Column.cpp
index 33fcb4e..26a711d 100644
--- a/src/libs/alm/Column.cpp
+++ b/src/libs/alm/Column.cpp
@@ -5,11 +5,10 @@
  * Copyright 2010, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx>
  * Distributed under the terms of the MIT License.
  */
-
-
 #include "Column.h"
 
 #include "ALMLayout.h"
+#include "Area.h"

[ *** diff truncated: 78 lines dropped *** ]


############################################################################

Commit:      0da6f2e916c5912ab5b2bd2d8aa271cf31a3300a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0da6f2e
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 02:50:57 2012 UTC

Rename BALM::GroupItem to BALM::ALMGroup, and move it to its own files.

Also make ALMGroup totally self-contained, i.e. BALMLayout no longer
does the parsing, and is completely unaware of ALMGroup. A small touch
of refactoring as well.

----------------------------------------------------------------------------

############################################################################

Commit:      7e021d45dad8e78bce48a81a5524ed6497715ba1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7e021d4
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 03:07:48 2012 UTC

Make BALM::InsetForTab() methods const.

----------------------------------------------------------------------------

############################################################################

Commit:      324ce2851d93d3f1311498517b4cc67fb3d9ebfd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=324ce28
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 03:21:32 2012 UTC

Add FBC padding to ALM classes.

----------------------------------------------------------------------------

############################################################################

Commit:      f0307e765ed63a07ff0ad29df44b8d5d2f354acb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f0307e7
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 03:48:42 2012 UTC

Fix spacing before first header in src/libs/alm.

Also add copyright header in ALMGroup.cpp.

----------------------------------------------------------------------------

############################################################################

Commit:      895414da9d7ffb377c7fc0622054ec3ce9e1893a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=895414d
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 20:08:53 2012 UTC

In BALM::Area rename fTopLeftInset to fLeftTopInset.

This is consistent with for instance, the BSize ctor.

----------------------------------------------------------------------------

############################################################################

Commit:      20cc993ab504286d6c59bcbe273a040e61eafe7f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=20cc993
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 20:20:07 2012 UTC

Remove BALM::Area::fConstraints field, which is not needed.

It's easier to just delete all the constraints in the dtor, the ones that
wouldn't have been in fConstraints are NULL at this point anyway.

----------------------------------------------------------------------------

############################################################################

Commit:      de245ca01715397823b59145f4b1bd6f8939723d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=de245ca
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 21:19:11 2012 UTC

Adjust IMAP addon for changes in BALMLayout.

----------------------------------------------------------------------------

############################################################################

Commit:      548c302600b4b8818aa949051fc3c0ec59ebd193
URL:         http://cgit.haiku-os.org/haiku/commit/?id=548c302
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 21:20:48 2012 UTC

Adjust MusicCollection app for changes in BALMLayout.

----------------------------------------------------------------------------

############################################################################

Commit:      3479e516b76c6af5acd98fd7f4dda3732dde47fd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3479e51
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 21:21:24 2012 UTC

Compose spacing given to BALMLayout constructor.

----------------------------------------------------------------------------

############################################################################

Commit:      57d93f836d5187c8029a749bb2dc20a1f0344c8f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=57d93f8
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 17 22:37:19 2012 UTC

Disable debug output by default in linprog.

----------------------------------------------------------------------------

############################################################################

Commit:      2bbf8b1fbce74bf6e72aa5f5a223de4948e67afc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2bbf8b1
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Wed Jan 18 03:19:10 2012 UTC

Add the ability to handle bad layouts to BALMLayout.

----------------------------------------------------------------------------

############################################################################

Commit:      03adc8c767ae8f34a168694ca93d070de9a01b83
URL:         http://cgit.haiku-os.org/haiku/commit/?id=03adc8c
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Wed Jan 18 03:27:24 2012 UTC

Add test for BALMLayout's bad layout handling.

----------------------------------------------------------------------------

############################################################################

Commit:      51b5b66b0111c34ac5ae42024535cd5935dcb4e1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=51b5b66
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Wed Jan 18 03:49:07 2012 UTC

Remove lp_solve as a dependency of the linprog lib.

Really, it hasn't depended on lp_solve for a while, but it was still
linked in in some places.

----------------------------------------------------------------------------

############################################################################

Commit:      f6db102e4762ea9b85e9de9add21f6e5adb5b99c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f6db102
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 19 22:02:54 2012 UTC

Make BALMLayout respect its position when nested.

----------------------------------------------------------------------------

############################################################################

Commit:      1c8104a70e5ccd1a786ee52ddb17c281775ec4f5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1c8104a
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 19 22:06:11 2012 UTC

Add a test for nested BALMLayouts.

----------------------------------------------------------------------------

############################################################################

Commit:      7c3800078e96a5f45ee5d13863a49917ecf3fca0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7c38000
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Wed Jan 18 04:06:19 2012 UTC

Make LinearProgramming::LinearSpec BReferenceable.

----------------------------------------------------------------------------

############################################################################

Commit:      f9cabdd00949d006252087a791c5d458fbfb5291
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f9cabdd
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Wed Jan 18 04:10:10 2012 UTC

Use BReferenceable properties of LinearSpec in BALMLayout.

This saves us from a potential use-afte-free bug.

----------------------------------------------------------------------------

############################################################################

Commit:      c761a8a6d40be981d18141bfc6eae56b168bcf52
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c761a8a
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Wed Jan 18 21:48:29 2012 UTC

Let BALM::{X|Y}Tabs be in multiple BALMLayouts, if they are friendly.

----------------------------------------------------------------------------

############################################################################

Commit:      c640be198baf65320df5d808860ae28e24055fbb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c640be1
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 19 00:07:14 2012 UTC

Add a test for ALM's 'friend' behaviour.

----------------------------------------------------------------------------

############################################################################

Commit:      93977272f4854e506ecfa0e007eae791415418d0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9397727
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 19 00:36:47 2012 UTC

When adding tabs to a BALMLayout, ensure they are fully added.

----------------------------------------------------------------------------

############################################################################

Commit:      a9761aedbf6ec7f30c9b9d3521796b97c7029182
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a9761ae
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 19 01:56:29 2012 UTC

Refactor BALMLayout::AddItem to reduce repitition.

----------------------------------------------------------------------------

############################################################################

Commit:      708a298e22985c28dc8189aeab5a5c5dcfe57740
URL:         http://cgit.haiku-os.org/haiku/commit/?id=708a298
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 19 03:37:13 2012 UTC

Refactor XTab and YTab to share a common base, TabBase.

TabBase takes care of layout tracking etc..

----------------------------------------------------------------------------

############################################################################

Commit:      419fe0b8ae0e16d798868eeebf0282978deb224d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=419fe0b
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 00:12:26 2012 UTC

Introduce SharedSolver class to improve BALMLayout's friend feature.

----------------------------------------------------------------------------

############################################################################

Commit:      82a0965357f6e9d59ddd9f3d4b01af9590df404c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=82a0965
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 00:19:13 2012 UTC

Improve efficiency when validating an ALM layout.

----------------------------------------------------------------------------

############################################################################

Commit:      93904ad087035cc769a2f87b3fa997af31ab736b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=93904ad
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 00:56:25 2012 UTC

Have SharedSolver return the solver result from Validate*() methods.

----------------------------------------------------------------------------

############################################################################

Commit:      09e87fa352d105abd802b98ac6a842cb726d9d2d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=09e87fa
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 00:57:55 2012 UTC

Pass more information to BadLayoutPolicy.

Also, re-add BadLayoutPolicy invocations, which were lost while creating
SharedSolver.

----------------------------------------------------------------------------

############################################################################

Commit:      ac84362568a3ed1301dff6dd200445f9f0f0ac56
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ac84362
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 01:00:19 2012 UTC

Update BadLayout test to sync with OnBadLayout changes.

----------------------------------------------------------------------------

############################################################################

Commit:      3ade12dd15a6bca049e0b24f9523d65d6ec70450
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3ade12d
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 02:20:11 2012 UTC

Make BALMLayout::BasePreferredSize() useful again.

----------------------------------------------------------------------------

############################################################################

Commit:      1cbe95140ab8834273b1ddf2bf485ea69c1de4ca
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1cbe951
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 03:03:24 2012 UTC

Refactor SharedSolver::Validate*() methods a bit more.

----------------------------------------------------------------------------

############################################################################

Commit:      a9242e3d98eaca6056ea744e6437b08029b16cf8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a9242e3
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 03:22:37 2012 UTC

Properly handle unbounded results in SharedSolver::Validate{Min|Max}()

----------------------------------------------------------------------------

############################################################################

Commit:      fbd2dfcf173cb1d2d809efdf2b83e3a202e021e3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fbd2dfc
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 04:00:36 2012 UTC

Refactor ActiveSetSolver::Find{Min|Max}s().

----------------------------------------------------------------------------

############################################################################

Commit:      af6ddb01dffdb078b8637ecfea3e6957b3989035
URL:         http://cgit.haiku-os.org/haiku/commit/?id=af6ddb0
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 04:16:56 2012 UTC

Improve FriendLayout test to test invalidations as well.

----------------------------------------------------------------------------

############################################################################

Commit:      6169a6e3d148db0d281a085e514abe6f28a64d9b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6169a6e
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 21:17:10 2012 UTC

Minimize the effect invisible items have on a BALMLayout.

There seems to still be some effect on positioning, but invisible items
no longer constrain the layout.

----------------------------------------------------------------------------

############################################################################

Commit:      681f48fcbccfa556fe01eab457ca1d549736b19e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=681f48f
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 22:19:51 2012 UTC

Replace BALMLayout::Ordered*Tabs() method with *TabAt(int, bool sorted).

----------------------------------------------------------------------------

############################################################################

Commit:      0bd511a33133366456af89fe027fde758b01d60c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0bd511a
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Jan 23 23:47:24 2012 UTC

Avoid use after free in RowColumnManager.cpp

Fixes CID 10862

----------------------------------------------------------------------------

############################################################################

Commit:      35babcf06de19176daff46ec7c5226bf10d989bf
URL:         http://cgit.haiku-os.org/haiku/commit/?id=35babcf
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Fri Jan 20 03:34:01 2012 UTC
Committer:   Alex Wilson <yourpalal2@xxxxxxxxx>
Commit-Date: Wed May  2 20:45:19 2012 UTC

Allow left and top tab to be NULL.

----------------------------------------------------------------------------

############################################################################

Commit:      c4340eab04bfd4baa7bda6782c7e55dea1f5c467
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c4340ea
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Fri Jan 20 03:47:01 2012 UTC
Committer:   Alex Wilson <yourpalal2@xxxxxxxxx>
Commit-Date: Wed May  2 20:45:21 2012 UTC

Fix row column weight.

----------------------------------------------------------------------------

############################################################################

Commit:      4878cc70e2078a5c4ffde670e7cd499cf034a787
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4878cc7
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Wed Jan 25 02:16:56 2012 UTC

Don't remove ourselves from a BLayoutContext when it is leaving.

----------------------------------------------------------------------------

############################################################################

Commit:      15ef732f0df77b6e9948dc7e26e8d74c04a6cbb2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=15ef732
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Thu Feb  9 22:39:35 2012 UTC
Committer:   Alex Wilson <yourpalal2@xxxxxxxxx>
Commit-Date: Wed May  2 20:45:23 2012 UTC

Check first if we own the constraint before deleting it.

----------------------------------------------------------------------------

############################################################################

Commit:      d7568eabd2d523e465efeb763e7644ea81af4ae7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d7568ea
Author:      czeidler <czei002@xxxxxxxxxxxxxxxxx>
Date:        Sat Mar 17 17:16:50 2012 UTC
Committer:   Alex Wilson <yourpalal2@xxxxxxxxx>
Commit-Date: Wed May  2 20:45:25 2012 UTC

Add IndexOf methods.

----------------------------------------------------------------------------

############################################################################

Commit:      bc7956c7cf99bd57a7a1da96d08c71daa426b8b0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bc7956c
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Jan 26 01:20:44 2012 UTC

Use const overloading on BALMLayout::{X|Y}TabAt().

----------------------------------------------------------------------------

############################################################################

Commit:      0a408e4992b7dbce2a1cb64267c98297b5282010
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0a408e4
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 31 20:52:55 2012 UTC

Make it possible to have a Variable not belonging to any LinearSpec.

----------------------------------------------------------------------------

############################################################################

Commit:      4ca2a447795eca7223ce9a8a033093118740e475
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4ca2a44
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 31 20:55:38 2012 UTC

Make ownership-taking idempotent during unarchiving.

The previous scheme made it hard to deal with reference-counted objects,
which may be owned by many objects.

----------------------------------------------------------------------------

############################################################################

Commit:      f9c58743e355efd04ef3ea485ed544b8b10f5cd5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f9c5874
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 31 22:02:56 2012 UTC

Fix possible NULL dereference in TabBase::IsInLayout().

----------------------------------------------------------------------------

############################################################################

Commit:      35bf0b5c1c5f89dac389efde9bcf19e880fa04e4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=35bf0b5
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue Jan 31 22:19:07 2012 UTC

Add initial support for archiving a BALMLayout.

What's supported:
* basic archive/instantiate
* friend layouts
coming soon:
* saving of custom restraints
* archiving of BadLayoutPolicy

----------------------------------------------------------------------------

############################################################################

Commit:      015e5f06d8ef8f719a69ee03779ae30192b9e46b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=015e5f0
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Wed Feb  1 02:07:51 2012 UTC

Make BALMLayout::BadLayoutPolicy archivable.

----------------------------------------------------------------------------

############################################################################

Commit:      bad1d6ba7e5ccd61463e13e23b6f6b661c1e86b3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bad1d6b
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Feb  2 01:02:03 2012 UTC

Make Variable::SetRange() more forgiving.

----------------------------------------------------------------------------

############################################################################

Commit:      0a5e130725e2e8997bc0d9db9717f0a7874da8f3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0a5e130
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Feb  2 01:47:41 2012 UTC

Make SharedSolver BArchivable to save extra user constraints.

----------------------------------------------------------------------------

############################################################################

Commit:      df2ad5204067ff611bc87a453aafa2f005c1e145
URL:         http://cgit.haiku-os.org/haiku/commit/?id=df2ad52
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Feb  2 03:11:59 2012 UTC

Archive more details about areas in BALMLayout.

----------------------------------------------------------------------------

############################################################################

Commit:      4199a81a8d10740893b6804c77ad3e5090559c94
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4199a81
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Feb  2 03:23:11 2012 UTC

Add archiving to ALMHelloWorld test.

----------------------------------------------------------------------------

############################################################################

Commit:      bf0b62a0043c2cb1c170734c275e4686c2b1f916
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bf0b62a
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Feb  2 03:28:17 2012 UTC

Add archiving to ALMFriendLayout test.

----------------------------------------------------------------------------

############################################################################

Commit:      d10cb215dc1f3812f4a7b3d59c94efc72d5706d1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d10cb21
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Thu Apr 26 06:02:03 2012 UTC

in BALMLayout::DefaultPolicy, call printf instead of debugger.

This is more user friendly, debugger() was a bit drastic.

----------------------------------------------------------------------------

############################################################################

Commit:      5f4e71ba4c63aa95d44b7bbce9f7460e347684fb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5f4e71b
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Apr 30 01:58:31 2012 UTC

Replace BALMLayoutBuilder::Snake class with a stack.

The interface to BALMLayoutBuilder is still pretty much the same, but
this simplifies the class a bit.

----------------------------------------------------------------------------

############################################################################

Commit:      c8b24e3eb51bac128f5eeb0a5a22a60b69a1a53e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c8b24e3
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Mon Apr 30 02:07:06 2012 UTC

Fix BALMLayout archiving issues.

SharedSolver was archiving too many constraints, partly because of
multiple typos, also because it archived some which were just artifacts
of the layout process. These extra constraints are created when the
layout calls SetRange() on the left/top/right/bottom tabs during layout.

* LinearSpec/ActiveSetSolver had to be adjusted to get access to the
  constraints added by the SetRange() calls.
* BALM::TabBase was adjusted to avoid a segfault during unarchiving,
  caused by an unitialized member.
* ALMFriendLayoutTest was adjusted to include a more obvious custom
  constraint for testing.

----------------------------------------------------------------------------

############################################################################

Commit:      45f28e068b1bd0dff0155020c60d8703d4fe8d09
URL:         http://cgit.haiku-os.org/haiku/commit/?id=45f28e0
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue May  1 01:43:10 2012 UTC

Fix error in height calculation in alm/SharedSolver.

----------------------------------------------------------------------------

############################################################################

Revision:    hrev44092
Commit:      6457a6517eaa53baeb531ce9995617c3caa7010e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6457a65
Author:      Alex Wilson <yourpalal2@xxxxxxxxx>
Date:        Tue May  1 04:02:50 2012 UTC

Fix bug from the removal of BALMLayoutBuilder::Snake.

GCC considers the method chain one big function call, so pushes all
parameters onto the stack before hand (something I discovered after
quite a bit of debugging). In this case, layout->RightOf() returns NULL
before the view is added, which caused the layout to become undefined.

----------------------------------------------------------------------------


Other related posts: