From a25ffa4f046fb495c316d29f0645bd00c82751c8 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Tue, 17 Jan 2012 14:28:01 +1300 Subject: [PATCH] Style cleanup in alm: mostly clean includes. --- headers/libs/alm/ALMLayout.h | 19 ++++----- headers/libs/alm/ALMLayoutBuilder.h | 2 + headers/libs/alm/Area.h | 61 +++++++++++++++++------------ headers/libs/alm/Column.h | 23 +++++++---- headers/libs/alm/Row.h | 23 +++++++---- headers/libs/alm/Tab.h | 8 ++-- src/libs/alm/ALMLayout.cpp | 4 +- src/libs/alm/ALMLayoutBuilder.cpp | 2 + src/libs/alm/Area.cpp | 18 ++++----- src/libs/alm/Column.cpp | 5 +-- src/libs/alm/Row.cpp | 7 +--- src/libs/alm/RowColumnManager.cpp | 3 +- src/libs/alm/Tab.cpp | 3 +- 13 files changed, 100 insertions(+), 78 deletions(-) diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h index b56ddf69d8..728be32c40 100644 --- a/headers/libs/alm/ALMLayout.h +++ b/headers/libs/alm/ALMLayout.h @@ -7,22 +7,23 @@ #include -#include -#include #include -#include -#include #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 right, BReference bottom); - LinearSpec* fSolver; - LinearSpec fOwnSolver; + LinearProgramming::LinearSpec* fSolver; + LinearProgramming::LinearSpec fOwnSolver; BReference fLeft; BReference fRight; diff --git a/headers/libs/alm/ALMLayoutBuilder.h b/headers/libs/alm/ALMLayoutBuilder.h index 3b3f92d96b..c81bb5109f 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 c5be1aa588..2932ba3dcc 100644 --- a/headers/libs/alm/Area.h +++ b/headers/libs/alm/Area.h @@ -8,24 +8,32 @@ #include -#include -#include +#include // for enum orientation +#include +#include #include -#include -#include - -#include "Column.h" -#include "LinearSpec.h" -#include "Row.h" -#include "Tab.h" +#include -class Constraint; +class BLayoutItem; +class BView; + + +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 fLeft; BReference fRight; @@ -148,15 +160,16 @@ private: BSize fTopLeftInset; BSize fRightBottomInset; - BObjectList fConstraints; - Constraint* fMinContentWidth; - Constraint* fMaxContentWidth; - Constraint* fMinContentHeight; - Constraint* fMaxContentHeight; double fContentAspectRatio; - Constraint* fContentAspectRatioC; - RowColumnManager* fRowColumnManager; + + BObjectList 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 99a8a4094f..50cc05b74e 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 +#include + + +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 fLeft; BReference fRight; - //! managed by RowColumnManager - Constraint* fPrefSizeConstraint; + LinearProgramming::LinearSpec* fLS; + LinearProgramming::Constraint* fPrefSizeConstraint; + // managed by RowColumnManager + BObjectList fAreas; public: diff --git a/headers/libs/alm/Row.h b/headers/libs/alm/Row.h index 09e9728ea9..b5af7c7cad 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 +#include + + +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 fTop; BReference fBottom; - //! managed by RowColumnManager - Constraint* fPrefSizeConstraint; + LinearProgramming::LinearSpec* fLS; + LinearProgramming::Constraint* fPrefSizeConstraint; + // managed by RowColumnManager + BObjectList fAreas; public: diff --git a/headers/libs/alm/Tab.h b/headers/libs/alm/Tab.h index 31104516ba..a1b4daaa88 100644 --- a/headers/libs/alm/Tab.h +++ b/headers/libs/alm/Tab.h @@ -7,7 +7,7 @@ #include -#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 0261debcd8..49ff892f93 100644 --- a/src/libs/alm/ALMLayout.cpp +++ b/src/libs/alm/ALMLayout.cpp @@ -6,9 +6,7 @@ */ #include "ALMLayout.h" -#include // for floor -#include -#include + #include #include diff --git a/src/libs/alm/ALMLayoutBuilder.cpp b/src/libs/alm/ALMLayoutBuilder.cpp index 62dc5a9245..ea37b12324 100644 --- a/src/libs/alm/ALMLayoutBuilder.cpp +++ b/src/libs/alm/ALMLayoutBuilder.cpp @@ -7,6 +7,8 @@ #include +#include "Area.h" + namespace BALM { diff --git a/src/libs/alm/Area.cpp b/src/libs/alm/Area.cpp index fb0d8edbf6..8b3bf9fa43 100644 --- a/src/libs/alm/Area.cpp +++ b/src/libs/alm/Area.cpp @@ -4,22 +4,16 @@ * Copyright 2010, Clemens Zeidler * Distributed under the terms of the MIT License. */ - - #include "Area.h" -#include // for max - -#include -#include +#include #include -#include -#include -#include -#include +#include #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 33fcb4ebb2..26a711d73d 100644 --- a/src/libs/alm/Column.cpp +++ b/src/libs/alm/Column.cpp @@ -5,11 +5,10 @@ * Copyright 2010, Clemens Zeidler * Distributed under the terms of the MIT License. */ - - #include "Column.h" #include "ALMLayout.h" +#include "Area.h" #include "Tab.h" @@ -51,9 +50,9 @@ Column::~Column() */ Column::Column(LinearSpec* ls, XTab* left, XTab* right) : - fLS(ls), fLeft(left), fRight(right), + fLS(ls), fPrefSizeConstraint(NULL) { diff --git a/src/libs/alm/Row.cpp b/src/libs/alm/Row.cpp index d4e8e9cc5e..5760e6313c 100644 --- a/src/libs/alm/Row.cpp +++ b/src/libs/alm/Row.cpp @@ -5,15 +5,12 @@ * Copyright 2010, Clemens Zeidler * Distributed under the terms of the MIT License. */ - - #include "Row.h" #include "ALMLayout.h" +#include "Area.h" #include "Tab.h" -#include - using namespace LinearProgramming; @@ -53,9 +50,9 @@ Row::~Row() */ Row::Row(LinearSpec* ls, YTab* top, YTab* bottom) : - fLS(ls), fTop(top), fBottom(bottom), + fLS(ls), fPrefSizeConstraint(NULL) { diff --git a/src/libs/alm/RowColumnManager.cpp b/src/libs/alm/RowColumnManager.cpp index f7593ebda8..60b9c52ea5 100644 --- a/src/libs/alm/RowColumnManager.cpp +++ b/src/libs/alm/RowColumnManager.cpp @@ -3,10 +3,9 @@ * Copyright 2011, Clemens Zeidler * Distributed under the terms of the MIT License. */ - - #include "RowColumnManager.h" + #include diff --git a/src/libs/alm/Tab.cpp b/src/libs/alm/Tab.cpp index a116bcb5a8..4fd1175a81 100644 --- a/src/libs/alm/Tab.cpp +++ b/src/libs/alm/Tab.cpp @@ -2,10 +2,9 @@ * Copyright 2011, Clemens Zeidler * Distributed under the terms of the MIT License. */ - - #include + #include